diff --git a/.gitignore b/.gitignore index 61e04f6feb..11856c793a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /nbproject/* /config/* +.DS_Store !.gitignore +.DS_Store +/vendor/.composer/ +/www/skins/html5/bootstrap/docs/build/node_modules/.bin/ diff --git a/.gitmodules b/.gitmodules index ead3b9fa61..1572d300e3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,3 +49,26 @@ [submodule "lib/vendor/Twig-extensions"] path = lib/vendor/Twig-extensions url = git://github.com/fabpot/Twig-extensions.git +[submodule "lib/vendor/doctrine2-gedmo"] + path = lib/vendor/doctrine2-gedmo + url = git://github.com/l3pp4rd/DoctrineExtensions.git +[submodule "lib/vendor/doctrine2-orm"] + path = lib/vendor/doctrine2-orm + url = git://github.com/doctrine/doctrine2.git +[submodule "lib/vendor/data-fixtures"] + path = lib/vendor/data-fixtures + url = https://github.com/doctrine/data-fixtures +[submodule "www/include/vendor/humane-js"] + path = www/include/vendor/humane-js + url = https://github.com/wavded/humane-js.git + + +[submodule "www/include/vendor/qunit"] + path = www/include/vendor/qunit + url = git://github.com/jquery/qunit.git +[submodule "lib/vendor/doctrine2-beberlei"] + path = lib/vendor/doctrine2-beberlei + url = git://github.com/beberlei/DoctrineExtensions.git +[submodule "www/include/vendor/mustache-js"] + path = www/include/vendor/mustache-js + url = https://github.com/janl/mustache.js.git diff --git a/README.md b/README.md index 99d1b6e858..29b5712620 100644 --- a/README.md +++ b/README.md @@ -5,25 +5,16 @@ Phraseanet 3.5 - Digital Asset Management application Metadatas Management (include Thesaurus and DublinCore Mapping) Search Engine (Sphinx Search Integration) -RestFull APIS (See Developer Documentation http://docs.phraseanet.com/Devel) +RestFull APIS (See Developer Documentation https://docs.phraseanet.com/3.6/Devel) Bridge to Youtube/Dailymotion/Flickr #Documentation : -http://docs.phraseanet.com +https://docs.phraseanet.com/3.6/ #Easy Installation -**Fetch Sources** - -
-
-git clone git://github.com/alchemy-fr/Phraseanet.git Phraseanet
-cd Phraseanet
-./vendors.php
-
-
- +Get the latests sources here https://github.com/alchemy-fr/Phraseanet/downloads **Setup your webserver** @@ -58,4 +49,4 @@ Let's go ! Phraseanet is licensed under GPL-v3 license. -[1]: http://developer.phraseanet.com/ \ No newline at end of file +[1]: http://developer.phraseanet.com/ diff --git a/bin/changefield.exe.php b/bin/changefield.exe.php deleted file mode 100644 index 47e2d1e409..0000000000 --- a/bin/changefield.exe.php +++ /dev/null @@ -1,308 +0,0 @@ -get('GV_RootPath') . "lib/classes/deprecated/getargs.php"); // le parser d'arguments de la ligne de commande - -function printHelp(&$argt, &$conn) -{ - print_usage($argt); -} - -$argt = array( - "--help" => array("set" => false, "values" => array(), "usage" => " : this help") - , "--sbas-id" => array("set" => false, "values" => array(), "usage" => "=sbas_id : sbas_id to check") - , "--field" => array("set" => false, "values" => array(), "usage" => "(=field | : delete this field from records") - , "--showstruct" => array("set" => false, "values" => array(), "usage" => "") -); - -function help() -{ - global $argv; - printf("usage: %s [options]\n", $argv[0]); - print("options:\n"); - print("\t--help : this help\n"); - print("\t--sbas=sbas_id : sbas to change (if --help, list fields)\n"); - print("\t--showstruct : show structure changes and quit\n"); - print("\t--field=fieldname : delete fieldname from records\n"); - print("\t--field=\"oldname:newname\" : rename field oldname to newname into records\n"); - print("\t[--field=...] : --field=... can be repeated\n"); -} - -// on commence par se conncter e application box -$allbas = array(); - -$conn = connection::getPDOConnection(); - -$sql = "SELECT * FROM sbas"; -$stmt = $conn->prepare($sql); -$stmt->execute(); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -foreach ($rs as $tmprow) -{ - $allbas["B" . $tmprow["sbas_id"]] = $tmprow; -} - -$error = false; - -if (!parse_cmdargs($argt, $err)) -{ - help(); - print($err); - die(); -} - -if ($argt["--help"]["set"]) -{ - help(); - $error = true; -} - -if (!$argt['--sbas-id']['set']) -{ - print("missing option 'sbas-id'.\n"); - $error = true; -} - -$fields = null; -if ($argt['--field']['set']) -{ - foreach ($argt["--field"]["values"] as $f) - { - $f = explode(':', $f); - $f[] = null; - $fields[] = array('from' => $f[0], 'to' => $f[1]); - } -} - -$domstruct = null; - -if ($argt["--sbas-id"]["set"]) -{ - $sbas_id = $argt["--sbas-id"]["values"][0]; - // sauf erreur, on a l'adresse du serveur distant - $row = null; - if (array_key_exists("B" . $sbas_id, $allbas)) - $row = $allbas["B" . $sbas_id]; - if ($row) - { - try - { - $databox = databox::get_instance($sbas_id); - $tfields = array(); - - if ($argt["--help"]["set"]) - echo("fields of sbas=" . $sbas_id . " :\n"); - - $domstruct = $databox->get_dom_structure(); - $xp = $databox->get_xpath_structure(); - - if ($domstruct) - { - $xp = new DOMXPath($domstruct); - - $xf = @$xp->query('/record/description/*'); - foreach ($xf as $f) - { - $tfields[] = $f->nodeName; - if ($argt["--help"]["set"]) - printf("\t%s \n", $f->nodeName); - } - - if ($argt["--showstruct"]["set"]) - printf("structure, before:\n...\n%s\n...\n", $domstruct->saveXML($xp->query('/record/description')->item(0))); - - if (is_array($fields)) - { - foreach ($fields as $f) - { - $fok = true; - $ff = $tf = null; - if (!($ff = @$xp->query('/record/description/' . $f['from']))) - { - echo("ERROR : bad xml fieldname '" . $f['from'] . "'\n"); - $error = true; - $fok = false; - } - if ($f['to'] && !($tf = @$xp->query('/record/description/' . $f['to']))) - { - echo("ERROR : bad xml fieldname '" . $f['to'] . "'\n"); - $error = true; - $fok = false; - } - if ($fok) - { - if (in_array($f['from'], $tfields)) - { - if ($f['to']) - { - if ($tf->length == 0) - { - $oldf = $ff->item(0); - $newf = $domstruct->createElement($f['to']); - foreach ($oldf->attributes as $atn => $atv) - { - $newf->setAttribute($atn, $atv->value); - } - $oldf->parentNode->replaceChild($newf, $oldf); - } - else - { - echo("WARNING : field '" . $f['to'] . "' exists into structure, will be replace by '" . $f['from'] . "\n"); - foreach ($tf as $n) - $n->parentNode->removeChild($n); - } - } - else - { - foreach ($ff as $n) - $n->parentNode->removeChild($n); - } - } - else - { - echo("WARNING : unknown field '" . $f['from'] . "' in structure\n"); - } - } - } - } - if ($argt["--showstruct"]["set"]) - printf("structure, after:\n...\n%s\n...\n", $domstruct->saveXML($xp->query('/record/description')->item(0))); - } - else - { - echo("ERROR : sql reading structure\n"); - $error = true; - } - } - catch (Excpetion $e) - { - echo("ERROR accessing database\n"); - $error = true; - } - } - else - { - echo("ERROR : unknown sbas_id " . $sbas_id . "\n"); - $error = true; - } -} -else -{ - if ($argt["--help"]["set"]) - { - print("BASES :\n"); - foreach ($allbas as $bas) - printf("%5d : %s @ %s:%s\n", $bas["sbas_id"], $bas["dbname"], $bas["host"], $bas["port"]); - } -} - - -if ($error || $argt["--showstruct"]["set"]) -{ - flush(); - die(); -} - - -if (!$argt['--field']['set']) -{ - print("ERROR : missing option 'field'\n"); - $error = true; -} - - - - -if ($domstruct instanceof DOMDocument) -{ - $databox->saveStructure($domstruct); -} - -$dom = new DOMDocument(); -$dom->formatOutput = true; -$dom->preserveWhiteSpace = false; - -$recChanged = 0; - -$sql = 'SELECT record_id, xml FROM record ORDER BY record_id DESC'; -$connbas = $databox->get_connection(); - -$stmt = $connbas->prepare($sql); -$stmt->execute(); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -foreach ($rs as $row) -{ - printf("%d \r", $row['record_id']); - - if ($dom->loadXML($row['xml'])) - { - $oldxml = $dom->saveXML(); - - $xp = new DOMXPath($dom); - foreach ($fields as $f) - { - if (($tn = @$xp->query('/record/description/' . $f['from']))) - { - foreach ($tn as $oldn) - { - if ($f['to']) - { - $newn = $dom->createElement($f['to']); - foreach ($oldn->childNodes as $n) - $newn->appendChild($n); - $oldn->parentNode->replaceChild($newn, $oldn); - } - else - { - $oldn->parentNode->removeChild($oldn); - } - } - } - } - - $newxml = $dom->saveXML(); - - if ($newxml != $oldxml) - { - // printf("apres :\n%s\n", $dom->saveXML()); - - $sql = 'UPDATE record SET xml=:xml, moddate=NOW() - WHERE record_id = :record_id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':xml' => $newxml, ':record_id' => $row['record_id'])); - $stmt->closeCursor(); - $recChanged++; - } - } - else - { - printf("ERR (rid=%s) : bad xml \n", $row['record_id']); - } -} - -if ($recChanged > 0) - printf("%s record(s) changed, please reindex database\n", $recChanged); -else - printf("no record(s) changed\n"); - diff --git a/bin/console b/bin/console index 8a5fce126e..3aec5dd5b8 100755 --- a/bin/console +++ b/bin/console @@ -10,7 +10,7 @@ */ /** - * + * * @package * @package KonsoleKomander * @license http://opensource.org/licenses/gpl-3.0 GPLv3 @@ -23,46 +23,69 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Application; -require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; +$Core = require_once dirname(__FILE__) . '/../lib/bootstrap.php'; + +$result_code = 1; try { - bootstrap::register_autoloads(); + \bootstrap::register_autoloads(); $app = new Application(" - _____ _ _ _____ _____ ______ _ _ ______ _______ + _____ _ _ _____ _____ ______ _ _ ______ _______ | __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __| - | |__) | |__| | |__) | / \ | (___ | |__ / \ | \| | |__ | | - | ___/| __ | _ / / /\ \ \___ \| __| / /\ \ | . ` | __| | | - | | | | | | | \ \ / ____ \ ____) | |____ / ____ \| |\ | |____ | | - |_| |_| |_|_| \_|_/ \_\_____/|______/_/ \_\_| \_|______| |_| - _ __ _ _ __ _ - | |/ /___ _ _ ___ ___| |___ | |/ /___ _ __ _ __ __ _ _ _ __| |___ _ _ + | |__) | |__| | |__) | / \ | (___ | |__ / \ | \| | |__ | | + | ___/| __ | _ / / /\ \ \___ \| __| / /\ \ | . ` | __| | | + | | | | | | | \ \ / ____ \ ____) | |____ / ____ \| |\ | |____ | | + |_| |_| |_|_| \_|_/ \_\_____/|______/_/ \_\_| \_|______| |_| + _ __ _ _ __ _ + | |/ /___ _ _ ___ ___| |___ | |/ /___ _ __ _ __ __ _ _ _ __| |___ _ _ | ' add(new module_console_aboutAuthors('about:authors')); $app->add(new module_console_aboutLicense('about:license')); + + $app->add(new module_console_checkExtension('check:extension')); + $app->add(new module_console_systemUpgrade('system:upgrade')); + + $app->add(new module_console_sphinxGenerateSuggestion('sphinx:generate-suggestions')); + $app->add(new module_console_systemMailCheck('system:mailCheck')); - $app->add(new module_console_systemConfigCheck('system:configCheck')); $app->add(new module_console_systemBackupDB('system:backupDB')); $app->add(new module_console_systemClearCache('system:clearCache')); $app->add(new module_console_systemTemplateGenerator('system:templateGenerator')); + $app->add(new module_console_systemExport('system:export')); + $app->add(new module_console_taskrun('task:run')); $app->add(new module_console_tasklist('task:list')); $app->add(new module_console_schedulerState('scheduler:state')); $app->add(new module_console_schedulerStop('scheduler:stop')); $app->add(new module_console_schedulerStart('scheduler:start')); - $app->run(); + $app->add(new module_console_fileEnsureProductionSetting('check:ensureProductionSettings')); + $app->add(new module_console_fileEnsureDevSetting('check:ensureDevSettings')); + $app->add(new module_console_systemConfigCheck('check:system')); + + + $app->add(new module_console_fieldsList('fields:list')); + $app->add(new module_console_fieldsDelete('fields:delete')); + $app->add(new module_console_fieldsRename('fields:rename')); + $app->add(new module_console_fieldsMerge('fields:merge')); + + + $result_code = $app->run(); } catch (Exception $e) { - echo "an error occured"; + echo "an error occured";var_dump($e->getMessage()); } + +exit($result_code); diff --git a/bin/doctrine b/bin/doctrine new file mode 100755 index 0000000000..e595ff2e0d --- /dev/null +++ b/bin/doctrine @@ -0,0 +1,90 @@ +#!/usr/bin/env php +getOrm(); + $confService = $configuration->getService($serviceName); + + if ($confService->get("type") !== 'Orm\\Doctrine') + { + exit(sprintf("Doctrine is not declared as your ORM but %s is", $confService->get("type"))); + } + + $ormService = \Alchemy\Phrasea\Core\Service\Builder::create( + $Core + , $serviceName + , $confService + ); + + $em = $ormService->getDriver(); + /* @var $em \Doctrine\ORM\EntityManager */ + + $app = new Application("Phraseanet Doctrine Console"); + + $helpers = array( + 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), + 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) + ); + + $helperSet = $app->getHelperSet(); + foreach ($helpers as $name => $helper) + { + $helperSet->set($helper, $name); + } + + $app->addCommands(array( + // DBAL Commands + new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), + new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), + // ORM Commands + new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), + new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), + new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), + new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), + new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), + new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), + new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), + new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), + new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), + new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), + new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), + new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), + new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), + new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(), + )); + + $app->run(); +} +catch (Exception $e) +{ + echo "an error occured : " . $e->getMessage(); +} diff --git a/bin/dumpbase.exe.php b/bin/dumpbase.exe.php deleted file mode 100644 index a7dad8487f..0000000000 --- a/bin/dumpbase.exe.php +++ /dev/null @@ -1,290 +0,0 @@ - array('field_out' => 'Titre') - , 'Categories' => array('field_out' => 'Categories') - , 'MotsCles' => array('field_out' => 'MotsCles') - , 'Date' => array('field_out' => 'Date') - , 'Photographe' => array('field_out' => 'Photographe') - , 'Ville' => array('field_out' => 'Ville') - , 'Pays' => array('field_out' => 'Pays') - , 'Reference' => array('field_out' => 'Reference') - , 'Credit' => array('field_out' => 'Credit') - , 'Legende' => array('field_out' => 'Legende') -); - -$status = array( - '4' => '4' - , '5' => '5' -); - - -$registry = registry::get_instance(); -require($registry->get('GV_RootPath') . "lib/classes/deprecated/getargs.php"); // le parser d'arguments de la ligne de commande - -function printHelp(&$argt, &$conn) -{ - print_usage($argt); -} - -$argt = array( - "--help" => array("set" => false, "values" => array(), "usage" => " : cette aide") - , "--sbas-id" => array("set" => false, "values" => array(), "usage" => "=sbas_id : sbas_id de la base a ventiler") - , "--coll-id" => array("set" => false, "values" => array(), "usage" => "=coll_id : coll_id a ventiler") - , "--out" => array("set" => false, "values" => array(), "usage" => "=path : repertoire d'export") - , "--limit" => array("set" => false, "values" => array(), "usage" => "=n : nombre max de records a exporter (pour test)") -); - - - -$allbas = array(); - -$conn = connection::getPDOConnection(); - -$sql = "SELECT * FROM sbas"; -$stmt = $conn->prepare($sql); -$stmt->execute(); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -foreach ($rs as $tmprow) -{ - $allbas["B" . $tmprow["sbas_id"]] = $tmprow; -} - -$error = false; - -if (!parse_cmdargs($argt, $err) || $argt["--help"]["set"]) -{ - print($err); - $error = true; -} - -if (!$argt["--sbas-id"]["set"]) -{ - print("parametre 'sbas-id' obligatoire.\n"); - $error = true; -} - -if (!$argt["--out"]["set"]) -{ - print("parametre 'out' obligatoire.\n"); - $error = true; -} - -if ($error) -{ - print_usage($argt); - print("BASES :\n"); - foreach ($allbas as $bas) - printf("%5d : %s @ %s:%s\n", $bas["sbas_id"], $bas["dbname"], $bas["host"], $bas["port"]); - flush(); - die(); -} - - - - -$root = p4string::addEndSlash($argt["--out"]["values"][0]); -if (!is_dir($root)) -{ - print("repertoire out '" . $root . "' absent.\nABANDON\n"); - die(); -} - - -if ($argt["--limit"]["set"]) -{ - $limit = (int) ($argt["--limit"]["values"][0]); -} -else -{ - $limit = NULL; -} - - - -$sbas_id = $argt["--sbas-id"]["values"][0]; -// sauf erreur, on a l'adresse du serveur distant - -$row = null; -if (array_key_exists("B" . $sbas_id, $allbas)) - $row = $allbas["B" . $sbas_id]; -if ($row) -{ - try - { - $connbas = connection::getPDOConnection($sbas_id); - } - catch (Exception $e) - { - echo("\n\nerreur d'acces a la base\n\nABANDON ! :(\n\n"); - flush(); - die(); - } -} - -echo("Connexion a la base ok\n\n"); - - -$root .= $row["dbname"]; -@mkdir($root); - - - -$ndig = ceil(log10(DOCPERDIR - 1)); -define('DIRFMT1', '%0' . (8 - $ndig) . 'd'); -define('DIRFMT2', '%0' . $ndig . 'd'); - - - -$sql = 'SELECT xml, path, file, record.record_id - FROM record - INNER JOIN subdef - ON subdef.record_id=record.record_id AND subdef.name="document"'; - -$params = array(); - -if ($argt["--coll-id"]["set"]) -{ - $sql .= ' WHERE coll_id = :coll_id'; - $params[':coll_id'] = (int) ($argt["--coll-id"]["values"][0]); -} - -$sql .= ' ORDER BY record.record_id ASC'; - -if ($limit !== NULL) - $sql .= ' LIMIT ' . (int) $limit; - -$stmt = $connbas->prepare($sql); -$stmt->execute($params); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -$idir = -1; -$idoc = DOCPERDIR - 1; -$nrec = count($rs); - -foreach ($rs as $row) -{ - printf("%d \r", --$nrec); - - if (($sxml = simplexml_load_string($row['xml']))) - { - if (($orgdocname = (string) ($sxml->doc['originalname'])) != '') - { - if (file_exists($phfile = p4string::addEndSlash($row['path']) . $row['file'])) - { - if (++$idoc == DOCPERDIR) - { - $idir++; - $dir1name = sprintf(DIRFMT1, $idir); - @mkdir($root . '/' . $dir1name); - $idoc = 0; - } - - // $dir2name = sprintf(DIRFMT2, $idoc); - $dir2name = sprintf('rid_%08d', $row['record_id']); - @mkdir($outdir = ($root . '/' . $dir1name . '/' . $dir2name)); - - // print($phfile . "\n"); - if (copy($phfile, $outdir . '/' . $orgdocname)) - { - - // file_put_contents($outdir . '/' . $orgdocname . '-old.xml', $row['xml']); - - foreach ($tfields as $fname => $field) - $tfields[$fname]['values'] = array(); - - foreach ($sxml->description->children() as $fname => $fvalue) - { - // printf("%s : %s\n", $fname, $fvalue); - if (isset($tfields[$fname])) - $tfields[$fname]['values'][] = $fvalue; - } - - $domout = new DOMDocument('1.0', 'UTF-8'); - $domout->standalone = true; - $domout->preserveWhiteSpace = false; - - $element = $domout->createElement('record'); - - $domrec = $domout->appendChild($element); - $domdesc = $domrec->appendChild($domout->createElement('description')); - foreach ($tfields as $kfield => $field) - { - foreach ($field['values'] as $value) - { - $domfield = $domdesc->appendChild($domout->createElement($field['field_out'])); - $domfield->appendChild($domout->createTextNode($value)); - } - } - - $sqlS = 'SELECT bin(status) as statin FROM record - WHERE record_id = :record_id"' . $row['record_id'] . '"'; - $stmt = $connbas->prepare($sqlS); - $stmt->execute(array(':record_id' => $row['record_id'])); - $statin = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - $statin = $statin ? strrev($statin['statin']) : false; - - $statout = '0000000000000000000000000000000000000000000000000000000000001111'; - if ($statin) - { - foreach ($status as $sIn => $sOut) - { - if (substr($statin, $sIn, 1) == '1') - { - $statout = substr_replace($statout, '1', (63 - (int) $sOut), 1); - } - } - } - - $domstatus = $domrec->appendChild($domout->createElement('status')); - $domstatus->appendChild($domout->createTextNode($statout)); - - - $domout->save($outdir . '/' . $orgdocname . '.xml'); - unset($domout); - } - else - { - printf("\nERR (rid=%s) : erreur de copie du document '%s'\n", $row['record_id'], $phfile); - } - } - else - { - printf("\nERR (rid=%s) : document '%s' manquant\n", $row['record_id'], $phfile); - } - } - else - { - printf("\nERR (rid=%s) : orgdocname manquant\n", $row['record_id']); - } - } - else - { - printf("\nERR (rid=%s) : xml illisible manquant\n", $row['record_id']); - } -} - diff --git a/bin/suggest_cron.php b/bin/suggest_cron.php deleted file mode 100644 index 06891067e4..0000000000 --- a/bin/suggest_cron.php +++ /dev/null @@ -1,104 +0,0 @@ - 0 ); -} - -/// build a list of trigrams for a given keywords -function BuildTrigrams($keyword) -{ - $t = "__" . $keyword . "__"; - - $trigrams = ""; - for ($i = 0; $i < strlen($t) - 2; $i++) - $trigrams .= substr($t, $i, 3) . " "; - - return $trigrams; -} - -function BuildDictionarySQL($in) -{ - $out = ''; - - - $n = 0; - $lines = explode("\n", $in); - foreach ($lines as $line) - { - if (trim($line) === '') - continue; - list ( $keyword, $freq ) = split(" ", trim($line)); - - if ($freq < FREQ_THRESHOLD || strstr($keyword, "_") !== false || strstr($keyword, "'") !== false) - continue; - - if (test_number($keyword)) - { - echo "dismiss number keyword : $keyword\n"; - continue; - } - if (mb_strlen($keyword) < 3) - { - echo "dismiss too short keyword : $keyword \n"; - continue; - } - - $trigrams = BuildTrigrams($keyword); - - if ($n++) - $out .= ",\n"; - $out .= "( $n, '$keyword', '$trigrams', $freq )"; - } - - if (trim($out) !== '') - { - $out = "INSERT INTO suggest VALUES " . $out . ";"; - } - - return $out; -} - -$params = phrasea::sbas_params(); - -foreach ($params as $sbas_id => $p) -{ - $index = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $p['host'], $p['port'], $p['user'], $p['dbname']))); - $tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt'; - - echo "process $index " . $sbas_id . " \n"; - - $cmd = '/usr/local/bin/indexer metadatas' . $index . ' --buildstops ' . $tmp_file . ' 1000000 --buildfreqs'; - exec($cmd); - - try - { - $connbas = connection::getPDOConnection($sbas_id); - } - catch (Exception $e) - { - continue; - } - $sql = 'TRUNCATE suggest'; - $stmt = $connbas->prepare($sql); - $stmt->execute(); - $stmt->closeCursor(); - - $sql = BuildDictionarySQL(file_get_contents($tmp_file)); - - if (trim($sql) !== '') - { - $stmt = $connbas->prepare($sql); - $stmt->execute(); - $stmt->closeCursor(); - } - unlink($tmp_file); -} diff --git a/bin/testextension2.php b/bin/testextension2.php deleted file mode 100644 index 5d4f824dbf..0000000000 --- a/bin/testextension2.php +++ /dev/null @@ -1,493 +0,0 @@ -get_parms("qry"); -if (!$parm['qry']) - $parm['qry'] = 'last'; -?> - - - Test extension - - - - ...recherche... - -Fonction de la DLL : "); -$result = ""; -$allfunc = get_extension_funcs("phrasea2"); -foreach ($allfunc as $oneFunc) - $result.= $oneFunc . "\n"; -print("
"); - - -$sessid = null; - -function showtime() -{ - static $last_t = false; - $t = microtime(true); - if ($last_t !== false) - printf("Durée : %0.5f", $t - $last_t); - $last_t = $t; -} - -/* - // ------------------ phrasea_testutf8 -------------------- - - $code = '$ret = phrasea_testutf8();' ; - - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - die(); - */ - -showtime(); - - -// ------------------ phrasea_usebase -------------------- -/* - $code = '$ret = phrasea_usebase("'.GV_db.'");' ; - - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - showtime(); - */ -// ------------------ phrasea_list_bases -------------------- - -/* - // ------------------ phrasea_conn -------------------- - $code = '$ret = phrasea_conn("127.0.0.1", "3306", "root", "", "'.GV_db.'");' ; - - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - showtime(); - */ - - - -//// ------------------ phrasea_list_bases -------------------- -// -//$code = '$lb = phrasea_list_bases();'; -// -//dumpcode($code); -//eval($code); -//dumpvar($lb, '$lb'); -// -//showtime(); - - - -// ------------------ phrasea_open_session -------------------- - -$code = '$sessid = phrasea_create_session(' . USR_ID . ');'; - -dumpcode($code); -eval($code); -print(" il faut que ca renvoie une valeur de session "); -dumpvar($sessid, '$sessid'); - -showtime(); - -// ------------------ phrasea_open_session -------------------- - - - -$code = '$ph_session = phrasea_open_session($sessid, ' . USR_ID . ');'; - -dumpcode($code); -eval($code); -print(" il faut que ca renvoie un tableau session "); -dumpvar($ph_session, '$ph_session'); - -showtime(); - -//die(); - - -if ($ph_session) -{ - $sessid = $ph_session["session_id"]; - - - // ------------------ phrasea_open_session -------------------- - - $code = '$ph_session = phrasea_open_session(' . $sessid . ', ' . USR_ID . ');'; - - dumpcode($code); - eval($code); - print(" il faut que ca renvoie la meme valeur de session "); - dumpvar($ph_session, '$ph_session'); - - showtime(); - // pour interroger plus bas, on doit avoir un usr_id et avoir injecte ses 'mask' (droits dans appbox/xbascollusr) dans les dbox/collusr - // !!!!! pour simplifier, on injecte un usr bidon (id=0) avec des mask '0' (tout voir) !!!!! - // on se register sur 4 collections -// $rmax = 99999; -// $basok = 0; -// foreach ($lb["bases"] as $base) -// { -// if ($base["online"] == true) -// { -// $connbas = connection::getPDOConnection($base['sbas_id']); -// -// foreach ($base["collections"] as $coll_id => $coll) -// { -// if ($rmax-- > 0) -// { -// -// // ------------------ phrasea_register_base -------------------- -// -// -// $code = '$rb = phrasea_register_base(' . $sessid . ', ' . $coll['base_id'] . ', "", "");'; -// -// dumpcode($code); -// eval($code); -// print(" register sur base connue doit retourner 'true' "); -// dumpvar($rb, '$rb'); -// -// if ($rb) -// { -// echo "TRUE (comportement normal)

"; -// -// showtime(); -// -// $sql = "REPLACE INTO collusr (site, usr_id, coll_id, mask_and, mask_xor) -// VALUES (:site, :usr_id, :coll_id, 0, 0)"; -// -// $params = array( -// ':site' => $registry->get('GV_sit') -// , ':usr_id' => USR_ID -// , ':coll_id' => $coll['coll_id'] -// ); -// -// $stmt = $connbas->prepare($sql); -// $stmt->execute($params); -// $stmt->closeCursor(); -// -// $basok++; -// } -// else -// { -// echo "FALSE (comportement anormal)

"; -// -// showtime(); -// } -// } -// } -// } -// } - - - if ($basok == 0) - { - printf("pas de base/coll ok, fin"); - phrasea_close_session($sessid); - die(); - } - - -// // ------------------ phrasea_register_base (fake) -------------------- -// -// $code = '$rb = phrasea_register_base(' . $sessid . ', 123456, "", "");'; -// -// dumpcode($code); -// eval($code); -// print(" register sur xbas bidon connue doit retourner 'false' "); -// dumpvar($rb, '$rb'); -// -// if (!$rb) -// echo "FALSE (comportement normal)

"; -// else -// echo "TRUE (comportement anormal)

"; -// -// showtime(); - - $basok += $rb ? 1 : 0; - - - - - - // ------------------ phrasea_open_session -------------------- - - $code = '$ph_session = phrasea_open_session(' . $sessid . ', ' . USR_ID . ');'; - - dumpcode($code); - eval($code); - print(" phrasea_open_session(...) apres $basok phrasea_register_base(...) doit retourner les bases/collections registered "); - dumpvar($ph_session, '$ph_session'); - - showtime(); - - - // ------------------ phrasea_subdefs -------------------- -// -// $code = '$subdef = phrasea_subdefs(' . $sessid . ', 58, 18863);'; -// -// dumpcode($code); -// eval($code); -// dumpvar($subdef, '$subdef'); -// -// showtime(); - - - - // ------------------ phrasea_clear_cache -------------------- - - $code = '$ret = phrasea_clear_cache(' . $sessid . ');'; - - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - showtime(); -?> - -
-
- recherche : - -
- 0) // au - une coll de la base etait dispo - { - $kbase = "S" . $phbase["xbas_id"]; - $tbases[$kbase] = array(); - $tbases[$kbase]["xbas_id"] = $phbase["xbas_id"]; - $tbases[$kbase]["searchcoll"] = $tcoll; - - $qp = new searchEngine_adapter_phrasea_queryParser(); - $treeq = $qp->parsequery($parm['qry']); - $arrayq = $qp->makequery($treeq); - - $tbases[$kbase]["arrayq"] = $arrayq; - } - } - */ - - $tbases = array(); - foreach ($ph_session["bases"] as $kphbase => $phbase) - { - $tcoll = array(); - foreach ($phbase["collections"] as $coll) - { - $tcoll[] = 0 + $coll["base_id"]; // le tableau de colls doit contenir des int - } - if (sizeof($tcoll) > 0) // au - une coll de la base etait cochee - { - $kbase = "S" . $phbase["sbas_id"]; - $tbases[$kbase] = array(); - $tbases[$kbase]["sbas_id"] = $phbase["sbas_id"]; - $tbases[$kbase]["searchcoll"] = $tcoll; - $tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0; - - $qp = new searchEngine_adapter_phrasea_queryParser(); - $treeq = $qp->parsequery($parm['qry']); - $arrayq = $qp->makequery($treeq); - - $tbases[$kbase]["arrayq"] = $arrayq; - } - } - - - - // ------------------ phrasea_query2 -------------------- - /* - $nbanswers = 0; - foreach($tbases as $kb=>$base) - { - $tbases[$kb]["results"] = NULL; - - set_time_limit(120); - //$tbases[$kb]["results"] = phrasea_query2($ph_session["session_id"], $base["base_id"], $base["searchcoll"], $base["arrayq"], GV_sit, USR_ID, TRUE); - $tbases[$kb]["results"] = phrasea_query2($ph_session["session_id"], $base["base_id"], $base["searchcoll"], $base["arrayq"], GV_sit, (string)(USR_ID) , TRUE , (0) ); - - if($tbases[$kb]["results"]) - { - $nbanswers += $tbases[$kb]["results"]["nbanswers"]; - - $result .= var_export($tbases[$kb]["results"],true); - } - } - - var_dump($result); - */ - $nbanswers = 0; - foreach ($tbases as $kb => $base) - { - $ret = null; - $tbases[$kb]["results"] = NULL; - - set_time_limit(120); - - $code = "\$ret = phrasea_query2(\n"; - $code .= "\t\t\t" . $ph_session["session_id"] . "\t\t// ses_id \n"; - $code .= "\t\t\t, " . $base["sbas_id"] . "\t\t// bsas_id \n"; - $code .= "\t\t\t, " . my_var_export($base["searchcoll"]) . "\t\t// coll_id's \n"; - $code .= "\t\t\t, " . my_var_export($base["arrayq"]) . "\t\t// arrayq \n"; - $code .= "\t\t\t, '" . $registry->get('GV_sit') . "'\t\t// site \n"; - $code .= "\t\t\t, " . USR_ID . " \t\t// usr_id ! \n"; - $code .= "\t\t\t, FALSE \t\t// nocache \n"; - $code .= "\t\t\t, PHRASEA_MULTIDOC_DOCONLY\n"; -// $code .= "\t\t\t, PHRASEA_MULTIDOC_REGONLY\n" ; -// $code .= "\t\t\t, array('DATE') \t\t// sort fields \n" ; - $code .= "\t\t);"; -// $code .= '$base["arrayq"], "'.GV_sit.'", '.USR_ID.', FALSE, PHRASEA_MULTIDOC_DOCONLY, array("DATE")); // USR_ID=0...' ; - - dumpcode($code); - eval($code); - print("
si les bases ne sont pas vides on devrait obtenir le nb de resultats en face de \"nbanswers\""); - dumpvar($ret, '$ret'); - - showtime(); - - - // $tbases[$kb]["results"] = phrasea_query2($ph_session["session_id"], $base["xbas_id"], $base["searchcoll"], $base["arrayq"], GV_sit, USR_ID, FALSE, PHRASEA_MULTIDOC_DOCONLY, array('DATE')); // USR_ID=0... - - if ($ret) - { - $tbases[$kb]["results"] = $ret; - - $nbanswers += $tbases[$kb]["results"]["nbanswers"]; - } - } - /* - */ - if (function_exists('phrasea_save_cache')) - { - // ------------------ phrasea_save_cache -------------------- - - $code = '$ret = phrasea_save_cache(' . $ph_session["session_id"] . ');'; - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - showtime(); - } - - -// die(); - // ------------------ phrasea_fetch_results -------------------- - - $code = '$rs = phrasea_fetch_results(' . $ph_session["session_id"] . ', 1, 20, true, \'[[em]]\', \'[[/em]]\');'; - - dumpcode($code); - eval($code); - dumpvar($rs, '$rs'); - - showtime(); - - - - - // ------------------ phrasea_close_session -------------------- - /* - $code = '$ret = phrasea_close_session('.$ph_session["session_id"].');' ; - - dumpcode($code); - eval($code); - dumpvar($ret, '$ret'); - - showtime(); - */ - } - - function dumpcode($code) - { - print("\n" . '
'); - $h = highlight_string('', true); - $h = str_replace('<?php', '', $h); - $h = str_replace('?>', '', $h); - print($h); - print('
' . "\n"); - } - - function dumpvar($var, $varname) - { - print("\n" . '
'); - $h = highlight_string('', true); - $h = str_replace('<?php', '', $h); - $h = str_replace('?>', '', $h); - print('' . $varname . ' is : ' . $h); - print('
' . "\n"); - } - - function my_var_export($var) - { - $var = str_replace("\n", "", var_export($var, true)); - $var = str_replace(" ", " ", $var); - $var = str_replace(" ", " ", $var); - $var = str_replace(" ", " ", $var); - $var = str_replace(" ", " ", $var); - $var = str_replace(" => ", "=>", $var); - $var = str_replace("array ( ", "array(", $var); - $var = str_replace(", )", ",)", $var); - $var = str_replace(",)", ")", $var); - - return($var); - } -?> - - - - diff --git a/builder.php b/builder.php index 59af12c52d..f0485f1824 100755 --- a/builder.php +++ b/builder.php @@ -2,68 +2,103 @@ files() + ->name('.gitmodules') + ->name('.gitignore') + ->name('check_cs.php') + ->name('cleaner.php') + ->name('launchpadToLocales.php') + ->name('localesToLaunchPad.php') + ->name('pom.xml') + ->name('vendors.php') + ->name('builder.php') + ->ignoreDotFiles(false) + ->ignoreVCS(false) + ->in(__DIR__); + +$files = array(); + +foreach ($finder as $file) +{ + $files[] = $file->getPathname(); +} + +foreach ($files as $file) +{ + echo "rm $file\n"; + unlink($file); +} + +$finder = new Finder(); + $finder ->directories() ->name('test') ->name('tests') - ->name('unitTests') + ->name('unitTest') ->name('demos') ->name('demo') ->name('example') ->name('examples') + ->name('docs') + ->name('documentation') + ->name('doc') + ->name('as-docs') + ->name('hudson') ->name('.svn') ->name('.git') - ->in( - array( - __DIR__ . '/lib', - __DIR__ . '/bin', - __DIR__ . '/config', - __DIR__ . '/www', - __DIR__ . '/templates' - ) - ) - ->exclude('vendor') -; + ->name('flash') + ->ignoreDotFiles(false) + ->ignoreVCS(false) + ->in(__DIR__); + + +$dirs = array(); foreach ($finder as $dir) { - $cmd = sprintf('rm -Rf %s' . PHP_EOL, escapeshellarg($dir->getPathname())); - - if ($fix) - system($cmd); - else - printf($cmd); + $dirs[] = $dir->getPathname(); } -$root_files = array('hudson', 'check_cs.php', 'pom.xml', 'vendors.php', 'builder.php'); - - -foreach ($root_files as $file) +foreach ($dirs as $dir) { - $cmd = sprintf('rm -Rf %s/%s' . PHP_EOL, __DIR__, escapeshellarg($file)); + if (!is_dir($dir)) + { + continue; + } - if ($fix) - system($cmd); - else - printf($cmd); + $cmd = sprintf('rm -Rf %s' . PHP_EOL, escapeshellarg($dir)); + + printf($cmd); + system($cmd); } exit(0); diff --git a/check_cs.php b/check_cs.php index 7c6e364a35..aa00030648 100755 --- a/check_cs.php +++ b/check_cs.php @@ -14,10 +14,12 @@ * */ -require_once __DIR__ . '/lib/bootstrap.php'; +require_once __DIR__ . '/lib/Alchemy/Phrasea/Core.php'; use Symfony\Component\Finder\Finder; +\Alchemy\Phrasea\Core::initAutoloads(); + $fix = isset($argv[1]) && 'fix' == $argv[1]; $finder = new Finder(); @@ -43,6 +45,7 @@ $finder ->notName(basename(__FILE__)) ->exclude('.git') ->exclude('vendor') + ->exclude('Doctrine/Proxies') ; $count = 0; diff --git a/cleaner.php b/cleaner.php new file mode 100755 index 0000000000..c8116865fb --- /dev/null +++ b/cleaner.php @@ -0,0 +1,66 @@ +#!/usr/bin/env php +files() + ->name('*.gif') + ->name('*.jpeg') + ->name('*.jpg') + ->name('*.png') + ->notName('ui-*.png') + ->exclude( + array( + 'substitution' + , 'client/959595/images' + , 'client/000000/images' + , 'client/FFFFFF/images' + , 'skins/lng' + ) + ) + ->in(__DIR__ . '/www/skins'); + +$files = array(); + +foreach ($finder as $file) +{ + $result = ''; + + foreach (array('templates', 'lib/Alchemy', 'lib/Doctrine', 'lib/classes', 'www') as $dir) + { + $cmd = "grep -IR -m 1 --exclude='(*\.git*)' '" . str_replace(array(), array(), $file->getFilename()) . "' " . __DIR__.'/'.$dir; + $result .= @exec($cmd); + + if (trim($result) !== '') + { + break; + } + } + + if (trim($result) === '') + { + $files[] = $file->getPathname(); + } +} + +foreach ($files as $file) +{ + echo "rm $file\n"; + unlink($file); +} + +exit(0); diff --git a/config/config.sample.inc b/config/config.sample.inc deleted file mode 100644 index 7ece416ed5..0000000000 --- a/config/config.sample.inc +++ /dev/null @@ -1,5 +0,0 @@ - + port: + user: + password: + dbname: + driver: pdo_mysql + charset: UTF8 + +#Define a connexion to a SQLite database named test_connexion +test_connexion: + driver: pdo_sqlite + path: /PATH/TO/SQLITE/DATABASE + charset: UTF8 diff --git a/config/nginx.rewrite.rules b/config/nginx.rewrite.rules index 45110b110b..eaa5c0a6c8 100644 --- a/config/nginx.rewrite.rules +++ b/config/nginx.rewrite.rules @@ -6,18 +6,39 @@ rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?ty rewrite ^/register-confirm=([a-zA-Z0-9]+)$ /login/register-confirm.php?code=$1 last; +rewrite ^/admin/$ /admin/router.php last; rewrite ^/admin/users/.*$ /admin/router.php last; rewrite ^/admin/tests/.*$ /admin/router.php last; rewrite ^/admin/fields/.*$ /admin/router.php last; +rewrite ^/admin/description/.*$ /admin/router.php last; +rewrite ^/admin/subdefs/.*$ /admin/router.php last; rewrite ^/admin/publications/.*$ /admin/router.php last; rewrite ^/admin/typeahead/.*$ /admin/router.php last; rewrite ^/prod/records/edit/.*$ /prod/router.php last; rewrite ^/prod/records/movecollection/.*$ /prod/router.php last; +rewrite ^/prod/records/delete/.*$ /prod/router.php last; +rewrite ^/prod/order/.*$ /prod/router.php last; rewrite ^/prod/bridge/.*$ /prod/router.php last; +rewrite ^/prod/lists/.*$ /prod/router.php last; +rewrite ^/prod/MustacheLoader/.*$ /prod/router.php last; rewrite ^/prod/feeds/.*$ /prod/router.php last; rewrite ^/prod/tooltip/.*$ /prod/router.php last; +rewrite ^/prod/printer/.*$ /prod/router.php last; +rewrite ^/prod/push/.*$ /prod/router.php last; +rewrite ^/prod/baskets/.*$ /prod/router.php last; +rewrite ^/prod/story/.*$ /prod/router.php last; +rewrite ^/prod/WorkZone/.*$ /prod/router.php last; +rewrite ^/prod/language/.*$ /prod/router.php last; +rewrite ^/prod/TOU/.*$ /prod/router.php last; +rewrite ^/prod/UserPreferences/.*$ /prod/router.php last; +rewrite ^/prod/$ /prod/router.php last; + +rewrite ^/prod/query/.*$ /prod/router.php last; +rewrite ^/prod/export/.*$ /prod/router.php last; +rewrite ^/prod/record/preview/.*$ /prod/router.php last; +rewrite ^/prod/notifications/.*$ /prod/router.php last; rewrite ^/robots.txt$ /index.php last; rewrite ^/feeds/.*$ /index.php last; diff --git a/config/services.sample.yml b/config/services.sample.yml new file mode 100644 index 0000000000..ad315a3f3c --- /dev/null +++ b/config/services.sample.yml @@ -0,0 +1,143 @@ + +Orm: + #Doctrine developement service options + #Service name + doctrine_dev: + type: Orm\Doctrine + options: + #Set automatically propers values for debug + #Query & result caches are setted to Array cache + #Auto-generating Proxy Classes is setted to false + debug: true + #Assign a connexion from connexions.yml to the DataBase Abstraction Layer + dbal: main_connexion + #Available cache driver [memcached, apc, array] + #Query cache : is used to cache the transformation of a DQL query to its SQL counterpart + #Result cache : is used to cache the results of your queries + #Metadata cache : is used to cache entity class metadatas + #If No cache is provided all cache are setted to default_cache which is an array cache type + cache: + query: + service: Cache\array_cache + result: + service: Cache\array_cache + metadata: + service: Cache\array_cache + # Assign a service to log doctrine queries + log: + service: Log\query_logger + + # Doctrine test service options + doctrine_test: + type: Orm\Doctrine + options: + debug: true + #Doctrine use a different connection configuration base to run tests + dbal: test_connexion + cache: + query: + service: Cache\array_cache + result: + service: Cache\array_cache + metadata: + service: Cache\array_cache + log: + service: Log\query_logger + + # Doctrine production service options + doctrine_prod: + type: Orm\Doctrine + options: + debug: false + dbal: main_connexion + cache: + query: + service: Cache\array_cache + result: + service: Cache\array_cache + metadata: + service: Cache\array_cache + +TemplateEngine: + #Define a template engine service + #Only Twig is avalaible as a template engine service + #see http://twig.sensiolabs.org/ + + #Define the service name first + twig: + #Template engine type + type: TemplateEngine\Twig + options: + #When set to true, the generated templates have a __toString() method that you can use to display the generated nodes + debug: false + #The charset used by the templates + charset: utf-8 + #Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) + #And replace them with a null value. When set to true, Twig throws an exception instead (default to false) + strict_variables: false + autoescape: true + #Optimize the node tree before compilation + optimizer: true + + twig_debug: + type: TemplateEngine\Twig + options: + debug: true + charset: utf-8 + strict_variables: true + autoescape: true + optimizer: true + + +Log: + # Define a Log service + # This one is defined to handle the logs of doctrine queries + # Only Monolog is available as a logger service + # Please Notice that for doctrine ONLY a echo logger service is available, see below + # Monolog logger use the PHP Monolog library to handle logs using differents handlers + query_logger: + type: Log\Doctrine\Monolog + options: + #You can precise the output format + #This option is only available when log are used to log doctrine queries + #Available output [vdump, json, yaml] + # vdump : output logs in a var_dump formatted style + # json : output logs in json + # yml : output logs yml + output: json + #Name used for the Monolog channel + channel: query-logger + #Define how the logs will be handled + #Avalaibale Handler are [rotate, stream] + #Rotate handler is used to stores logs to files that are rotated every day + #And a limited number of files are kept by defining the max_day value + #Stream handler is used to stores logs in a single local file + handler: rotate + max_day: 2 + #Name of the file where logs are written + filename: doctrine-query.log + + # Define a phpecho log service for Doctrine + # phpecho logger logs doctrine queries to the standard output using echo/var_dump + # Notice that phpecho logger do not have options + sql_logger: + type: Log\Doctrine\Phpecho + +Cache: + #Define cache services + #There are Four deffirent cache type available [array, xcache, apc, memcache] + #Only a memcache service can take option to define port & host for the memcache server + array_cache: + type: Cache\ArrayCache + + memcache_cache: + type: Cache\MemcacheCache + options: + host: localhost + port: 11211 + + apc_cache: + type: Cache\ApcCache + + xcache_cache: + type: Cache\XcacheCache diff --git a/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as b/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as new file mode 100644 index 0000000000..21704689f2 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as @@ -0,0 +1,92 @@ +package caurina.transitions { + + /** + * Generic, auxiliary functions + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class AuxFunctions { + + /** + * Gets the R (xx0000) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The R value + */ + public static function numberToR(p_num:Number):Number { + // The initial & is meant to crop numbers bigger than 0xffffff + return (p_num & 0xff0000) >> 16; + } + + /** + * Gets the G (00xx00) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The G value + */ + public static function numberToG(p_num:Number):Number { + return (p_num & 0xff00) >> 8; + } + + /** + * Gets the B (0000xx) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The B value + */ + public static function numberToB(p_num:Number):Number { + return (p_num & 0xff); + } + + /** + * Checks whether a string is on an array + * + * @param p_string String String to search for + * @param p_array Array Array to be searched + * @return Boolean Whether the array contains the string or not + */ + public static function isInArray(p_string:String, p_array:Array):Boolean { + var l:uint = p_array.length; + for (var i:uint = 0; i < l; i++) { + if (p_array[i] == p_string) return true; + } + return false; + } + + /** + * Returns the number of properties an object has + * + * @param p_object Object Target object with a number of properties + * @return Number Number of total properties the object has + */ + public static function getObjectLength(p_object:Object):uint { + var totalProperties:uint = 0; + for (var pName:String in p_object) totalProperties ++; + return totalProperties; + } + + /* Takes a variable number of objects as parameters and "adds" their properties, from left to right. If a latter object defines a property as null, it will be removed from the final object + * @param args Object(s) A variable number of objects + * @return Object An object with the sum of all paremeters added as properties. + */ + public static function concatObjects(...args) : Object{ + var finalObject : Object = {}; + var currentObject : Object; + for (var i : int = 0; i < args.length; i++){ + currentObject = args[i]; + for (var prop : String in currentObject){ + if (currentObject[prop] == null){ + // delete in case is null + delete finalObject[prop]; + }else{ + finalObject[prop] = currentObject[prop]; + } + } + } + return finalObject; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/Equations.as b/flash/ImageDisplayx1/caurina/transitions/Equations.as new file mode 100644 index 0000000000..d9893c4940 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/Equations.as @@ -0,0 +1,714 @@ +/** + * Equations + * Main equations for the Tweener class + * + * @author Zeh Fernando, Nate Chatellier + * @version 1.0.2 + */ + +/* +Disclaimer for Robert Penner's Easing Equations license: + +TERMS OF USE - EASING EQUATIONS + +Open source under the BSD License. + +Copyright © 2001 Robert Penner +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package caurina.transitions { + + public class Equations { + + /** + * There's no constructor. + * @private + */ + public function Equations () { + trace ("Equations is a static class and should not be instantiated.") + } + + /** + * Registers all the equations to the Tweener class, so they can be found by the direct string parameters. + * This method doesn't actually have to be used - equations can always be referenced by their full function + * names. But "registering" them make them available as their shorthand string names. + */ + public static function init():void { + Tweener.registerTransition("easenone", easeNone); + Tweener.registerTransition("linear", easeNone); // mx.transitions.easing.None.easeNone + + Tweener.registerTransition("easeinquad", easeInQuad); // mx.transitions.easing.Regular.easeIn + Tweener.registerTransition("easeoutquad", easeOutQuad); // mx.transitions.easing.Regular.easeOut + Tweener.registerTransition("easeinoutquad", easeInOutQuad); // mx.transitions.easing.Regular.easeInOut + Tweener.registerTransition("easeoutinquad", easeOutInQuad); + + Tweener.registerTransition("easeincubic", easeInCubic); + Tweener.registerTransition("easeoutcubic", easeOutCubic); + Tweener.registerTransition("easeinoutcubic", easeInOutCubic); + Tweener.registerTransition("easeoutincubic", easeOutInCubic); + + Tweener.registerTransition("easeinquart", easeInQuart); + Tweener.registerTransition("easeoutquart", easeOutQuart); + Tweener.registerTransition("easeinoutquart", easeInOutQuart); + Tweener.registerTransition("easeoutinquart", easeOutInQuart); + + Tweener.registerTransition("easeinquint", easeInQuint); + Tweener.registerTransition("easeoutquint", easeOutQuint); + Tweener.registerTransition("easeinoutquint", easeInOutQuint); + Tweener.registerTransition("easeoutinquint", easeOutInQuint); + + Tweener.registerTransition("easeinsine", easeInSine); + Tweener.registerTransition("easeoutsine", easeOutSine); + Tweener.registerTransition("easeinoutsine", easeInOutSine); + Tweener.registerTransition("easeoutinsine", easeOutInSine); + + Tweener.registerTransition("easeincirc", easeInCirc); + Tweener.registerTransition("easeoutcirc", easeOutCirc); + Tweener.registerTransition("easeinoutcirc", easeInOutCirc); + Tweener.registerTransition("easeoutincirc", easeOutInCirc); + + Tweener.registerTransition("easeinexpo", easeInExpo); // mx.transitions.easing.Strong.easeIn + Tweener.registerTransition("easeoutexpo", easeOutExpo); // mx.transitions.easing.Strong.easeOut + Tweener.registerTransition("easeinoutexpo", easeInOutExpo); // mx.transitions.easing.Strong.easeInOut + Tweener.registerTransition("easeoutinexpo", easeOutInExpo); + + Tweener.registerTransition("easeinelastic", easeInElastic); // mx.transitions.easing.Elastic.easeIn + Tweener.registerTransition("easeoutelastic", easeOutElastic); // mx.transitions.easing.Elastic.easeOut + Tweener.registerTransition("easeinoutelastic", easeInOutElastic); // mx.transitions.easing.Elastic.easeInOut + Tweener.registerTransition("easeoutinelastic", easeOutInElastic); + + Tweener.registerTransition("easeinback", easeInBack); // mx.transitions.easing.Back.easeIn + Tweener.registerTransition("easeoutback", easeOutBack); // mx.transitions.easing.Back.easeOut + Tweener.registerTransition("easeinoutback", easeInOutBack); // mx.transitions.easing.Back.easeInOut + Tweener.registerTransition("easeoutinback", easeOutInBack); + + Tweener.registerTransition("easeinbounce", easeInBounce); // mx.transitions.easing.Bounce.easeIn + Tweener.registerTransition("easeoutbounce", easeOutBounce); // mx.transitions.easing.Bounce.easeOut + Tweener.registerTransition("easeinoutbounce", easeInOutBounce); // mx.transitions.easing.Bounce.easeInOut + Tweener.registerTransition("easeoutinbounce", easeOutInBounce); + } + + // ================================================================================================================================== + // TWEENING EQUATIONS functions ----------------------------------------------------------------------------------------------------- + // (the original equations are Robert Penner's work as mentioned on the disclaimer) + + /** + * Easing equation function for a simple linear tweening, with no easing. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeNone (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*t/d + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c *(t/=d)*(t-2) + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuad (t*2, b, c/2, d, p_params); + return easeInQuad((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t + b; + } + + /** + * Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*((t=t/d-1)*t*t + 1) + b; + } + + /** + * Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + } + + /** + * Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutCubic (t*2, b, c/2, d, p_params); + return easeInCubic((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t*t + b; + } + + /** + * Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + } + + /** + * Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + } + + /** + * Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuart (t*2, b, c/2, d, p_params); + return easeInQuart((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t*t*t + b; + } + + /** + * Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + } + + /** + * Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + } + + /** + * Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuint (t*2, b, c/2, d, p_params); + return easeInQuint((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c * Math.sin(t/d * (Math.PI/2)) + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutSine (t*2, b, c/2, d, p_params); + return easeInSine((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b - c * 0.001; + } + + /** + * Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return (t==d) ? b+c : c * 1.001 * (-Math.pow(2, -10 * t/d) + 1) + b; + } + + /** + * Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b - c * 0.0005; + return c/2 * 1.0005 * (-Math.pow(2, -10 * --t) + 2) + b; + } + + /** + * Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutExpo (t*2, b, c/2, d, p_params); + return easeInExpo((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutCirc (t*2, b, c/2, d, p_params); + return easeInCirc((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeInElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d)==1) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*.3 : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeOutElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d)==1) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*.3 : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b); + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeInOutElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d/2)==2) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*(.3*1.5) : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeOutInElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutElastic (t*2, b, c/2, d, p_params); + return easeInElastic((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeInBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + return c*(t/=d)*t*((s+1)*t - s) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeOutBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeInOutBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeOutInBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutBack (t*2, b, c/2, d, p_params); + return easeInBack((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c - easeOutBounce (d-t, 0, c, d) + b; + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeInBounce (t*2, 0, c, d) * .5 + b; + else return easeOutBounce (t*2-d, 0, c, d) * .5 + c*.5 + b; + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutBounce (t*2, b, c/2, d, p_params); + return easeInBounce((t*2)-d, b+c/2, c/2, d, p_params); + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as b/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as new file mode 100644 index 0000000000..132aaa5c0e --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as @@ -0,0 +1,90 @@ +package caurina.transitions { + + /** + * PropertyInfoObj + * An object containing the updating info for a given property (its starting value, and its final value) + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class PropertyInfoObj { + + public var valueStart :Number; // Starting value of the tweening (null if not started yet) + public var valueComplete :Number; // Final desired value + public var originalValueComplete :Object; // Final desired value as declared initially + public var arrayIndex :Number; // Index (if this is an array item) + public var extra :Object; // Additional parameters, used by some special properties + public var isSpecialProperty :Boolean; // Whether or not this is a special property instead of a direct one + public var hasModifier :Boolean; // Whether or not it has a modifier function + public var modifierFunction :Function; // Modifier function, if any + public var modifierParameters :Array; // Additional array of modifier parameters + + // ================================================================================================================================== + // CONSTRUCTOR function ------------------------------------------------------------------------------------------------------------- + + /** + * Initializes the basic PropertyInfoObj. + * + * @param p_valueStart Number Starting value of the tweening (null if not started yet) + * @param p_valueComplete Number Final (desired) property value + */ + function PropertyInfoObj(p_valueStart:Number, p_valueComplete:Number, p_originalValueComplete:Object, p_arrayIndex:Number, p_extra:Object, p_isSpecialProperty:Boolean, p_modifierFunction:Function, p_modifierParameters:Array) { + valueStart = p_valueStart; + valueComplete = p_valueComplete; + originalValueComplete = p_originalValueComplete; + arrayIndex = p_arrayIndex; + extra = p_extra; + isSpecialProperty = p_isSpecialProperty; + hasModifier = Boolean(p_modifierFunction); + modifierFunction = p_modifierFunction; + modifierParameters = p_modifierParameters; + } + + + // ================================================================================================================================== + // OTHER functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Clones this property info and returns the new PropertyInfoObj + * + * @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted + * @return TweenListObj A copy of this object + */ + public function clone():PropertyInfoObj { + var nProperty:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters); + return nProperty; + } + + /** + * Returns this object described as a String. + * + * @return String The description of this object. + */ + public function toString():String { + var returnStr:String = "\n[PropertyInfoObj "; + returnStr += "valueStart:" + String(valueStart); + returnStr += ", "; + returnStr += "valueComplete:" + String(valueComplete); + returnStr += ", "; + returnStr += "originalValueComplete:" + String(originalValueComplete); + returnStr += ", "; + returnStr += "arrayIndex:" + String(arrayIndex); + returnStr += ", "; + returnStr += "extra:" + String(extra); + returnStr += ", "; + returnStr += "isSpecialProperty:" + String(isSpecialProperty); + returnStr += ", "; + returnStr += "hasModifier:" + String(hasModifier); + returnStr += ", "; + returnStr += "modifierFunction:" + String(modifierFunction); + returnStr += ", "; + returnStr += "modifierParameters:" + String(modifierParameters); + returnStr += "]\n"; + return returnStr; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as b/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as new file mode 100644 index 0000000000..a261597483 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as @@ -0,0 +1,49 @@ +package caurina.transitions { + + /** + * SpecialProperty + * A kind of a getter/setter for special properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialProperty { + + public var getValue:Function; // (p_obj:Object, p_parameters:Array, p_extra:Object): Number + public var setValue:Function; // (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object): Void + public var parameters:Array; + public var preProcess:Function; // (p_obj:Object, p_parameters:Array, p_originalValueComplete:Object, p_extra:Object): Number + + /** + * Builds a new special property object. + * + * @param p_getFunction Function Reference to the function used to get the special property value + * @param p_setFunction Function Reference to the function used to set the special property value + */ + public function SpecialProperty (p_getFunction:Function, p_setFunction:Function, p_parameters:Array = null, p_preProcessFunction:Function = null) { + getValue = p_getFunction; + setValue = p_setFunction; + parameters = p_parameters; + preProcess = p_preProcessFunction; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialProperty "; + value += "getValue:"+String(getValue); + value += ", "; + value += "setValue:"+String(setValue); + value += ", "; + value += "parameters:"+String(parameters); + value += ", "; + value += "preProcess:"+String(preProcess); + value += "]"; + return value; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as new file mode 100644 index 0000000000..049af18f65 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as @@ -0,0 +1,42 @@ +package caurina.transitions { + + /** + * SpecialPropertyModifier + * A special property which actually acts on other properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialPropertyModifier { + + public var modifyValues:Function; + public var getValue:Function; + + /** + * Builds a new special property modifier object. + * + * @param p_modifyFunction Function Function that returns the modifider parameters. + */ + public function SpecialPropertyModifier (p_modifyFunction:Function, p_getFunction:Function) { + modifyValues = p_modifyFunction; + getValue = p_getFunction; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialPropertyModifier "; + value += "modifyValues:"+String(modifyValues); + value += ", "; + value += "getValue:"+String(getValue); + value += "]"; + return value; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as new file mode 100644 index 0000000000..eeef9033f7 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as @@ -0,0 +1,42 @@ +package caurina.transitions { + + /** + * SpecialPropertySplitter + * A proxy setter for special properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialPropertySplitter { + + public var parameters:Array; + public var splitValues:Function; + + /** + * Builds a new group special property object. + * + * @param p_splitFunction Function Reference to the function used to split a value + */ + public function SpecialPropertySplitter (p_splitFunction:Function, p_parameters:Array) { + splitValues = p_splitFunction; + parameters = p_parameters; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialPropertySplitter "; + value += "splitValues:"+String(splitValues); // .toString(); + value += ", "; + value += "parameters:"+String(parameters); + value += "]"; + return value; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as b/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as new file mode 100644 index 0000000000..77fa1fef39 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as @@ -0,0 +1,236 @@ +package caurina.transitions { + import caurina.transitions.AuxFunctions; + /** + * The tween list object. Stores all of the properties and information that pertain to individual tweens. + * + * @author Nate Chatellier, Zeh Fernando + * @version 1.0.4 + * @private + */ + + public class TweenListObj { + + public var scope :Object; // Object affected by this tweening + public var properties :Object; // List of properties that are tweened (PropertyInfoObj instances) + // .valueStart :Number // Initial value of the property + // .valueComplete :Number // The value the property should have when completed + public var timeStart :Number; // Time when this tweening should start + public var timeComplete :Number; // Time when this tweening should end + public var useFrames :Boolean; // Whether or not to use frames instead of time + public var transition :Function; // Equation to control the transition animation + public var transitionParams :Object; // Additional parameters for the transition + public var onStart :Function; // Function to be executed on the object when the tween starts (once) + public var onUpdate :Function; // Function to be executed on the object when the tween updates (several times) + public var onComplete :Function; // Function to be executed on the object when the tween completes (once) + public var onOverwrite :Function; // Function to be executed on the object when the tween is overwritten + public var onError :Function; // Function to be executed if an error is thrown when tweener exectues a callback (onComplete, onUpdate etc) + public var onStartParams :Array; // Array of parameters to be passed for the event + public var onUpdateParams :Array; // Array of parameters to be passed for the event + public var onCompleteParams :Array; // Array of parameters to be passed for the event + public var onOverwriteParams :Array; // Array of parameters to be passed for the event + public var onStartScope :Object; // Scope in which the event function is ran + public var onUpdateScope :Object; // Scope in which the event function is ran + public var onCompleteScope :Object; // Scope in which the event function is ran + public var onOverwriteScope :Object; // Scope in which the event function is ran + public var onErrorScope :Object; // Scope in which the event function is ran + public var rounded :Boolean; // Use rounded values when updating + public var isPaused :Boolean; // Whether or not this tween is paused + public var timePaused :Number; // Time when this tween was paused + public var isCaller :Boolean; // Whether or not this tween is a "caller" tween + public var count :Number; // Number of times this caller should be called + public var timesCalled :Number; // How many times the caller has already been called ("caller" tweens only) + public var waitFrames :Boolean; // Whether or not this caller should wait at least one frame for each call execution ("caller" tweens only) + public var skipUpdates :Number; // How many updates should be skipped (default = 0; 1 = update-skip-update-skip...) + public var updatesSkipped :Number; // How many updates have already been skipped + public var hasStarted :Boolean; // Whether or not this tween has already started + + // ================================================================================================================================== + // CONSTRUCTOR function ------------------------------------------------------------------------------------------------------------- + + /** + * Initializes the basic TweenListObj. + * + * @param p_scope Object Object affected by this tweening + * @param p_timeStart Number Time when this tweening should start + * @param p_timeComplete Number Time when this tweening should end + * @param p_useFrames Boolean Whether or not to use frames instead of time + * @param p_transition Function Equation to control the transition animation + */ + function TweenListObj(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object) { + scope = p_scope; + timeStart = p_timeStart; + timeComplete = p_timeComplete; + useFrames = p_useFrames; + transition = p_transition; + transitionParams = p_transitionParams; + + // Other default information + properties = new Object(); + isPaused = false; + timePaused = undefined; + isCaller = false; + updatesSkipped = 0; + timesCalled = 0; + skipUpdates = 0; + hasStarted = false; + } + + + // ================================================================================================================================== + // OTHER functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Clones this tweening and returns the new TweenListObj + * + * @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted + * @return TweenListObj A copy of this object + */ + public function clone(omitEvents:Boolean):TweenListObj { + var nTween:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams); + nTween.properties = new Array(); + for (var pName:String in properties) { + nTween.properties[pName] = properties[pName].clone(); + } + nTween.skipUpdates = skipUpdates; + nTween.updatesSkipped = updatesSkipped; + if (!omitEvents) { + nTween.onStart = onStart; + nTween.onUpdate = onUpdate; + nTween.onComplete = onComplete; + nTween.onOverwrite = onOverwrite; + nTween.onError = onError; + nTween.onStartParams = onStartParams; + nTween.onUpdateParams = onUpdateParams; + nTween.onCompleteParams = onCompleteParams; + nTween.onOverwriteParams = onOverwriteParams; + nTween.onStartScope = onStartScope; + nTween.onUpdateScope = onUpdateScope; + nTween.onCompleteScope = onCompleteScope; + nTween.onOverwriteScope = onOverwriteScope; + nTween.onErrorScope = onErrorScope; + } + nTween.rounded = rounded; + nTween.isPaused = isPaused; + nTween.timePaused = timePaused; + nTween.isCaller = isCaller; + nTween.count = count; + nTween.timesCalled = timesCalled; + nTween.waitFrames = waitFrames; + nTween.hasStarted = hasStarted; + + return nTween; + } + + /** + * Returns this object described as a String. + * + * @return String The description of this object. + */ + public function toString():String { + var returnStr:String = "\n[TweenListObj "; + returnStr += "scope:" + String(scope); + returnStr += ", properties:"; + var isFirst:Boolean = true; + for (var i:String in properties) { + if (!isFirst) returnStr += ","; + returnStr += "[name:"+properties[i].name; + returnStr += ",valueStart:"+properties[i].valueStart; + returnStr += ",valueComplete:"+properties[i].valueComplete; + returnStr += "]"; + isFirst = false; + } + returnStr += ", timeStart:" + String(timeStart); + returnStr += ", timeComplete:" + String(timeComplete); + returnStr += ", useFrames:" + String(useFrames); + returnStr += ", transition:" + String(transition); + returnStr += ", transitionParams:" + String(transitionParams); + + if (skipUpdates) returnStr += ", skipUpdates:" + String(skipUpdates); + if (updatesSkipped) returnStr += ", updatesSkipped:" + String(updatesSkipped); + + if (Boolean(onStart)) returnStr += ", onStart:" + String(onStart); + if (Boolean(onUpdate)) returnStr += ", onUpdate:" + String(onUpdate); + if (Boolean(onComplete)) returnStr += ", onComplete:" + String(onComplete); + if (Boolean(onOverwrite)) returnStr += ", onOverwrite:" + String(onOverwrite); + if (Boolean(onError)) returnStr += ", onError:" + String(onError); + + if (onStartParams) returnStr += ", onStartParams:" + String(onStartParams); + if (onUpdateParams) returnStr += ", onUpdateParams:" + String(onUpdateParams); + if (onCompleteParams) returnStr += ", onCompleteParams:" + String(onCompleteParams); + if (onOverwriteParams) returnStr += ", onOverwriteParams:" + String(onOverwriteParams); + + if (onStartScope) returnStr += ", onStartScope:" + String(onStartScope); + if (onUpdateScope) returnStr += ", onUpdateScope:" + String(onUpdateScope); + if (onCompleteScope) returnStr += ", onCompleteScope:" + String(onCompleteScope); + if (onOverwriteScope) returnStr += ", onOverwriteScope:" + String(onOverwriteScope); + if (onErrorScope) returnStr += ", onErrorScope:" + String(onErrorScope); + + if (rounded) returnStr += ", rounded:" + String(rounded); + if (isPaused) returnStr += ", isPaused:" + String(isPaused); + if (timePaused) returnStr += ", timePaused:" + String(timePaused); + if (isCaller) returnStr += ", isCaller:" + String(isCaller); + if (count) returnStr += ", count:" + String(count); + if (timesCalled) returnStr += ", timesCalled:" + String(timesCalled); + if (waitFrames) returnStr += ", waitFrames:" + String(waitFrames); + if (hasStarted) returnStr += ", hasStarted:" + String(hasStarted); + + returnStr += "]\n"; + return returnStr; + } + + /** + * Checks if p_obj "inherits" properties from other objects, as set by the "base" property. Will create a new object, leaving others intact. + * o_bj.base can be an object or an array of objects. Properties are collected from the first to the last element of the "base" filed, with higher + * indexes overwritting smaller ones. Does not modify any of the passed objects, but makes a shallow copy of all properties. + * + * @param p_obj Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @return Object A new object with all properties from the p_obj and p_obj.base. + */ + + public static function makePropertiesChain(p_obj : Object) : Object{ + // Is this object inheriting properties from another object? + var baseObject : Object = p_obj.base; + if(baseObject){ + // object inherits. Are we inheriting from an object or an array + var chainedObject : Object = {}; + var chain : Object; + if (baseObject is Array){ + // Inheritance chain is the base array + chain = []; + // make a shallow copy + for (var k : Number = 0 ; k< baseObject.length; k++) chain.push(baseObject[k]); + }else{ + // Only one object to be added to the array + chain = [baseObject]; + } + // add the final object to the array, so it's properties are added last + chain.push(p_obj); + var currChainObj : Object; + // Loops through each object adding it's property to the final object + var len : Number = chain.length; + for(var i : Number = 0; i < len ; i ++){ + if(chain[i]["base"]){ + // deal with recursion: watch the order! "parent" base must be concatenated first! + currChainObj = AuxFunctions.concatObjects( makePropertiesChain(chain[i]["base"] ), chain[i]); + }else{ + currChainObj = chain[i] ; + } + chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj ); + } + if( chainedObject["base"]){ + delete chainedObject["base"]; + } + return chainedObject; + }else{ + // No inheritance, just return the object it self + return p_obj; + } + } + + + } + + + + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/Tweener.as b/flash/ImageDisplayx1/caurina/transitions/Tweener.as new file mode 100644 index 0000000000..7afa244a51 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/Tweener.as @@ -0,0 +1,1105 @@ +/** + * Tweener + * Transition controller for movieclips, sounds, textfields and other objects + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.31.71 + */ + +/* +Licensed under the MIT License + +Copyright (c) 2006-2007 Zeh Fernando and Nate Chatellier + +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. + +http://code.google.com/p/tweener/ +http://code.google.com/p/tweener/wiki/License +*/ + +package caurina.transitions { + + import flash.display.*; + import flash.events.Event; + import flash.utils.getTimer; + + public class Tweener { + + private static var __tweener_controller__:MovieClip; // Used to ensure the stage copy is always accessible (garbage collection) + + private static var _engineExists:Boolean = false; // Whether or not the engine is currently running + private static var _inited:Boolean = false; // Whether or not the class has been initiated + private static var _currentTime:Number; // The current time. This is generic for all tweenings for a "time grid" based update + private static var _currentTimeFrame:Number; // The current frame. Used on frame-based tweenings + + private static var _tweenList:Array; // List of active tweens + + private static var _timeScale:Number = 1; // Time scale (default = 1) + + private static var _transitionList:Object; // List of "pre-fetched" transition functions + private static var _specialPropertyList:Object; // List of special properties + private static var _specialPropertyModifierList:Object; // List of special property modifiers + private static var _specialPropertySplitterList:Object; // List of special property splitters + + + /** + * There's no constructor. + * @private + */ + public function Tweener () { + trace ("Tweener is a static class and should not be instantiated."); + } + + // ================================================================================================================================== + // TWEENING CONTROL functions ------------------------------------------------------------------------------------------------------- + + /** + * Adds a new tweening. + * + * @param (first-n param) Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @param (last param) Object Object containing the specified parameters in any order, as well as the properties that should be tweened and their values + * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) + * @param .delay Number Delay time (defaults 0) + * @param .useFrames Boolean Whether to use frames instead of seconds for time control (defaults false) + * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") + * @param .onStart Function * Direct property, See the TweenListObj class + * @param .onUpdate Function * Direct property, See the TweenListObj class + * @param .onComplete Function * Direct property, See the TweenListObj class + * @param .onOverwrite Function * Direct property, See the TweenListObj class + * @param .onStartParams Array * Direct property, See the TweenListObj class + * @param .onUpdateParams Array * Direct property, See the TweenListObj class + * @param .onCompleteParams Array * Direct property, See the TweenListObj class + * @param .onOverwriteParams Array * Direct property, See the TweenListObj class + * @param .rounded Boolean * Direct property, See the TweenListObj class + * @param .skipUpdates Number * Direct property, See the TweenListObj class + * @return Boolean TRUE if the tween was successfully added, FALSE if otherwise + */ + public static function addTween (p_scopes:Object = null, p_parameters:Object = null):Boolean { + if (!Boolean(p_scopes)) return false; + + var i:Number, j:Number, istr:String; + + var rScopes:Array; // List of objects to tween + if (p_scopes is Array) { + // The first argument is an array + rScopes = p_scopes.concat(); + } else { + // The first argument(s) is(are) object(s) + rScopes = [p_scopes]; + } + + // make properties chain ("inheritance") + var p_obj:Object = TweenListObj.makePropertiesChain(p_parameters); + + // Creates the main engine if it isn't active + if (!_inited) init(); + if (!_engineExists || !Boolean(__tweener_controller__)) startEngine(); // Quick fix for Flash not resetting the vars on double ctrl+enter... + + // Creates a "safer", more strict tweening object + var rTime:Number = (isNaN(p_obj.time) ? 0 : p_obj.time); // Real time + var rDelay:Number = (isNaN(p_obj.delay) ? 0 : p_obj.delay); // Real delay + + // Creates the property list; everything that isn't a hardcoded variable + var rProperties:Array = new Array(); // Object containing a list of PropertyInfoObj instances + var restrictedWords:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true}; + var modifiedProperties:Object = new Object(); + for (istr in p_obj) { + if (!restrictedWords[istr]) { + // It's an additional pair, so adds + if (_specialPropertySplitterList[istr]) { + // Special property splitter + var splitProperties:Array = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters); + for (i = 0; i < splitProperties.length; i++) { + if (_specialPropertySplitterList[splitProperties[i].name]) { + var splitProperties2:Array = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters); + for (j = 0; j < splitProperties2.length; j++) { + rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:false}; + } + } else { + rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:false}; + } + } + } else if (_specialPropertyModifierList[istr] != undefined) { + // Special property modifier + var tempModifiedProperties:Array = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]); + for (i = 0; i < tempModifiedProperties.length; i++) { + modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue}; + } + } else { + // Regular property or special property, just add the property normally + rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]}; + } + } + } + + // Verifies whether the properties exist or not, for warning messages + for (istr in rProperties) { + if (_specialPropertyList[istr] != undefined) { + rProperties[istr].isSpecialProperty = true; + } else { + if (rScopes[0][istr] == undefined) { + printError("The property '" + istr + "' doesn't seem to be a normal object property of " + String(rScopes[0]) + " or a registered special property."); + } + } + } + + // Adds the modifiers to the list of properties + for (istr in modifiedProperties) { + if (rProperties[istr] != undefined) { + rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters; + rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction; + } + + } + + var rTransition:Function; // Real transition + + if (typeof p_obj.transition == "string") { + // String parameter, transition names + var trans:String = p_obj.transition.toLowerCase(); + rTransition = _transitionList[trans]; + } else { + // Proper transition function + rTransition = p_obj.transition; + } + if (!Boolean(rTransition)) rTransition = _transitionList["easeoutexpo"]; + + var nProperties:Object; + var nTween:TweenListObj; + var myT:Number; + + for (i = 0; i < rScopes.length; i++) { + // Makes a copy of the properties + nProperties = new Object(); + for (istr in rProperties) { + nProperties[istr] = new PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters); + } + + if (p_obj.useFrames == true) { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTimeFrame + (rDelay / _timeScale), + /* timeComplete */ _currentTimeFrame + ((rDelay + rTime) / _timeScale), + /* useFrames */ true, + /* transition */ rTransition, + p_obj.transitionParams + ); + } else { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTime + ((rDelay * 1000) / _timeScale), + /* timeComplete */ _currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale), + /* useFrames */ false, + /* transition */ rTransition, + p_obj.transitionParams + ); + } + + nTween.properties = nProperties; + nTween.onStart = p_obj.onStart; + nTween.onUpdate = p_obj.onUpdate; + nTween.onComplete = p_obj.onComplete; + nTween.onOverwrite = p_obj.onOverwrite; + nTween.onError = p_obj.onError; + nTween.onStartParams = p_obj.onStartParams; + nTween.onUpdateParams = p_obj.onUpdateParams; + nTween.onCompleteParams = p_obj.onCompleteParams; + nTween.onOverwriteParams = p_obj.onOverwriteParams; + nTween.onStartScope = p_obj.onStartScope; + nTween.onUpdateScope = p_obj.onUpdateScope; + nTween.onCompleteScope = p_obj.onCompleteScope; + nTween.onOverwriteScope = p_obj.onOverwriteScope; + nTween.onErrorScope = p_obj.onErrorScope; + nTween.rounded = p_obj.rounded; + nTween.skipUpdates = p_obj.skipUpdates; + + // Remove other tweenings that occur at the same time + removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete); + + // And finally adds it to the list + _tweenList.push(nTween); + + // Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution + if (rTime == 0 && rDelay == 0) { + myT = _tweenList.length-1; + updateTweenByIndex(myT); + removeTweenByIndex(myT); + } + } + + return true; + } + + // A "caller" is like this: [ | | | ||] got it? :) + // this function is crap - should be fixed later/extend on addTween() + + /** + * Adds a new caller tweening. + * + * @param (first-n param) Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @param (last param) Object containing the specified parameters in any order, as well as the properties that should be tweened and their values + * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) + * @param .delay Number Delay time (defaults 0) + * @param .count Number Number of times this caller should be called + * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") + * @param .onStart Function Event called when tween starts + * @param .onUpdate Function Event called when tween updates + * @param .onComplete Function Event called when tween ends + * @param .waitFrames Boolean Whether to wait (or not) one frame for each call + * @return true if the tween was successfully added, false if otherwise. + */ + public static function addCaller (p_scopes:Object = null, p_parameters:Object = null):Boolean { + if (!Boolean(p_scopes)) return false; + + var i:Number; + + var rScopes:Array; // List of objects to tween + if (p_scopes is Array) { + // The first argument is an array + rScopes = p_scopes.concat(); + } else { + // The first argument(s) is(are) object(s) + rScopes = [p_scopes]; + } + + var p_obj:Object = p_parameters; + + // Creates the main engine if it isn't active + if (!_inited) init(); + if (!_engineExists || !Boolean(__tweener_controller__)) startEngine(); // Quick fix for Flash not resetting the vars on double ctrl+enter... + + // Creates a "safer", more strict tweening object + var rTime:Number = (isNaN(p_obj.time) ? 0 : p_obj.time); // Real time + var rDelay:Number = (isNaN(p_obj.delay) ? 0 : p_obj.delay); // Real delay + + var rTransition:Function; // Real transition + if (typeof p_obj.transition == "string") { + // String parameter, transition names + var trans:String = p_obj.transition.toLowerCase(); + rTransition = _transitionList[trans]; + } else { + // Proper transition function + rTransition = p_obj.transition; + } + if (!Boolean(rTransition)) rTransition = _transitionList["easeoutexpo"]; + + var nTween:TweenListObj; + var myT:Number; + for (i = 0; i < rScopes.length; i++) { + + if (p_obj.useFrames == true) { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTimeFrame + (rDelay / _timeScale), + /* timeComplete */ _currentTimeFrame + ((rDelay + rTime) / _timeScale), + /* useFrames */ true, + /* transition */ rTransition, + p_obj.transitionParams + ); + } else { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTime + ((rDelay * 1000) / _timeScale), + /* timeComplete */ _currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale), + /* useFrames */ false, + /* transition */ rTransition, + p_obj.transitionParams + ); + } + + nTween.properties = null; + nTween.onStart = p_obj.onStart; + nTween.onUpdate = p_obj.onUpdate; + nTween.onComplete = p_obj.onComplete; + nTween.onOverwrite = p_obj.onOverwrite; + nTween.onStartParams = p_obj.onStartParams; + nTween.onUpdateParams = p_obj.onUpdateParams; + nTween.onCompleteParams = p_obj.onCompleteParams; + nTween.onOverwriteParams = p_obj.onOverwriteParams; + nTween.onStartScope = p_obj.onStartScope; + nTween.onUpdateScope = p_obj.onUpdateScope; + nTween.onCompleteScope = p_obj.onCompleteScope; + nTween.onOverwriteScope = p_obj.onOverwriteScope; + nTween.onErrorScope = p_obj.onErrorScope; + nTween.isCaller = true; + nTween.count = p_obj.count; + nTween.waitFrames = p_obj.waitFrames; + + // And finally adds it to the list + _tweenList.push(nTween); + + // Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution + if (rTime == 0 && rDelay == 0) { + myT = _tweenList.length-1; + updateTweenByIndex(myT); + removeTweenByIndex(myT); + } + } + + return true; + } + + /** + * Remove an specified tweening of a specified object the tweening list, if it conflicts with the given time. + * + * @param p_scope Object List of objects affected + * @param p_properties Object List of properties affected (PropertyInfoObj instances) + * @param p_timeStart Number Time when the new tween starts + * @param p_timeComplete Number Time when the new tween ends + * @return Boolean Whether or not it actually deleted something + */ + public static function removeTweensByTime (p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean { + var removed:Boolean = false; + var removedLocally:Boolean; + + var i:uint; + var tl:uint = _tweenList.length; + var pName:String; + + for (i = 0; i < tl; i++) { + if (Boolean(_tweenList[i]) && p_scope == _tweenList[i].scope) { + // Same object... + if (p_timeComplete > _tweenList[i].timeStart && p_timeStart < _tweenList[i].timeComplete) { + // New time should override the old one... + removedLocally = false; + for (pName in _tweenList[i].properties) { + if (Boolean(p_properties[pName])) { + // Same object, same property + // Finally, remove this old tweening and use the new one + if (Boolean(_tweenList[i].onOverwrite)) { + var eventScope:Object = Boolean(_tweenList[i].onOverwriteScope) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope; + try { + _tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams); + } catch(e:Error) { + handleError(_tweenList[i], e, "onOverwrite"); + } + } + _tweenList[i].properties[pName] = undefined; + delete _tweenList[i].properties[pName]; + removedLocally = true; + removed = true; + } + } + if (removedLocally) { + // Verify if this can be deleted + if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0) removeTweenByIndex(i); + } + } + } + } + + return removed; + } + + /** + * Remove tweenings from a given object from the tweening list. + * + * @param p_tween Object Object that must have its tweens removed + * @param (2nd-last params) Object Property(ies) that must be removed + * @return Boolean Whether or not it successfully removed this tweening + */ + public static function removeTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(removeTweenByIndex, p_scope, properties); + } + + + /** + * Remove all tweenings from the engine. + * + * @return true if it successfully removed any tweening, false if otherwise. + */ + public static function removeAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var removed:Boolean = false; + var i:uint; + for (i = 0; i<_tweenList.length; i++) { + removeTweenByIndex(i); + removed = true; + } + return removed; + } + + /** + * Pause tweenings for a given object. + * + * @param p_scope Object that must have its tweens paused + * @param (2nd-last params) Property(ies) that must be paused + * @return true if it successfully paused any tweening, false if otherwise. + */ + public static function pauseTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(pauseTweenByIndex, p_scope, properties); + } + + /** + * Pause all tweenings on the engine. + * + * @return true if it successfully paused any tweening, false if otherwise. + * @see #resumeAllTweens() + */ + public static function pauseAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var paused:Boolean = false; + var i:uint; + for (i = 0; i < _tweenList.length; i++) { + pauseTweenByIndex(i); + paused = true; + } + return paused; + } + + /** + * Resume tweenings from a given object. + * + * @param p_scope Object Object that must have its tweens resumed + * @param (2nd-last params) Object Property(ies) that must be resumed + * @return Boolean Whether or not it successfully resumed something + */ + public static function resumeTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(resumeTweenByIndex, p_scope, properties); + } + + /** + * Resume all tweenings on the engine. + * + * @return true if it successfully resumed any tweening, false if otherwise. + * @see #pauseAllTweens() + */ + public static function resumeAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var resumed:Boolean = false; + var i:uint; + for (i = 0; i < _tweenList.length; i++) { + resumeTweenByIndex(i); + resumed = true; + } + return resumed; + } + + /** + * Do some generic action on specific tweenings (pause, resume, remove, more?) + * + * @param p_function Function Function to run on the tweenings that match + * @param p_scope Object Object that must have its tweens affected by the function + * @param p_properties Array Array of strings that must be affected + * @return Boolean Whether or not it successfully affected something + */ + private static function affectTweens (p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean { + var affected:Boolean = false; + var i:uint; + + if (!Boolean(_tweenList)) return false; + + for (i = 0; i < _tweenList.length; i++) { + if (_tweenList[i] && _tweenList[i].scope == p_scope) { + if (p_properties.length == 0) { + // Can affect everything + p_affectFunction(i); + affected = true; + } else { + // Must check whether this tween must have specific properties affected + var affectedProperties:Array = new Array(); + var j:uint; + for (j = 0; j < p_properties.length; j++) { + if (Boolean(_tweenList[i].properties[p_properties[j]])) { + affectedProperties.push(p_properties[j]); + } + } + if (affectedProperties.length > 0) { + // This tween has some properties that need to be affected + var objectProperties:uint = AuxFunctions.getObjectLength(_tweenList[i].properties); + if (objectProperties == affectedProperties.length) { + // The list of properties is the same as all properties, so affect it all + p_affectFunction(i); + affected = true; + } else { + // The properties are mixed, so split the tween and affect only certain specific properties + var slicedTweenIndex:uint = splitTweens(i, affectedProperties); + p_affectFunction(slicedTweenIndex); + affected = true; + } + } + } + } + } + return affected; + } + + /** + * Splits a tweening in two + * + * @param p_tween Number Object that must have its tweens split + * @param p_properties Array Array of strings containing the list of properties that must be separated + * @return Number The index number of the new tween + */ + public static function splitTweens (p_tween:Number, p_properties:Array):uint { + // First, duplicates + var originalTween:TweenListObj = _tweenList[p_tween]; + var newTween:TweenListObj = originalTween.clone(false); + + // Now, removes tweenings where needed + var i:uint; + var pName:String; + + // Removes the specified properties from the old one + for (i = 0; i < p_properties.length; i++) { + pName = p_properties[i]; + if (Boolean(originalTween.properties[pName])) { + originalTween.properties[pName] = undefined; + delete originalTween.properties[pName]; + } + } + + // Removes the unspecified properties from the new one + var found:Boolean; + for (pName in newTween.properties) { + found = false; + for (i = 0; i < p_properties.length; i++) { + if (p_properties[i] == pName) { + found = true; + break; + } + } + if (!found) { + newTween.properties[pName] = undefined; + delete newTween.properties[pName]; + } + } + + // If there are empty property lists, a cleanup is done on the next updateTweens() cycle + _tweenList.push(newTween); + return (_tweenList.length - 1); + + } + + // ================================================================================================================================== + // ENGINE functions ----------------------------------------------------------------------------------------------------------------- + + /** + * Updates all existing tweenings. + * + * @return Boolean FALSE if no update was made because there's no tweening (even delayed ones) + */ + private static function updateTweens ():Boolean { + if (_tweenList.length == 0) return false; + var i:int; + for (i = 0; i < _tweenList.length; i++) { + // Looping throught each Tweening and updating the values accordingly + if (_tweenList[i] == undefined || !_tweenList[i].isPaused) { + if (!updateTweenByIndex(i)) removeTweenByIndex(i); + if (_tweenList[i] == null) { + removeTweenByIndex(i, true); + i--; + } + } + } + + return true; + } + + /** + * Remove a specific tweening from the tweening list. + * + * @param p_tween Number Index of the tween to be removed on the tweenings list + * @return Boolean Whether or not it successfully removed this tweening + */ + public static function removeTweenByIndex (i:Number, p_finalRemoval:Boolean = false):Boolean { + _tweenList[i] = null; + if (p_finalRemoval) _tweenList.splice(i, 1); + return true; + } + + /** + * Pauses a specific tween. + * + * @param p_tween Number Index of the tween to be paused + * @return Boolean Whether or not it successfully paused this tweening + */ + public static function pauseTweenByIndex (p_tween:Number):Boolean { + var tTweening:TweenListObj = _tweenList[p_tween]; // Shortcut to this tweening + if (tTweening == null || tTweening.isPaused) return false; + tTweening.timePaused = getCurrentTweeningTime(tTweening); + tTweening.isPaused = true; + + return true; + } + + /** + * Resumes a specific tween. + * + * @param p_tween Number Index of the tween to be resumed + * @return Boolean Whether or not it successfully resumed this tweening + */ + public static function resumeTweenByIndex (p_tween:Number):Boolean { + var tTweening:TweenListObj = _tweenList[p_tween]; // Shortcut to this tweening + if (tTweening == null || !tTweening.isPaused) return false; + var cTime:Number = getCurrentTweeningTime(tTweening); + tTweening.timeStart += cTime - tTweening.timePaused; + tTweening.timeComplete += cTime - tTweening.timePaused; + tTweening.timePaused = undefined; + tTweening.isPaused = false; + + return true; + } + + /** + * Updates a specific tween. + * + * @param i Number Index (from the tween list) of the tween that should be updated + * @return Boolean FALSE if it's already finished and should be deleted, TRUE if otherwise + */ + private static function updateTweenByIndex (i:Number):Boolean { + + var tTweening:TweenListObj = _tweenList[i]; // Shortcut to this tweening + + if (tTweening == null || !Boolean(tTweening.scope)) return false; + + var isOver:Boolean = false; // Whether or not it's over the update time + var mustUpdate:Boolean; // Whether or not it should be updated (skipped if false) + + var nv:Number; // New value for each property + + var t:Number; // current time (frames, seconds) + var b:Number; // beginning value + var c:Number; // change in value + var d:Number; // duration (frames, seconds) + + var pName:String; // Property name, used in loops + var eventScope:Object; // Event scope, used to call functions + + // Shortcut stuff for speed + var tScope:Object; // Current scope + var cTime:Number = getCurrentTweeningTime(tTweening); + var tProperty:Object; // Property being checked + + if (cTime >= tTweening.timeStart) { + // Can already start + + tScope = tTweening.scope; + + if (tTweening.isCaller) { + // It's a 'caller' tween + do { + t = ((tTweening.timeComplete - tTweening.timeStart)/tTweening.count) * (tTweening.timesCalled+1); + b = tTweening.timeStart; + c = tTweening.timeComplete - tTweening.timeStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, b, c, d); + + if (cTime >= nv) { + if (Boolean(tTweening.onUpdate)) { + eventScope = Boolean(tTweening.onUpdateScope) ? tTweening.onUpdateScope : tScope; + try { + tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); + } catch(e:Error) { + handleError(tTweening, e, "onUpdate"); + } + } + + tTweening.timesCalled++; + if (tTweening.timesCalled >= tTweening.count) { + isOver = true; + break; + } + if (tTweening.waitFrames) break; + } + + } while (cTime >= nv); + } else { + // It's a normal transition tween + + mustUpdate = tTweening.skipUpdates < 1 || !tTweening.skipUpdates || tTweening.updatesSkipped >= tTweening.skipUpdates; + + if (cTime >= tTweening.timeComplete) { + isOver = true; + mustUpdate = true; + } + + if (!tTweening.hasStarted) { + // First update, read all default values (for proper filter tweening) + if (Boolean(tTweening.onStart)) { + eventScope = Boolean(tTweening.onStartScope) ? tTweening.onStartScope : tScope; + try { + tTweening.onStart.apply(eventScope, tTweening.onStartParams); + } catch(e:Error) { + handleError(tTweening, e, "onStart"); + } + } + var pv:Number; + for (pName in tTweening.properties) { + if (tTweening.properties[pName].isSpecialProperty) { + // It's a special property, tunnel via the special property function + if (Boolean(_specialPropertyList[pName].preProcess)) { + tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra); + } + pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); + } else { + // Directly read property + pv = tScope[pName]; + } + tTweening.properties[pName].valueStart = isNaN(pv) ? tTweening.properties[pName].valueComplete : pv; + } + mustUpdate = true; + tTweening.hasStarted = true; + } + + if (mustUpdate) { + for (pName in tTweening.properties) { + tProperty = tTweening.properties[pName]; + + if (isOver) { + // Tweening time has finished, just set it to the final value + nv = tProperty.valueComplete; + } else { + if (tProperty.hasModifier) { + // Modified + t = cTime - tTweening.timeStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams); + nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters); + } else { + // Normal update + t = cTime - tTweening.timeStart; + b = tProperty.valueStart; + c = tProperty.valueComplete - tProperty.valueStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, b, c, d, tTweening.transitionParams); + } + } + + if (tTweening.rounded) nv = Math.round(nv); + if (tProperty.isSpecialProperty) { + // It's a special property, tunnel via the special property method + _specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); + } else { + // Directly set property + tScope[pName] = nv; + } + } + + tTweening.updatesSkipped = 0; + + if (Boolean(tTweening.onUpdate)) { + eventScope = Boolean(tTweening.onUpdateScope) ? tTweening.onUpdateScope : tScope; + try { + tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); + } catch(e:Error) { + handleError(tTweening, e, "onUpdate"); + } + } + } else { + tTweening.updatesSkipped++; + } + } + + if (isOver && Boolean(tTweening.onComplete)) { + eventScope = Boolean(tTweening.onCompleteScope) ? tTweening.onCompleteScope : tScope; + try { + tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams); + } catch(e:Error) { + handleError(tTweening, e, "onComplete"); + } + } + + return (!isOver); + } + + // On delay, hasn't started, so returns true + return (true); + + } + + /** + * Initiates the Tweener--should only be ran once. + */ + public static function init(...rest):void { + _inited = true; + + // Registers all default equations + _transitionList = new Object(); + Equations.init(); + + // Registers all default special properties + _specialPropertyList = new Object(); + _specialPropertyModifierList = new Object(); + _specialPropertySplitterList = new Object(); + } + + /** + * Adds a new function to the available transition list "shortcuts". + * + * @param p_name String Shorthand transition name + * @param p_function Function The proper equation function + */ + public static function registerTransition(p_name:String, p_function:Function): void { + if (!_inited) init(); + _transitionList[p_name] = p_function; + } + + /** + * Adds a new special property to the available special property list. + * + * @param p_name Name of the "special" property. + * @param p_getFunction Function that gets the value. + * @param p_setFunction Function that sets the value. + */ + public static function registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array = null, p_preProcessFunction:Function = null): void { + if (!_inited) init(); + var sp:SpecialProperty = new SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction); + _specialPropertyList[p_name] = sp; + } + + /** + * Adds a new special property modifier to the available modifier list. + * + * @param p_name Name of the "special" property modifier. + * @param p_modifyFunction Function that modifies the value. + * @param p_getFunction Function that gets the value. + */ + public static function registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function): void { + if (!_inited) init(); + var spm:SpecialPropertyModifier = new SpecialPropertyModifier(p_modifyFunction, p_getFunction); + _specialPropertyModifierList[p_name] = spm; + } + + /** + * Adds a new special property splitter to the available splitter list. + * + * @param p_name Name of the "special" property splitter. + * @param p_splitFunction Function that splits the value. + */ + public static function registerSpecialPropertySplitter(p_name:String, p_splitFunction:Function, p_parameters:Array = null): void { + if (!_inited) init(); + var sps:SpecialPropertySplitter = new SpecialPropertySplitter(p_splitFunction, p_parameters); + _specialPropertySplitterList[p_name] = sps; + } + + /** + * Starts the Tweener class engine. It is supposed to be running every time a tween exists. + */ + private static function startEngine():void { + _engineExists = true; + _tweenList = new Array(); + + __tweener_controller__ = new MovieClip(); + __tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); + + _currentTimeFrame = 0; + updateTime(); + } + + /** + * Stops the Tweener class engine. + */ + private static function stopEngine():void { + _engineExists = false; + _tweenList = null; + _currentTime = 0; + _currentTimeFrame = 0; + __tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); + __tweener_controller__ = null; + } + + /** + * Updates the time to enforce time grid-based updates. + */ + public static function updateTime():void { + _currentTime = getTimer(); + } + + /** + * Updates the current frame count + */ + public static function updateFrame():void { + _currentTimeFrame++; + } + + /** + * Ran once every frame. It's the main engine; updates all existing tweenings. + */ + public static function onEnterFrame(e:Event):void { + updateTime(); + updateFrame(); + var hasUpdated:Boolean = false; + hasUpdated = updateTweens(); + if (!hasUpdated) stopEngine(); // There's no tweening to update or wait, so it's better to stop the engine + } + + /** + * Sets the new time scale. + * + * @param p_time Number New time scale (0.5 = slow, 1 = normal, 2 = 2x fast forward, etc) + */ + public static function setTimeScale(p_time:Number):void { + var i:Number; + var cTime:Number; + + if (isNaN(p_time)) p_time = 1; + if (p_time < 0.00001) p_time = 0.00001; + if (p_time != _timeScale) { + if (_tweenList != null) { + // Multiplies all existing tween times accordingly + for (i = 0; i<_tweenList.length; i++) { + cTime = getCurrentTweeningTime(_tweenList[i]); + _tweenList[i].timeStart = cTime - ((cTime - _tweenList[i].timeStart) * _timeScale / p_time); + _tweenList[i].timeComplete = cTime - ((cTime - _tweenList[i].timeComplete) * _timeScale / p_time); + if (_tweenList[i].timePaused != undefined) _tweenList[i].timePaused = cTime - ((cTime - _tweenList[i].timePaused) * _timeScale / p_time); + } + } + // Sets the new timescale value (for new tweenings) + _timeScale = p_time; + } + } + + + // ================================================================================================================================== + // AUXILIARY functions -------------------------------------------------------------------------------------------------------------- + + /** + * Finds whether or not an object has any tweening. + * + * @param p_scope Target object. + * @return true if there's a tweening occuring on this object (paused, delayed, or active), false if otherwise. + */ + public static function isTweening (p_scope:Object):Boolean { + if (!Boolean(_tweenList)) return false; + var i:uint; + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + return true; + } + } + return false; + } + + /** + * Returns an array containing a list of the properties being tweened for this object. + * + * @param p_scope Target object. + * @return Total number of properties being tweened (including delayed or paused tweens). + */ + public static function getTweens (p_scope:Object):Array { + if (!Boolean(_tweenList)) return []; + var i:uint; + var pName:String; + var tList:Array = new Array(); + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + for (pName in _tweenList[i].properties) tList.push(pName); + } + } + return tList; + } + + /** + * Returns the number of properties being tweened for a given object. + * + * @param p_scope Target object. + * @return Total number of properties being tweened (including delayed or paused tweens). + */ + public static function getTweenCount (p_scope:Object):Number { + if (!Boolean(_tweenList)) return 0; + var i:uint; + var c:Number = 0; + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + c += AuxFunctions.getObjectLength(_tweenList[i].properties); + } + } + return c; + } + + + /* Handles errors when Tweener executes any callbacks (onStart, onUpdate, etc) + * If the TweenListObj specifies an onError callback it well get called, passing the Error object and the current scope as parameters. If no onError callback is specified, it will trace a stackTrace. + */ + private static function handleError(pTweening : TweenListObj, pError : Error, pCallBackName : String) : void{ + // do we have an error handler? + if (Boolean(pTweening.onError) && (pTweening.onError is Function)){ + // yup, there's a handler. Wrap this in a try catch in case the onError throws an error itself. + var eventScope:Object = Boolean(pTweening.onErrorScope) ? pTweening.onErrorScope : pTweening.scope; + try { + pTweening.onError.apply(eventScope, [pTweening.scope, pError]); + } catch (metaError : Error){ + printError(String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n " + pError.getStackTrace() + "\nonError error: " + metaError.getStackTrace()); + } + } else { + // no handler, simply trace the stack trace: + if (!Boolean(pTweening.onError)){ + printError(String(pTweening.scope) + " raised an error while executing the '" + pCallBackName + "'handler. \n" + pError.getStackTrace() ); + } + } + } + + /** + * Get the current tweening time (no matter if it uses frames or time as basis), given a specific tweening + * + * @param p_tweening TweenListObj Tween information + */ + public static function getCurrentTweeningTime(p_tweening:Object):Number { + return p_tweening.useFrames ? _currentTimeFrame : _currentTime; + } + + /** + * Return the current tweener version + * + * @return String The number of the current Tweener version + */ + public static function getVersion():String { + return "AS3 1.31.71"; + } + + + // ================================================================================================================================== + // DEBUG functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Output an error message + * + * @param p_message String The error message to output + */ + public static function printError(p_message:String): void { + // + trace("## [Tweener] Error: "+p_message); + } + + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as new file mode 100644 index 0000000000..a5493aa0d5 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as @@ -0,0 +1,479 @@ +package caurina.transitions.properties { + + /** + * properties.ColorShortcuts + * List of default special color properties (normal and splitter properties) for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.geom.ColorTransform; + import flash.filters.ColorMatrixFilter; + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + public class ColorShortcuts { + + // Sources: + // http://www.graficaobscura.com/matrix/index.html + // And mario Klingemann's ColorMatrix class as mentioned on the credits: + // http://www.quasimondo.com/archives/000565.php + + // Defines luminance using sRGB luminance + private static var LUMINANCE_R:Number = 0.212671; + private static var LUMINANCE_G:Number = 0.715160; + private static var LUMINANCE_B:Number = 0.072169; + + /** + * There's no constructor. + */ + public function ColorShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Normal properties + Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]); + Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]); + Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]); + Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]); + Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]); + Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]); + Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]); + Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]); + + Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]); + Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]); + Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]); + Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]); + Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]); + Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]); + Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]); + Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]); + + // Normal splitter properties + Tweener.registerSpecialPropertySplitter("_color", _color_splitter); + Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter); + + // Color changes that depend on the ColorMatrixFilter + Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]); + Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]); + Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set); + Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set); + Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]); + Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _color + + /** + * Splits the _color parameter into specific color variables + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _color_splitter (p_value:*, p_parameters:Array):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so just resets the color + nArray.push({name:"_color_redMultiplier", value:1}); + nArray.push({name:"_color_redOffset", value:0}); + nArray.push({name:"_color_greenMultiplier", value:1}); + nArray.push({name:"_color_greenOffset", value:0}); + nArray.push({name:"_color_blueMultiplier", value:1}); + nArray.push({name:"_color_blueOffset", value:0}); + } else { + // A color tinting is passed, so converts it to the object values + nArray.push({name:"_color_redMultiplier", value:0}); + nArray.push({name:"_color_redOffset", value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:"_color_greenMultiplier", value:0}); + nArray.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:"_color_blueMultiplier", value:0}); + nArray.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(p_value)}); + } + return nArray; + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _colorTransform + + /** + * Splits the _colorTransform parameter into specific color variables + * + * @param p_value Number The original _colorTransform value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _colorTransform_splitter (p_value:Object, p_parameters:Array):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so just resets the color + nArray.push({name:"_color_redMultiplier", value:1}); + nArray.push({name:"_color_redOffset", value:0}); + nArray.push({name:"_color_greenMultiplier", value:1}); + nArray.push({name:"_color_greenOffset", value:0}); + nArray.push({name:"_color_blueMultiplier", value:1}); + nArray.push({name:"_color_blueOffset", value:0}); + } else { + // A color tinting is passed, so converts it to the object values + if (p_value.ra != undefined) nArray.push({name:"_color_ra", value:p_value.ra}); + if (p_value.rb != undefined) nArray.push({name:"_color_rb", value:p_value.rb}); + if (p_value.ga != undefined) nArray.push({name:"_color_ba", value:p_value.ba}); + if (p_value.gb != undefined) nArray.push({name:"_color_bb", value:p_value.bb}); + if (p_value.ba != undefined) nArray.push({name:"_color_ga", value:p_value.ga}); + if (p_value.bb != undefined) nArray.push({name:"_color_gb", value:p_value.gb}); + if (p_value.aa != undefined) nArray.push({name:"_color_aa", value:p_value.aa}); + if (p_value.ab != undefined) nArray.push({name:"_color_ab", value:p_value.ab}); + if (p_value.redMultiplier != undefined) nArray.push({name:"_color_redMultiplier", value:p_value.redMultiplier}); + if (p_value.redOffset != undefined) nArray.push({name:"_color_redOffset", value:p_value.redOffset}); + if (p_value.blueMultiplier != undefined) nArray.push({name:"_color_blueMultiplier", value:p_value.blueMultiplier}); + if (p_value.blueOffset != undefined) nArray.push({name:"_color_blueOffset", value:p_value.blueOffset}); + if (p_value.greenMultiplier != undefined) nArray.push({name:"_color_greenMultiplier", value:p_value.greenMultiplier}); + if (p_value.greenOffset != undefined) nArray.push({name:"_color_greenOffset", value:p_value.greenOffset}); + if (p_value.alphaMultiplier != undefined) nArray.push({name:"_color_alphaMultiplier", value:p_value.alphaMultiplier}); + if (p_value.alphaOffset != undefined) nArray.push({name:"_color_alphaOffset", value:p_value.alphaOffset}); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _color_* + + /** + * _color_* + * Generic function for the ra/rb/etc components of the deprecated colorTransform object + */ + public static function _oldColor_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.transform.colorTransform[p_parameters[0]] * 100; + } + public static function _oldColor_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var tf:ColorTransform = p_obj.transform.colorTransform; + tf[p_parameters[0]] = p_value / 100; + p_obj.transform.colorTransform = tf; + } + + /** + * _color_* + * Generic function for the redMultiplier/redOffset/etc components of the new colorTransform + */ + public static function _color_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.transform.colorTransform[p_parameters[0]]; + } + public static function _color_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var cfm:ColorTransform = p_obj.transform.colorTransform; + cfm[p_parameters[0]] = p_value; + p_obj.transform.colorTransform = cfm; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // Special coloring + + /** + * _brightness + * Brightness of an object: -1 -> [0] -> +1 + */ + public static function _brightness_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var isTint:Boolean = p_parameters[0]; + + /* + // Using ColorMatrix: + + var mtx:Array = getObjectMatrix(p_obj); + + var mc:Number = 1 - ((mtx[0] + mtx[6] + mtx[12]) / 3); // Brightness as determined by the main channels + var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3; // Brightness as determined by the offset channels + */ + + var cfm:ColorTransform = p_obj.transform.colorTransform; + var mc:Number = 1 - ((cfm.redMultiplier + cfm.greenMultiplier + cfm.blueMultiplier) / 3); // Brightness as determined by the main channels + var co:Number = (cfm.redOffset + cfm.greenOffset + cfm.blueOffset) / 3; + + if (isTint) { + // Tint style + //return (mc+(co/255))/2; + return co > 0 ? co / 255 : -mc; + } else { + // Native, Flash "Adjust Color" and Photoshop style + return co / 100; + } + } + public static function _brightness_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + //var mtx:Array = getObjectMatrix(p_obj); + + var isTint:Boolean = p_parameters[0]; + + var mc:Number; // Main channel + var co:Number; // Channel offset + + if (isTint) { + // Tint style + mc = 1 - Math.abs(p_value); + co = p_value > 0 ? Math.round(p_value*255) : 0; + } else { + // Native, Flash "Adjust Color" and Photoshop style + mc = 1; + co = Math.round(p_value*100); + } + + /* + // Using ColorMatrix: + var mtx:Array = [ + mc, cc, cc, cc, co, + cc, mc, cc, cc, co, + cc, cc, mc, cc, co, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + */ + var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0); + p_obj.transform.colorTransform = cfm; + } + + /** + * _saturation + * Saturation of an object: 0 -> [1] -> 2 + */ + public static function _saturation_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var mtx:Array = getObjectMatrix(p_obj); + + var isDumb:Boolean = p_parameters[0]; + var rl:Number = isDumb ? 1/3 : LUMINANCE_R; + var gl:Number = isDumb ? 1/3 : LUMINANCE_G; + var bl:Number = isDumb ? 1/3 : LUMINANCE_B; + + var mc:Number = ((mtx[0]-rl)/(1-rl) + (mtx[6]-gl)/(1-gl) + (mtx[12]-bl)/(1-bl)) / 3; // Color saturation as determined by the main channels + var cc:Number = 1 - ((mtx[1]/gl + mtx[2]/bl + mtx[5]/rl + mtx[7]/bl + mtx[10]/rl + mtx[11]/gl) / 6); // Color saturation as determined by the other channels + return (mc + cc) / 2; + } + public static function _saturation_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + + var isDumb:Boolean = p_parameters[0]; + var rl:Number = isDumb ? 1/3 : LUMINANCE_R; + var gl:Number = isDumb ? 1/3 : LUMINANCE_G; + var bl:Number = isDumb ? 1/3 : LUMINANCE_B; + + var sf:Number = p_value; + var nf:Number = 1-sf; + var nr:Number = rl * nf; + var ng:Number = gl * nf; + var nb:Number = bl * nf; + + var mtx:Array = [ + nr+sf, ng, nb, 0, 0, + nr, ng+sf, nb, 0, 0, + nr, ng, nb+sf, 0, 0, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + } + + /** + * _contrast + * Contrast of an object: -1 -> [0] -> +1 + */ + public static function _contrast_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + /* + // Using ColorMatrix: + var mtx:Array = getObjectMatrix(p_obj); + + var mc:Number = ((mtx[0] + mtx[6] + mtx[12]) / 3) - 1; // Contrast as determined by the main channels + var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3 / -128; // Contrast as determined by the offset channel + */ + var cfm:ColorTransform = p_obj.transform.colorTransform; + var mc:Number; // Contrast as determined by the main channels + var co:Number; // Contrast as determined by the offset channel + mc = ((cfm.redMultiplier + cfm.greenMultiplier + cfm.blueMultiplier) / 3) - 1; + co = (cfm.redOffset + cfm.greenOffset + cfm.blueOffset) / 3 / -128; + /* + if (cfm.ra < 100) { + // Low contrast + mc = ((cfm.ra + cfm.ga + cfm.ba) / 300) - 1; + co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -128; + } else { + // High contrast + mc = (((cfm.ra + cfm.ga + cfm.ba) / 300) - 1) / 37; + co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -3840; + } + */ + + return (mc+co)/2; + } + public static function _contrast_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + + var mc:Number; // Main channel + var co:Number; // Channel offset + mc = p_value + 1; + co = Math.round(p_value*-128); + + /* + if (p_value < 0) { + // Low contrast + mc = p_value + 1; + co = Math.round(p_value*-128); + } else { + // High contrast + mc = (p_value * 37) + 1; + co = Math.round(p_value*-3840); + } + */ + + // Flash: * 8, * -512 + + /* + // Using ColorMatrix: + var mtx:Array = [ + mc, 0, 0, 0, co, + 0, mc, 0, 0, co, + 0, 0, mc, 0, co, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + */ + var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0); + p_obj.transform.colorTransform = cfm; + } + + /** + * _hue + * Hue of an object: -180 -> [0] -> 180 + */ + public static function _hue_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var mtx:Array = getObjectMatrix(p_obj); + + // Find the current Hue based on a given matrix. + // This is a kind of a brute force method by sucessive division until a close enough angle is found. + // Reverse-engineering the hue equation would be is a better choice, but it's hard to find material + // on the correct calculation employed by Flash. + // This code has to run only once (before the tween starts), so it's good enough. + + var hues:Array = []; + var i:Number; + + hues[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)}; + hues[1] = {angle:180, matrix:getHueMatrix(180)}; + + for (i = 0; i < hues.length; i++) { + hues[i].distance = getHueDistance(mtx, hues[i].matrix); + } + + var maxTries:Number = 15; // Number o maximum divisions until the hue is found + var angleToSplit:Number; + + for (i = 0; i < maxTries; i++) { + // Find the nearest angle + if (hues[0].distance < hues[1].distance) { + // First is closer + angleToSplit = 1; + } else { + // Second is closer + angleToSplit = 0; + } + hues[angleToSplit].angle = (hues[0].angle + hues[1].angle)/2; + hues[angleToSplit].matrix = getHueMatrix(hues[angleToSplit].angle) + hues[angleToSplit].distance = getHueDistance(mtx, hues[angleToSplit].matrix); + } + + return hues[angleToSplit].angle; + } + + public static function _hue_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + setObjectMatrix(p_obj, getHueMatrix(p_value)); + } + + public static function getHueDistance (mtx1:Array, mtx2:Array): Number { + return (Math.abs(mtx1[0] - mtx2[0]) + Math.abs(mtx1[1] - mtx2[1]) + Math.abs(mtx1[2] - mtx2[2])); + } + + public static function getHueMatrix (hue:Number): Array { + var ha:Number = hue * Math.PI/180; // Hue angle, to radians + + var rl:Number = LUMINANCE_R; + var gl:Number = LUMINANCE_G; + var bl:Number = LUMINANCE_B; + + var c:Number = Math.cos(ha); + var s:Number = Math.sin(ha); + + var mtx:Array = [ + (rl + (c * (1 - rl))) + (s * (-rl)), + (gl + (c * (-gl))) + (s * (-gl)), + (bl + (c * (-bl))) + (s * (1 - bl)), + 0, 0, + + (rl + (c * (-rl))) + (s * 0.143), + (gl + (c * (1 - gl))) + (s * 0.14), + (bl + (c * (-bl))) + (s * -0.283), + 0, 0, + + (rl + (c * (-rl))) + (s * (-(1 - rl))), + (gl + (c * (-gl))) + (s * gl), + (bl + (c * (1 - bl))) + (s * bl), + 0, 0, + + 0, 0, 0, 1, 0 + ]; + + return mtx; + } + + + // ================================================================================================================================== + // AUXILIARY functions -------------------------------------------------------------------------------------------------------------- + + private static function getObjectMatrix(p_obj:Object): Array { + // Get the current color matrix of an object + for (var i:Number = 0; i < p_obj.filters.length; i++) { + if (p_obj.filters[i] is ColorMatrixFilter) { + return p_obj.filters[i].matrix.concat(); + } + } + return [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ]; + } + + private static function setObjectMatrix(p_obj:Object, p_matrix:Array): void { + // Set the current color matrix of an object + var objFilters:Array = p_obj.filters.concat(); + var found:Boolean = false; + for (var i:Number = 0; i < objFilters.length; i++) { + if (objFilters[i] is ColorMatrixFilter) { + objFilters[i].matrix = p_matrix.concat(); + found = true; + } + } + if (!found) { + // Has to create a new color matrix filter + var cmtx:ColorMatrixFilter = new ColorMatrixFilter(p_matrix); + objFilters[objFilters.length] = cmtx; + } + p_obj.filters = objFilters; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as b/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as new file mode 100644 index 0000000000..b004c1fcc0 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as @@ -0,0 +1,109 @@ +package caurina.transitions.properties { + + /** + * properties.CurveModifiers + * List of default special properties modifiers for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import caurina.transitions.Tweener; + + public class CurveModifiers { + + /** + * There's no constructor. + */ + public function CurveModifiers () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Bezier modifiers + Tweener.registerSpecialPropertyModifier("_bezier", _bezier_modifier, _bezier_get); + } + + + // ================================================================================================================================== + // SPECIAL PROPERTY MODIFIER functions ---------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _bezier + + /** + * Given the parameter object passed to this special property, return an array listing the properties that should be modified, and their parameters + * + * @param p_obj Object Parameter passed to this property + * @return Array Array listing name and parameter of each property + */ + public static function _bezier_modifier (p_obj:*):Array { + var mList:Array = []; // List of properties to be modified + var pList:Array; // List of parameters passed, normalized as an array + if (p_obj is Array) { + // Complex + pList = p_obj; + } else { + pList = [p_obj]; + } + + var i:uint; + var istr:String; + var mListObj:Object = {}; // Object describing each property name and parameter + + for (i = 0; i < pList.length; i++) { + for (istr in pList[i]) { + if (mListObj[istr] == undefined) mListObj[istr] = []; + mListObj[istr].push(pList[i][istr]); + } + } + for (istr in mListObj) { + mList.push({name:istr, parameters:mListObj[istr]}); + } + return mList; + } + + /** + * Given tweening specifications (beging, end, t), applies the property parameter to it, returning new t + * + * @param b Number Beginning value of the property + * @param e Number Ending (desired) value of the property + * @param t Number Current t of this tweening (0-1), after applying the easing equation + * @param p Array Array of parameters passed to this specific property + * @return Number New t, with the p parameters applied to it + */ + public static function _bezier_get (b:Number, e:Number, t:Number, p:Array):Number { + // This is based on Robert Penner's code + if (p.length == 1) { + // Simple curve with just one bezier control point + return b + t*(2*(1-t)*(p[0]-b) + t*(e - b)); + } else { + // Array of bezier control points, must find the point between each pair of bezier points + var ip:uint = Math.floor(t * p.length); // Position on the bezier list + var it:Number = (t - (ip * (1 / p.length))) * p.length; // t inside this ip + var p1:Number, p2:Number; + if (ip == 0) { + // First part: belongs to the first control point, find second midpoint + p1 = b; + p2 = (p[0]+p[1])/2; + } else if (ip == p.length - 1) { + // Last part: belongs to the last control point, find first midpoint + p1 = (p[ip-1]+p[ip])/2; + p2 = e; + } else { + // Any middle part: find both midpoints + p1 = (p[ip-1]+p[ip])/2; + p2 = (p[ip]+p[ip+1])/2; + } + return p1+it*(2*(1-it)*(p[ip]-p1) + it*(p2 - p1)); + } + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as new file mode 100644 index 0000000000..fff4568ab2 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as @@ -0,0 +1,161 @@ +package caurina.transitions.properties { + + /** + * properties.DisplayShortcuts.as + * List of default special MovieClip properties (normal and splitter properties) for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.geom.Point; + import flash.geom.Rectangle; + + import caurina.transitions.Tweener; + + public class DisplayShortcuts { + + /** + * There's no constructor. + */ + public function DisplayShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Normal properties + Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set); + Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set); + + // Scale splitter properties + Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter); + + // scrollRect splitter properties + Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter); + + // scrollrect normal properties + Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]); + Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]); + Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]); + Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]); + Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]); + Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]); + Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]); + Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // scale + public static function _scale_splitter(p_value:Number, p_parameters:Array) : Array{ + var nArray:Array = new Array(); + nArray.push({name:"scaleX", value: p_value}); + nArray.push({name:"scaleY", value: p_value}); + return nArray; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _scrollRect + + /** + * Splits the _scrollRect parameter into specific scrollRect variables + * + * @param p_value Rectangle The original _scrollRect rectangle + * @return Array An array containing the .name and .value of all new properties + */ + public static function _scrollRect_splitter (p_value:Rectangle, p_parameters:Array, p_extra:Object = null):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so try any rectangle :/ + nArray.push({name:"_scrollRect_x", value:0}); + nArray.push({name:"_scrollRect_y", value:0}); + nArray.push({name:"_scrollRect_width", value:100}); + nArray.push({name:"_scrollRect_height", value:100}); + } else { + // A rectangle is passed, so just return the properties + nArray.push({name:"_scrollRect_x", value:p_value.x}); + nArray.push({name:"_scrollRect_y", value:p_value.y}); + nArray.push({name:"_scrollRect_width", value:p_value.width}); + nArray.push({name:"_scrollRect_height", value:p_value.height}); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _frame + + /** + * Returns the current frame number from the movieclip timeline + * + * @param p_obj Object MovieClip object + * @return Number The current frame + */ + public static function _frame_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.currentFrame; + } + + /** + * Sets the timeline frame + * + * @param p_obj Object MovieClip object + * @param p_value Number New frame number + */ + public static function _frame_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + p_obj.gotoAndStop(Math.round(p_value)); + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _autoAlpha + + /** + * Returns the current alpha + * + * @param p_obj Object MovieClip or Textfield object + * @return Number The current alpha + */ + public static function _autoAlpha_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.alpha; + } + + /** + * Sets the current autoAlpha + * + * @param p_obj Object MovieClip or Textfield object + * @param p_value Number New alpha + */ + public static function _autoAlpha_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + p_obj.alpha = p_value; + p_obj.visible = p_value > 0; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _scrollRect_* + + /** + * _scrollRect_* + * Generic function for the properties of the scrollRect object + */ + public static function _scrollRect_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.scrollRect[p_parameters[0]]; + } + public static function _scrollRect_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var rect:Rectangle = p_obj.scrollRect; + rect[p_parameters[0]] = Math.round(p_value); + p_obj.scrollRect = rect; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as new file mode 100644 index 0000000000..e63b7e18cf --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as @@ -0,0 +1,495 @@ +package caurina.transitions.properties { + + /** + * properties.FilterShortcuts + * Special properties for the Tweener class to handle MovieClip filters + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.display.BitmapData; + import flash.filters.BevelFilter; + import flash.filters.BitmapFilter; + import flash.filters.BlurFilter; + import flash.filters.ColorMatrixFilter; + import flash.filters.ConvolutionFilter; + import flash.filters.DisplacementMapFilter; + import flash.filters.DropShadowFilter; + import flash.filters.GlowFilter; + import flash.filters.GradientBevelFilter; + import flash.filters.GradientGlowFilter; + import flash.geom.Point; + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + public class FilterShortcuts { + + /** + * There's no constructor. + */ + public function FilterShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Filter tweening splitter properties + Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter); + + // Shortcuts - BevelFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/BevelFilter.html + Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]); + Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]); + Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]); + Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]); + Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]); + Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]); + Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]); + Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]); + Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]); + Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]); + Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]); + Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]); + + // Shortcuts - BlurFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/BlurFilter.html + Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]); + Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]); + Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]); + + // Shortcuts - ColorMatrixFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/ColorMatrixFilter.html + Tweener.registerSpecialPropertySplitter("_ColorMatrix_matrix", _generic_matrix_splitter, [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], + ["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro", + "_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go", + "_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo", + "_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]); + + // Shortcuts - ConvolutionFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/ConvolutionFilter.html + Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]); + Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]); + Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]); + Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]); + Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]); + //Tweener.registerSpecialPropertySplitter("_Convolution_matrix", _generic_array_splitter, ["_Convolution_matrix_array"]); + //Tweener.registerSpecialProperty("_Convolution_matrix_array", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrix", "array"]); + Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]); + Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]); + Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]); + + // Shortcuts - DisplacementMapFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/DisplacementMapFilter.html + Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]); + Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]); + Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]); + Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]); + Tweener.registerSpecialProperty("_DisplacementMap_mapPoint", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint"]); + Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]); + Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]); + Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]); + + // Shortcuts - DropShadowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/DropShadowFilter.html + Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]); + Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]); + Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]); + Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]); + Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]); + Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]); + Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]); + Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]); + Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]); + Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]); + Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]); + + // Shortcuts - GlowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GlowFilter.html + Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]); + Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]); + Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]); + Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]); + Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]); + Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]); + Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]); + Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]); + + // Shortcuts - GradientBevelFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientBevelFilter.html + // .alphas (array) + Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]); + Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]); + Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]); + // .colors (array) + Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]); + Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]); + // .ratios(array) + Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]); + Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]); + + // Shortcuts - GradientGlowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientGlowFilter.html + // .alphas (array) + Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]); + Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]); + Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]); + // .colors (array) + Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]); + Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]); + Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]); + // .ratios (array) + Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]); + Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // generic splitters + + /** + * A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array { + var nArray:Array = new Array(); + nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)}); + return nArray; + } + + /** + * A generic matrix splitter - from [] to items with the name of the parameters passed + * + * @param p_value Array The original + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_matrix_splitter (p_value:Array, p_parameters:Array):Array { + if (p_value == null) p_value = p_parameters[0].concat(); + var nArray:Array = new Array(); + for (var i:Number = 0; i < p_value.length; i++) { + nArray.push({name:p_parameters[1][i], value:p_value[i]}); + } + return nArray; + } + + /** + * A generic array splitter - from [] to items with the index passed back + * + * @param p_value Array The original array value + * @return Array An array containing the .name and .value of all new properties + */ + /* + public static function _generic_array_splitter (p_value:Array, p_parameters:Array):Array { + if (p_value == null) p_value = p_parameters[0].concat(); + var nArray:Array = new Array(); + for (var i:Number = 0; i < p_value.length; i++) { + nArray.push({name:p_parameters[1][i], value:p_value[i], arrayIndex:i}); + } + return nArray; + } + */ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // filters + + /** + * Splits the _filter, _blur, etc parameter into specific filter variables + * + * @param p_value BitmapFilter A BitmapFilter instance + * @return Array An array containing the .name and .value of all new properties + */ + public static function _filter_splitter (p_value:BitmapFilter, p_parameters:Array, p_extra:Object = null):Array { + var nArray:Array = new Array(); + if (p_value is BevelFilter) { + nArray.push({name:"_Bevel_angle", value:BevelFilter(p_value).angle}); + nArray.push({name:"_Bevel_blurX", value:BevelFilter(p_value).blurX}); + nArray.push({name:"_Bevel_blurY", value:BevelFilter(p_value).blurY}); + nArray.push({name:"_Bevel_distance", value:BevelFilter(p_value).distance}); + nArray.push({name:"_Bevel_highlightAlpha", value:BevelFilter(p_value).highlightAlpha}); + nArray.push({name:"_Bevel_highlightColor", value:BevelFilter(p_value).highlightColor}); + nArray.push({name:"_Bevel_knockout", value:BevelFilter(p_value).knockout}); + nArray.push({name:"_Bevel_quality", value:BevelFilter(p_value).quality}); + nArray.push({name:"_Bevel_shadowAlpha", value:BevelFilter(p_value).shadowAlpha}); + nArray.push({name:"_Bevel_shadowColor", value:BevelFilter(p_value).shadowColor}); + nArray.push({name:"_Bevel_strength", value:BevelFilter(p_value).strength}); + nArray.push({name:"_Bevel_type", value:BevelFilter(p_value).type}); + } else if (p_value is BlurFilter) { + nArray.push({name:"_Blur_blurX", value:BlurFilter(p_value).blurX}); + nArray.push({name:"_Blur_blurY", value:BlurFilter(p_value).blurY}); + nArray.push({name:"_Blur_quality", value:BlurFilter(p_value).quality}); + } else if (p_value is ColorMatrixFilter) { + nArray.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(p_value).matrix}); + } else if (p_value is ConvolutionFilter) { + nArray.push({name:"_Convolution_alpha", value:ConvolutionFilter(p_value).alpha}); + nArray.push({name:"_Convolution_bias", value:ConvolutionFilter(p_value).bias}); + nArray.push({name:"_Convolution_clamp", value:ConvolutionFilter(p_value).clamp}); + nArray.push({name:"_Convolution_color", value:ConvolutionFilter(p_value).color}); + // .matrix + nArray.push({name:"_Convolution_divisor", value:ConvolutionFilter(p_value).divisor}); + nArray.push({name:"_Convolution_matrixX", value:ConvolutionFilter(p_value).matrixX}); + nArray.push({name:"_Convolution_matrixY", value:ConvolutionFilter(p_value).matrixY}); + nArray.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(p_value).preserveAlpha}); + } else if (p_value is DisplacementMapFilter) { + nArray.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(p_value).alpha}); + nArray.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(p_value).color}); + nArray.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(p_value).componentX}); + nArray.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(p_value).componentY}); + nArray.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(p_value).mapBitmap}); + nArray.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(p_value).mapPoint}); + nArray.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(p_value).mode}); + nArray.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(p_value).scaleX}); + nArray.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(p_value).scaleY}); + } else if (p_value is DropShadowFilter) { + nArray.push({name:"_DropShadow_alpha", value:DropShadowFilter(p_value).alpha}); + nArray.push({name:"_DropShadow_angle", value:DropShadowFilter(p_value).angle}); + nArray.push({name:"_DropShadow_blurX", value:DropShadowFilter(p_value).blurX}); + nArray.push({name:"_DropShadow_blurY", value:DropShadowFilter(p_value).blurY}); + nArray.push({name:"_DropShadow_color", value:DropShadowFilter(p_value).color}); + nArray.push({name:"_DropShadow_distance", value:DropShadowFilter(p_value).distance}); + nArray.push({name:"_DropShadow_hideObject", value:DropShadowFilter(p_value).hideObject}); + nArray.push({name:"_DropShadow_inner", value:DropShadowFilter(p_value).inner}); + nArray.push({name:"_DropShadow_knockout", value:DropShadowFilter(p_value).knockout}); + nArray.push({name:"_DropShadow_quality", value:DropShadowFilter(p_value).quality}); + nArray.push({name:"_DropShadow_strength", value:DropShadowFilter(p_value).strength}); + } else if (p_value is GlowFilter) { + nArray.push({name:"_Glow_alpha", value:GlowFilter(p_value).alpha}); + nArray.push({name:"_Glow_blurX", value:GlowFilter(p_value).blurX}); + nArray.push({name:"_Glow_blurY", value:GlowFilter(p_value).blurY}); + nArray.push({name:"_Glow_color", value:GlowFilter(p_value).color}); + nArray.push({name:"_Glow_inner", value:GlowFilter(p_value).inner}); + nArray.push({name:"_Glow_knockout", value:GlowFilter(p_value).knockout}); + nArray.push({name:"_Glow_quality", value:GlowFilter(p_value).quality}); + nArray.push({name:"_Glow_strength", value:GlowFilter(p_value).strength}); + } else if (p_value is GradientBevelFilter) { + // .alphas (array) + nArray.push({name:"_GradientBevel_angle", value:GradientBevelFilter(p_value).strength}); + nArray.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(p_value).blurX}); + nArray.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(p_value).blurY}); + // .colors (array) + nArray.push({name:"_GradientBevel_distance", value:GradientBevelFilter(p_value).distance}); + nArray.push({name:"_GradientBevel_quality", value:GradientBevelFilter(p_value).quality}); + // .ratios(array) + nArray.push({name:"_GradientBevel_strength", value:GradientBevelFilter(p_value).strength}); + nArray.push({name:"_GradientBevel_type", value:GradientBevelFilter(p_value).type}); + } else if (p_value is GradientGlowFilter) { + // .alphas (array) + nArray.push({name:"_GradientGlow_angle", value:GradientGlowFilter(p_value).strength}); + nArray.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(p_value).blurX}); + nArray.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(p_value).blurY}); + // .colors (array) + nArray.push({name:"_GradientGlow_distance", value:GradientGlowFilter(p_value).distance}); + nArray.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(p_value).knockout}); + nArray.push({name:"_GradientGlow_quality", value:GradientGlowFilter(p_value).quality}); + // .ratios(array) + nArray.push({name:"_GradientGlow_strength", value:GradientGlowFilter(p_value).strength}); + nArray.push({name:"_GradientGlow_type", value:GradientGlowFilter(p_value).type}); + } else { + // ? + trace ("Tweener FilterShortcuts Error :: Unknown filter class used"); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // filters + + /** + * (filters) + * Generic function for the properties of filter objects + */ + public static function _filter_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + var f:Array = p_obj.filters; + var i:Number; + var filterClass:Object = p_parameters[0]; + var propertyName:String = p_parameters[1]; + var splitType:String = p_parameters[2]; + for (i = 0; i < f.length; i++) { + if (f[i] is Class(filterClass)) { + if (splitType == "color") { + // Composite, color channel + var colorComponent:String = p_parameters[3]; + if (colorComponent == "r") return AuxFunctions.numberToR(f[i][propertyName]); + if (colorComponent == "g") return AuxFunctions.numberToG(f[i][propertyName]); + if (colorComponent == "b") return AuxFunctions.numberToB(f[i][propertyName]); + } else if (splitType == "matrix") { + // Composite, some kind of matrix + return f[i][propertyName][p_parameters[3]]; + } else { + // Standard property + return (f[i][propertyName]); + } + } + } + + // No value found for this property - no filter instance found using this class! + // Must return default desired values + var defaultValues:Object; + switch (filterClass) { + case BevelFilter: + defaultValues = {angle:NaN, blurX:0, blurY:0, distance:0, highlightAlpha:1, highlightColor:NaN, knockout:null, quality:NaN, shadowAlpha:1, shadowColor:NaN, strength:2, type:null}; + break; + case BlurFilter: + defaultValues = {blurX:0, blurY:0, quality:NaN}; + break; + case ColorMatrixFilter: + defaultValues = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]}; + break; + case ConvolutionFilter: + defaultValues = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null}; + break; + case DisplacementMapFilter: + defaultValues = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0}; + break; + case DropShadowFilter: + defaultValues = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null}; + break; + case GlowFilter: + defaultValues = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2}; + break; + case GradientBevelFilter: + defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; + break; + case GradientGlowFilter: + defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; + break; + } + // When returning NaN, the Tweener engine sets the starting value as being the same as the final value (if not found) + // When returning null, the Tweener engine doesn't tween it at all, just setting it to the final value + // This is DIFFERENT from the default filter applied as default on _filter_property_set because some values shouldn't be tweened + if (splitType == "color") { + // Composite, color channel; always defaults to target value + return NaN; + } else if (splitType == "matrix") { + // Composite, matrix; always defaults to target value + return defaultValues[propertyName][p_parameters[3]]; + } else { + // Standard property + return defaultValues[propertyName]; + } + } + + public static function _filter_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var f:Array = p_obj.filters; + var i:Number; + var filterClass:Object = p_parameters[0]; + var propertyName:String = p_parameters[1]; + var splitType:String = p_parameters[2]; + for (i = 0; i < f.length; i++) { + if (f[i] is Class(filterClass)) { + if (splitType == "color") { + // Composite, color channel + var colorComponent:String = p_parameters[3]; + if (colorComponent == "r") f[i][propertyName] = (f[i][propertyName] & 0xffff) | (p_value << 16); + if (colorComponent == "g") f[i][propertyName] = (f[i][propertyName] & 0xff00ff) | (p_value << 8); + if (colorComponent == "b") f[i][propertyName] = (f[i][propertyName] & 0xffff00) | p_value; + } else if (splitType == "matrix") { + var mtx:Array = f[i][propertyName]; + mtx[p_parameters[3]] = p_value; + f[i][propertyName] = mtx; + } else { + // Standard property + f[i][propertyName] = p_value; + } + p_obj.filters = f; + return; + } + } + + // The correct filter class wasn't found, so create a new one that is the equivalent of the object without the filter + if (f == null) f = new Array(); + var fi:BitmapFilter; + switch (filterClass) { + case BevelFilter: + fi = new BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0); + break; + case BlurFilter: + fi = new BlurFilter(0, 0); + break; + case ColorMatrixFilter: + fi = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]); + break; + case ConvolutionFilter: + fi = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0x000000, 0); + break; + case DisplacementMapFilter: + // Doesn't make much sense to create a new empty DisplacementMapFilter if there's nothing to tween + fi = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0); + break; + case DropShadowFilter: + fi = new DropShadowFilter(0, 45, 0x000000, 1, 0, 0); + break; + case GlowFilter: + fi = new GlowFilter(0xff0000, 1, 0, 0); + break; + case GradientBevelFilter: + fi = new GradientBevelFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0); + break; + case GradientGlowFilter: + fi = new GradientGlowFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0); + break; + } + //fi[propertyName] = p_value; + f.push(fi); + p_obj.filters = f; + _filter_property_set(p_obj, p_value, p_parameters); + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as new file mode 100644 index 0000000000..6e8b8a70a8 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as @@ -0,0 +1,93 @@ +package caurina.transitions.properties { + + /** + * properties.SoundShortcuts + * List of default special properties for Sounds + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.media.SoundTransform; + + import caurina.transitions.Tweener; + + public class SoundShortcuts { + + /** + * There's no constructor. + */ + public function SoundShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init():void { + + // Normal properties + Tweener.registerSpecialProperty("_sound_volume", _sound_volume_get, _sound_volume_set); + Tweener.registerSpecialProperty("_sound_pan", _sound_pan_get, _sound_pan_set); + + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _sound_volume + + /** + * Returns the current sound volume + * + * @param p_obj Object SoundChannel object + * @return Number The current volume + */ + public static function _sound_volume_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.soundTransform.volume; + } + + /** + * Sets the sound volume + * + * @param p_obj Object SoundChannel object + * @param p_value Number New volume + */ + public static function _sound_volume_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void { + var sndTransform:SoundTransform = p_obj.soundTransform; + sndTransform.volume = p_value; + p_obj.soundTransform = sndTransform; + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _sound_pan + + /** + * Returns the current sound pan + * + * @param p_obj Object SoundChannel object + * @return Number The current pan + */ + public static function _sound_pan_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.soundTransform.pan; + } + + /** + * Sets the sound volume + * + * @param p_obj Object SoundChannel object + * @param p_value Number New pan + */ + public static function _sound_pan_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void { + var sndTransform:SoundTransform = p_obj.soundTransform; + sndTransform.pan = p_value; + p_obj.soundTransform = sndTransform; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as new file mode 100644 index 0000000000..6d8f3f88a3 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as @@ -0,0 +1,157 @@ +package caurina.transitions.properties { + + /** + * properties.TextShortcuts + * Special properties for the Tweener class to handle MovieClip filters + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + import flash.text.TextFormat; + + public class TextShortcuts { + + /** + * There's no constructor. + */ + public function TextShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + // Normal properties + Tweener.registerSpecialProperty("_text", _text_get, _text_set, null, _text_preProcess); + // Tweener.registerSpecialPropertyModifier("_text", _text_modifier, _text_get); + + // TextFormat-based properties + Tweener.registerSpecialPropertySplitter("_text_color", _generic_color_splitter, ["_text_color_r", "_text_color_g", "_text_color_b"]); + Tweener.registerSpecialProperty("_text_color_r", _textFormat_property_get, _textFormat_property_set, ["color", true, "r"]); + Tweener.registerSpecialProperty("_text_color_g", _textFormat_property_get, _textFormat_property_set, ["color", true, "g"]); + Tweener.registerSpecialProperty("_text_color_b", _textFormat_property_get, _textFormat_property_set, ["color", true, "b"]); + Tweener.registerSpecialProperty("_text_indent", _textFormat_property_get, _textFormat_property_set, ["indent"]); + Tweener.registerSpecialProperty("_text_leading", _textFormat_property_get, _textFormat_property_set, ["leading"]); + Tweener.registerSpecialProperty("_text_leftMargin", _textFormat_property_get, _textFormat_property_set, ["leftMargin"]); + Tweener.registerSpecialProperty("_text_letterSpacing", _textFormat_property_get, _textFormat_property_set, ["letterSpacing"]); + Tweener.registerSpecialProperty("_text_rightMargin", _textFormat_property_get, _textFormat_property_set, ["rightMargin"]); + Tweener.registerSpecialProperty("_text_size", _textFormat_property_get, _textFormat_property_set, ["size"]); + + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _text + + /** + * Returns the current frame number from the movieclip timeline + * + * @param p_obj Object MovieClip object + * @return Number The current frame + */ + public static function _text_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + //return p_obj._currentFrame; + return -p_obj.text.length; + } + + /** + * Sets the timeline frame + * + * @param p_obj Object MovieClip object + * @param p_value Number New frame number + */ + public static function _text_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + //p_obj.gotoAndStop(Math.round(p_value)); + //p_obj.text = + if (p_value < 0) { + // Old text + p_obj.text = p_extra.oldText.substr(0, -Math.round(p_value)); + } else { + // New text + p_obj.text = p_extra.newText.substr(0, Math.round(p_value)); + } + } + + public static function _text_preProcess (p_obj:Object, p_parameters:Array, p_originalValueComplete:Object, p_extra:Object): Number { + p_extra.oldText = p_obj.text; + p_extra.newText = p_originalValueComplete; + return p_extra.newText.length; + } + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // generic splitters + + /** + * A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array { + var nArray:Array = new Array(); + nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)}); + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + /** + * Generic function for the textformat properties + */ + public static function _textFormat_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + var fmt:TextFormat = p_obj.getTextFormat(); + var propertyName:String = p_parameters[0]; + var isColor:Boolean = p_parameters[1]; + if (!isColor) { + // Standard property + return (fmt[propertyName]); + } else { + // Composite, color channel + var colorComponent:String = p_parameters[2]; + if (colorComponent == "r") return AuxFunctions.numberToR(fmt[propertyName]); + if (colorComponent == "g") return AuxFunctions.numberToG(fmt[propertyName]); + if (colorComponent == "b") return AuxFunctions.numberToB(fmt[propertyName]); + } + + return NaN; + } + + public static function _textFormat_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var fmt:TextFormat = p_obj.getTextFormat(); + var propertyName:String = p_parameters[0]; + var isColor:Boolean = p_parameters[1]; + if (!isColor) { + // Standard property + fmt[propertyName] = p_value; + } else { + // Composite, color channel + var colorComponent:String = p_parameters[2]; + if (colorComponent == "r") fmt[propertyName] = (fmt[propertyName] & 0xffff) | (p_value << 16); + if (colorComponent == "g") fmt[propertyName] = (fmt[propertyName] & 0xff00ff) | (p_value << 8); + if (colorComponent == "b") fmt[propertyName] = (fmt[propertyName] & 0xffff00) | p_value; + } + + p_obj.defaultTextFormat = fmt; + p_obj.setTextFormat(fmt); + + } + + } + +} diff --git a/flash/ImageDisplayx1/homelink.fla b/flash/ImageDisplayx1/homelink.fla new file mode 100644 index 0000000000..1ff11afc97 Binary files /dev/null and b/flash/ImageDisplayx1/homelink.fla differ diff --git a/flash/ImageScroll/.actionScriptProperties b/flash/ImageScroll/.actionScriptProperties new file mode 100644 index 0000000000..97343923cf --- /dev/null +++ b/flash/ImageScroll/.actionScriptProperties @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/flash/ImageScroll/.flexProperties b/flash/ImageScroll/.flexProperties new file mode 100644 index 0000000000..f207211255 --- /dev/null +++ b/flash/ImageScroll/.flexProperties @@ -0,0 +1,2 @@ + + diff --git a/flash/ImageScroll/.project b/flash/ImageScroll/.project new file mode 100644 index 0000000000..b8b46881c9 --- /dev/null +++ b/flash/ImageScroll/.project @@ -0,0 +1,18 @@ + + + ImageScroll + + + + + + com.adobe.flexbuilder.project.flexbuilder + + + + + + com.adobe.flexbuilder.project.flexnature + com.adobe.flexbuilder.project.actionscriptnature + + diff --git a/flash/ImageScroll/bin-debug/AC_OETags.js b/flash/ImageScroll/bin-debug/AC_OETags.js new file mode 100644 index 0000000000..ba5d24aac3 --- /dev/null +++ b/flash/ImageScroll/bin-debug/AC_OETags.js @@ -0,0 +1,292 @@ +// Flash Player Version Detection - Rev 1.6 +// Detect Client Browser type +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved. +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } else if (versionRevision[0] == "b") { + versionRevision = versionRevision.substring(1); + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + var qIndex = src.indexOf('?'); + if ( qIndex != -1) + { + // Add the extention (if needed) before the query params + var path = src.substring(0, qIndex); + if (path.length >= ext.length && path.lastIndexOf(ext) == (path.length - ext.length)) + return src; + else + return src.replace(/\?/, ext+'?'); + } + else + { + // Add the extension (if needed) to the end of the URL + if (src.length >= ext.length && src.lastIndexOf(ext) == (src.length - ext.length)) + return src; // Already have extension + else + return src + ext; + } +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + str += ''; + } else { + str += ' + + + + + + + + + + + + + + + + + + + + +
+

+ To view this page ensure that Adobe Flash Player version + 10.0.0 or greater is installed. +

+ +
+ + + + diff --git a/flash/ImageScroll/bin-debug/ImageScroll.swf b/flash/ImageScroll/bin-debug/ImageScroll.swf new file mode 100644 index 0000000000..d4d22e8c45 Binary files /dev/null and b/flash/ImageScroll/bin-debug/ImageScroll.swf differ diff --git a/flash/ImageScroll/bin-debug/assets/main.css b/flash/ImageScroll/bin-debug/assets/main.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/flash/ImageScroll/bin-debug/framework_4.0.0.14159.swf b/flash/ImageScroll/bin-debug/framework_4.0.0.14159.swf new file mode 100644 index 0000000000..c2a7bb13f8 Binary files /dev/null and b/flash/ImageScroll/bin-debug/framework_4.0.0.14159.swf differ diff --git a/flash/ImageScroll/bin-debug/history/history.css b/flash/ImageScroll/bin-debug/history/history.css new file mode 100644 index 0000000000..dbc47c61b9 --- /dev/null +++ b/flash/ImageScroll/bin-debug/history/history.css @@ -0,0 +1,6 @@ +/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ + +#ie_historyFrame { width: 0px; height: 0px; display:none } +#firefox_anchorDiv { width: 0px; height: 0px; display:none } +#safari_formDiv { width: 0px; height: 0px; display:none } +#safari_rememberDiv { width: 0px; height: 0px; display:none } diff --git a/flash/ImageScroll/bin-debug/history/history.js b/flash/ImageScroll/bin-debug/history/history.js new file mode 100644 index 0000000000..b56be2f338 --- /dev/null +++ b/flash/ImageScroll/bin-debug/history/history.js @@ -0,0 +1,710 @@ +BrowserHistoryUtils = { + addEvent: function(elm, evType, fn, useCapture) { + useCapture = useCapture || false; + if (elm.addEventListener) { + elm.addEventListener(evType, fn, useCapture); + return true; + } + else if (elm.attachEvent) { + var r = elm.attachEvent('on' + evType, fn); + return r; + } + else { + elm['on' + evType] = fn; + } + } +} + +BrowserHistory = (function() { + // type of browser + var browser = { + ie: false, + ie8: false, + firefox: false, + safari: false, + opera: false, + version: -1 + }; + + // if setDefaultURL has been called, our first clue + // that the SWF is ready and listening + //var swfReady = false; + + // the URL we'll send to the SWF once it is ready + //var pendingURL = ''; + + // Default app state URL to use when no fragment ID present + var defaultHash = ''; + + // Last-known app state URL + var currentHref = document.location.href; + + // Initial URL (used only by IE) + var initialHref = document.location.href; + + // Initial URL (used only by IE) + var initialHash = document.location.hash; + + // History frame source URL prefix (used only by IE) + var historyFrameSourcePrefix = 'history/historyFrame.html?'; + + // History maintenance (used only by Safari) + var currentHistoryLength = -1; + + var historyHash = []; + + var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash); + + var backStack = []; + var forwardStack = []; + + var currentObjectId = null; + + //UserAgent detection + var useragent = navigator.userAgent.toLowerCase(); + + if (useragent.indexOf("opera") != -1) { + browser.opera = true; + } else if (useragent.indexOf("msie") != -1) { + browser.ie = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4)); + if (browser.version == 8) + { + browser.ie = false; + browser.ie8 = true; + } + } else if (useragent.indexOf("safari") != -1) { + browser.safari = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7)); + } else if (useragent.indexOf("gecko") != -1) { + browser.firefox = true; + } + + if (browser.ie == true && browser.version == 7) { + window["_ie_firstload"] = false; + } + + function hashChangeHandler() + { + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + + // Accessor functions for obtaining specific elements of the page. + function getHistoryFrame() + { + return document.getElementById('ie_historyFrame'); + } + + function getAnchorElement() + { + return document.getElementById('firefox_anchorDiv'); + } + + function getFormElement() + { + return document.getElementById('safari_formDiv'); + } + + function getRememberElement() + { + return document.getElementById("safari_remember_field"); + } + + // Get the Flash player object for performing ExternalInterface callbacks. + // Updated for changes to SWFObject2. + function getPlayer(id) { + var i; + + if (id && document.getElementById(id)) { + var r = document.getElementById(id); + if (typeof r.SetVariable != "undefined") { + return r; + } + else { + var o = r.getElementsByTagName("object"); + var e = r.getElementsByTagName("embed"); + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + return o[i]; + } + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + return e[i]; + } + } + } + else { + var o = document.getElementsByTagName("object"); + var e = document.getElementsByTagName("embed"); + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + { + return e[i]; + } + } + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + { + return o[i]; + } + } + } + return undefined; + } + + function getPlayers() { + var i; + var players = []; + if (players.length == 0) { + var tmp = document.getElementsByTagName('object'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + if (players.length == 0 || players[0].object == null) { + var tmp = document.getElementsByTagName('embed'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + return players; + } + + function getIframeHash() { + var doc = getHistoryFrame().contentWindow.document; + var hash = String(doc.location.search); + if (hash.length == 1 && hash.charAt(0) == "?") { + hash = ""; + } + else if (hash.length >= 2 && hash.charAt(0) == "?") { + hash = hash.substring(1); + } + return hash; + } + + /* Get the current location hash excluding the '#' symbol. */ + function getHash() { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + var idx = document.location.href.indexOf('#'); + return (idx >= 0) ? document.location.href.substr(idx+1) : ''; + } + + /* Get the current location hash excluding the '#' symbol. */ + function setHash(hash) { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + if (hash == '') hash = '#' + document.location.hash = hash; + } + + function createState(baseUrl, newUrl, flexAppUrl) { + return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null }; + } + + /* Add a history entry to the browser. + * baseUrl: the portion of the location prior to the '#' + * newUrl: the entire new URL, including '#' and following fragment + * flexAppUrl: the portion of the location following the '#' only + */ + function addHistoryEntry(baseUrl, newUrl, flexAppUrl) { + + //delete all the history entries + forwardStack = []; + + if (browser.ie) { + //Check to see if we are being asked to do a navigate for the first + //history entry, and if so ignore, because it's coming from the creation + //of the history iframe + if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) { + currentHref = initialHref; + return; + } + if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) { + newUrl = baseUrl + '#' + defaultHash; + flexAppUrl = defaultHash; + } else { + // for IE, tell the history frame to go somewhere without a '#' + // in order to get this entry into the browser history. + getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl; + } + setHash(flexAppUrl); + } else { + + //ADR + if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) { + initialState = createState(baseUrl, newUrl, flexAppUrl); + } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) { + backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl); + } + + if (browser.safari) { + // for Safari, submit a form whose action points to the desired URL + if (browser.version <= 419.3) { + var file = window.location.pathname.toString(); + file = file.substring(file.lastIndexOf("/")+1); + getFormElement().innerHTML = '
'; + //get the current elements and add them to the form + var qs = window.location.search.substring(1); + var qs_arr = qs.split("&"); + for (var i = 0; i < qs_arr.length; i++) { + var tmp = qs_arr[i].split("="); + var elem = document.createElement("input"); + elem.type = "hidden"; + elem.name = tmp[0]; + elem.value = tmp[1]; + document.forms.historyForm.appendChild(elem); + } + document.forms.historyForm.submit(); + } else { + top.location.hash = flexAppUrl; + } + // We also have to maintain the history by hand for Safari + historyHash[history.length] = flexAppUrl; + _storeStates(); + } else { + // Otherwise, write an anchor into the page and tell the browser to go there + addAnchor(flexAppUrl); + setHash(flexAppUrl); + + // For IE8 we must restore full focus/activation to our invoking player instance. + if (browser.ie8) + getPlayer().focus(); + } + } + backStack.push(createState(baseUrl, newUrl, flexAppUrl)); + } + + function _storeStates() { + if (browser.safari) { + getRememberElement().value = historyHash.join(","); + } + } + + function handleBackButton() { + //The "current" page is always at the top of the history stack. + var current = backStack.pop(); + if (!current) { return; } + var last = backStack[backStack.length - 1]; + if (!last && backStack.length == 0){ + last = initialState; + } + forwardStack.push(current); + } + + function handleForwardButton() { + //summary: private method. Do not call this directly. + + var last = forwardStack.pop(); + if (!last) { return; } + backStack.push(last); + } + + function handleArbitraryUrl() { + //delete all the history entries + forwardStack = []; + } + + /* Called periodically to poll to see if we need to detect navigation that has occurred */ + function checkForUrlChange() { + + if (browser.ie) { + if (currentHref != document.location.href && currentHref + '#' != document.location.href) { + //This occurs when the user has navigated to a specific URL + //within the app, and didn't use browser back/forward + //IE seems to have a bug where it stops updating the URL it + //shows the end-user at this point, but programatically it + //appears to be correct. Do a full app reload to get around + //this issue. + if (browser.version < 7) { + currentHref = document.location.href; + document.location.reload(); + } else { + if (getHash() != getIframeHash()) { + // this.iframe.src = this.blankURL + hash; + var sourceToSet = historyFrameSourcePrefix + getHash(); + getHistoryFrame().src = sourceToSet; + currentHref = document.location.href; + } + } + } + } + + if (browser.safari) { + // For Safari, we have to check to see if history.length changed. + if (currentHistoryLength >= 0 && history.length != currentHistoryLength) { + //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|")); + var flexAppUrl = getHash(); + if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */) + { + // If it did change and we're running Safari 3.x or earlier, + // then we have to look the old state up in our hand-maintained + // array since document.location.hash won't have changed, + // then call back into BrowserManager. + currentHistoryLength = history.length; + flexAppUrl = historyHash[currentHistoryLength]; + } + + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + _storeStates(); + } + } + if (browser.firefox) { + if (currentHref != document.location.href) { + var bsl = backStack.length; + + var urlActions = { + back: false, + forward: false, + set: false + } + + if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) { + urlActions.back = true; + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + handleBackButton(); + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if (forwardStack.length > 0) { + if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) { + urlActions.forward = true; + handleForwardButton(); + } + } + + // ok, that didn't work, try someplace back in the history stack + if ((bsl >= 2) && (backStack[bsl - 2])) { + if (backStack[bsl - 2].flexAppUrl == getHash()) { + urlActions.back = true; + handleBackButton(); + } + } + + if (!urlActions.back && !urlActions.forward) { + var foundInStacks = { + back: -1, + forward: -1 + } + + for (var i = 0; i < backStack.length; i++) { + if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.back = i; + } + } + for (var i = 0; i < forwardStack.length; i++) { + if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.forward = i; + } + } + handleArbitraryUrl(); + } + + // Firefox changed; do a callback into BrowserManager to tell it. + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + } + //setTimeout(checkForUrlChange, 50); + } + + /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */ + function addAnchor(flexAppUrl) + { + if (document.getElementsByName(flexAppUrl).length == 0) { + getAnchorElement().innerHTML += "" + flexAppUrl + ""; + } + } + + var _initialize = function () { + if (browser.ie) + { + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html"); + } + } + historyFrameSourcePrefix = iframe_location + "?"; + var src = historyFrameSourcePrefix; + + var iframe = document.createElement("iframe"); + iframe.id = 'ie_historyFrame'; + iframe.name = 'ie_historyFrame'; + iframe.src = 'javascript:false;'; + + try { + document.body.appendChild(iframe); + } catch(e) { + setTimeout(function() { + document.body.appendChild(iframe); + }, 0); + } + } + + if (browser.safari) + { + var rememberDiv = document.createElement("div"); + rememberDiv.id = 'safari_rememberDiv'; + document.body.appendChild(rememberDiv); + rememberDiv.innerHTML = ''; + + var formDiv = document.createElement("div"); + formDiv.id = 'safari_formDiv'; + document.body.appendChild(formDiv); + + var reloader_content = document.createElement('div'); + reloader_content.id = 'safarireloader'; + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + html = (new String(s.src)).replace(".js", ".html"); + } + } + reloader_content.innerHTML = ''; + document.body.appendChild(reloader_content); + reloader_content.style.position = 'absolute'; + reloader_content.style.left = reloader_content.style.top = '-9999px'; + iframe = reloader_content.getElementsByTagName('iframe')[0]; + + if (document.getElementById("safari_remember_field").value != "" ) { + historyHash = document.getElementById("safari_remember_field").value.split(","); + } + + } + + if (browser.firefox || browser.ie8) + { + var anchorDiv = document.createElement("div"); + anchorDiv.id = 'firefox_anchorDiv'; + document.body.appendChild(anchorDiv); + } + + if (browser.ie8) + document.body.onhashchange = hashChangeHandler; + //setTimeout(checkForUrlChange, 50); + } + + return { + historyHash: historyHash, + backStack: function() { return backStack; }, + forwardStack: function() { return forwardStack }, + getPlayer: getPlayer, + initialize: function(src) { + _initialize(src); + }, + setURL: function(url) { + document.location.href = url; + }, + getURL: function() { + return document.location.href; + }, + getTitle: function() { + return document.title; + }, + setTitle: function(title) { + try { + backStack[backStack.length - 1].title = title; + } catch(e) { } + //if on safari, set the title to be the empty string. + if (browser.safari) { + if (title == "") { + try { + var tmp = window.location.href.toString(); + title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#")); + } catch(e) { + title = ""; + } + } + } + document.title = title; + }, + setDefaultURL: function(def) + { + defaultHash = def; + def = getHash(); + //trailing ? is important else an extra frame gets added to the history + //when navigating back to the first page. Alternatively could check + //in history frame navigation to compare # and ?. + if (browser.ie) + { + window['_ie_firstload'] = true; + var sourceToSet = historyFrameSourcePrefix + def; + var func = function() { + getHistoryFrame().src = sourceToSet; + window.location.replace("#" + def); + setInterval(checkForUrlChange, 50); + } + try { + func(); + } catch(e) { + window.setTimeout(function() { func(); }, 0); + } + } + + if (browser.safari) + { + currentHistoryLength = history.length; + if (historyHash.length == 0) { + historyHash[currentHistoryLength] = def; + var newloc = "#" + def; + window.location.replace(newloc); + } else { + //alert(historyHash[historyHash.length-1]); + } + //setHash(def); + setInterval(checkForUrlChange, 50); + } + + + if (browser.firefox || browser.opera) + { + var reg = new RegExp("#" + def + "$"); + if (window.location.toString().match(reg)) { + } else { + var newloc ="#" + def; + window.location.replace(newloc); + } + setInterval(checkForUrlChange, 50); + //setHash(def); + } + + }, + + /* Set the current browser URL; called from inside BrowserManager to propagate + * the application state out to the container. + */ + setBrowserURL: function(flexAppUrl, objectId) { + if (browser.ie && typeof objectId != "undefined") { + currentObjectId = objectId; + } + //fromIframe = fromIframe || false; + //fromFlex = fromFlex || false; + //alert("setBrowserURL: " + flexAppUrl); + //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ; + + var pos = document.location.href.indexOf('#'); + var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href; + var newUrl = baseUrl + '#' + flexAppUrl; + + if (document.location.href != newUrl && document.location.href + '#' != newUrl) { + currentHref = newUrl; + addHistoryEntry(baseUrl, newUrl, flexAppUrl); + currentHistoryLength = history.length; + } + }, + + browserURLChange: function(flexAppUrl) { + var objectId = null; + if (browser.ie && currentObjectId != null) { + objectId = currentObjectId; + } + pendingURL = ''; + + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + try { + pl[i].browserURLChange(flexAppUrl); + } catch(e) { } + } + } else { + try { + getPlayer(objectId).browserURLChange(flexAppUrl); + } catch(e) { } + } + + currentObjectId = null; + }, + getUserAgent: function() { + return navigator.userAgent; + }, + getPlatform: function() { + return navigator.platform; + } + + } + +})(); + +// Initialization + +// Automated unit testing and other diagnostics + +function setURL(url) +{ + document.location.href = url; +} + +function backButton() +{ + history.back(); +} + +function forwardButton() +{ + history.forward(); +} + +function goForwardOrBackInHistory(step) +{ + history.go(step); +} + +//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); }); +(function(i) { + var u =navigator.userAgent;var e=/*@cc_on!@*/false; + var st = setTimeout; + if(/webkit/i.test(u)){ + st(function(){ + var dr=document.readyState; + if(dr=="loaded"||dr=="complete"){i()} + else{st(arguments.callee,10);}},10); + } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){ + document.addEventListener("DOMContentLoaded",i,false); + } else if(e){ + (function(){ + var t=document.createElement('doc:rdy'); + try{t.doScroll('left'); + i();t=null; + }catch(e){st(arguments.callee,0);}})(); + } else{ + window.onload=i; + } +})( function() {BrowserHistory.initialize();} ); diff --git a/flash/ImageScroll/bin-debug/history/historyFrame.html b/flash/ImageScroll/bin-debug/history/historyFrame.html new file mode 100644 index 0000000000..07e3806f0e --- /dev/null +++ b/flash/ImageScroll/bin-debug/history/historyFrame.html @@ -0,0 +1,29 @@ + + + + + + + + Hidden frame for Browser History support. + + diff --git a/flash/ImageScroll/bin-debug/osmf_flex.4.0.0.13495.swf b/flash/ImageScroll/bin-debug/osmf_flex.4.0.0.13495.swf new file mode 100644 index 0000000000..af1cef7a3c Binary files /dev/null and b/flash/ImageScroll/bin-debug/osmf_flex.4.0.0.13495.swf differ diff --git a/flash/ImageScroll/bin-debug/playerProductInstall.swf b/flash/ImageScroll/bin-debug/playerProductInstall.swf new file mode 100644 index 0000000000..bdc3437856 Binary files /dev/null and b/flash/ImageScroll/bin-debug/playerProductInstall.swf differ diff --git a/flash/ImageScroll/bin-debug/rpc_4.0.0.14159.swf b/flash/ImageScroll/bin-debug/rpc_4.0.0.14159.swf new file mode 100644 index 0000000000..28af28b216 Binary files /dev/null and b/flash/ImageScroll/bin-debug/rpc_4.0.0.14159.swf differ diff --git a/flash/ImageScroll/bin-debug/spark_4.0.0.14159.swf b/flash/ImageScroll/bin-debug/spark_4.0.0.14159.swf new file mode 100644 index 0000000000..8f497c2323 Binary files /dev/null and b/flash/ImageScroll/bin-debug/spark_4.0.0.14159.swf differ diff --git a/flash/ImageScroll/bin-debug/sparkskins_4.0.0.14159.swf b/flash/ImageScroll/bin-debug/sparkskins_4.0.0.14159.swf new file mode 100644 index 0000000000..81e2da2a59 Binary files /dev/null and b/flash/ImageScroll/bin-debug/sparkskins_4.0.0.14159.swf differ diff --git a/flash/ImageScroll/bin-debug/swfobject.js b/flash/ImageScroll/bin-debug/swfobject.js new file mode 100644 index 0000000000..bf35c07c8f --- /dev/null +++ b/flash/ImageScroll/bin-debug/swfobject.js @@ -0,0 +1,777 @@ +/*! SWFObject v2.2 + is released under the MIT License +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + ON_READY_STATE_CHANGE = "onreadystatechange", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + domLoadFnArr = [main], + regObjArr = [], + objIdArr = [], + listenersArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + isDomLoaded = false, + isExpressInstallActive = false, + dynamicStylesheet, + dynamicStylesheetMedia, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }(), + + /* Cross-browser onDomLoad + - Will fire an event as soon as the DOM of a web page is loaded + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ + - Regular onload serves as fallback + */ + onDomLoad = function() { + if (!ua.w3) { return; } + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically + callDomLoadFunctions(); + } + if (!isDomLoaded) { + if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); + } + if (ua.ie && ua.win) { + doc.attachEvent(ON_READY_STATE_CHANGE, function() { + if (doc.readyState == "complete") { + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); + callDomLoadFunctions(); + } + }); + if (win == top) { // if not inside an iframe + (function(){ + if (isDomLoaded) { return; } + try { + doc.documentElement.doScroll("left"); + } + catch(e) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + } + if (ua.wk) { + (function(){ + if (isDomLoaded) { return; } + if (!/loaded|complete/.test(doc.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + addLoadEvent(callDomLoadFunctions); + } + }(); + + function callDomLoadFunctions() { + if (isDomLoaded) { return; } + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); + t.parentNode.removeChild(t); + } + catch (e) { return; } + isDomLoaded = true; + var dl = domLoadFnArr.length; + for (var i = 0; i < dl; i++) { + domLoadFnArr[i](); + } + } + + function addDomLoadEvent(fn) { + if (isDomLoaded) { + fn(); + } + else { + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ + } + } + + /* Cross-browser onload + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ + - Will fire an event as soon as a web page including all of its assets are loaded + */ + function addLoadEvent(fn) { + if (typeof win.addEventListener != UNDEF) { + win.addEventListener("load", fn, false); + } + else if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("load", fn, false); + } + else if (typeof win.attachEvent != UNDEF) { + addListener(win, "onload", fn); + } + else if (typeof win.onload == "function") { + var fnOld = win.onload; + win.onload = function() { + fnOld(); + fn(); + }; + } + else { + win.onload = fn; + } + } + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { + testPlayerVersion(); + } + else { + matchVersions(); + } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + /* Perform Flash Player and SWF version matching; static publishing only + */ + function matchVersions() { + var rl = regObjArr.length; + if (rl > 0) { + for (var i = 0; i < rl; i++) { // for each registered object element + var id = regObjArr[i].id; + var cb = regObjArr[i].callbackFn; + var cbObj = {success:false, id:id}; + if (ua.pv[0] > 0) { + var obj = getElementById(id); + if (obj) { + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! + setVisibility(id, true); + if (cb) { + cbObj.success = true; + cbObj.ref = getObjectById(id); + cb(cbObj); + } + } + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported + var att = {}; + att.data = regObjArr[i].expressInstall; + att.width = obj.getAttribute("width") || "0"; + att.height = obj.getAttribute("height") || "0"; + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } + // parse HTML object param element's name-value pairs + var par = {}; + var p = obj.getElementsByTagName("param"); + var pl = p.length; + for (var j = 0; j < pl; j++) { + if (p[j].getAttribute("name").toLowerCase() != "movie") { + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); + } + } + showExpressInstall(att, par, id, cb); + } + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF + displayAltContent(obj); + if (cb) { cb(cbObj); } + } + } + } + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) + setVisibility(id, true); + if (cb) { + var o = getObjectById(id); // test whether there is an HTML object element or not + if (o && typeof o.SetVariable != UNDEF) { + cbObj.success = true; + cbObj.ref = o; + } + cb(cbObj); + } + } + } + } + } + + function getObjectById(objectIdStr) { + var r = null; + var o = getElementById(objectIdStr); + if (o && o.nodeName == "OBJECT") { + if (typeof o.SetVariable != UNDEF) { + r = o; + } + else { + var n = o.getElementsByTagName(OBJECT)[0]; + if (n) { + r = n; + } + } + } + return r; + } + + /* Requirements for Adobe Express Install + - only one instance can be active at a time + - fp 6.0.65 or higher + - Win/Mac OS only + - no Webkit engines older than version 312 + */ + function canExpressInstall() { + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); + } + + /* Show the Adobe Express Install dialog + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 + */ + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { + isExpressInstallActive = true; + storedCallbackFn = callbackFn || null; + storedCallbackObj = {success:false, id:replaceElemIdStr}; + var obj = getElementById(replaceElemIdStr); + if (obj) { + if (obj.nodeName == "OBJECT") { // static publishing + storedAltContent = abstractAltContent(obj); + storedAltContentId = null; + } + else { // dynamic publishing + storedAltContent = obj; + storedAltContentId = replaceElemIdStr; + } + att.id = EXPRESS_INSTALL_ID; + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + fv; + } + else { + par.flashvars = fv; + } + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + if (ua.ie && ua.win && obj.readyState != 4) { + var newObj = createElement("div"); + replaceElemIdStr += "SWFObjectNew"; + newObj.setAttribute("id", replaceElemIdStr); + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + createSWF(att, par, replaceElemIdStr); + } + } + + /* Functions to abstract and display alternative content + */ + function displayAltContent(obj) { + if (ua.ie && ua.win && obj.readyState != 4) { + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + var el = createElement("div"); + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content + el.parentNode.replaceChild(abstractAltContent(obj), el); + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.replaceChild(abstractAltContent(obj), obj); + } + } + + function abstractAltContent(obj) { + var ac = createElement("div"); + if (ua.win && ua.ie) { + ac.innerHTML = obj.innerHTML; + } + else { + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; + if (nestedObj) { + var c = nestedObj.childNodes; + if (c) { + var cl = c.length; + for (var i = 0; i < cl; i++) { + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { + ac.appendChild(c[i].cloneNode(true)); + } + } + } + } + } + return ac; + } + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += ''; + } + } + el.outerHTML = '' + par + ''; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (ua.ie && ua.win) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } + } + + function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + for (var i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } + } + + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Updated attachEvent function for Internet Explorer + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks + */ + function addListener(target, eventType, fn) { + target.attachEvent(eventType, fn); + listenersArr[listenersArr.length] = [target, eventType, fn]; + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; + } + + /* Cross-browser dynamic CSS creation + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php + */ + function createCSS(sel, decl, media, newStyle) { + if (ua.ie && ua.mac) { return; } + var h = doc.getElementsByTagName("head")[0]; + if (!h) { return; } // to also support badly authored HTML pages that lack a head element + var m = (media && typeof media == "string") ? media : "screen"; + if (newStyle) { + dynamicStylesheet = null; + dynamicStylesheetMedia = null; + } + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { + // create dynamic stylesheet + get a global reference to it + var s = createElement("style"); + s.setAttribute("type", "text/css"); + s.setAttribute("media", m); + dynamicStylesheet = h.appendChild(s); + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; + } + dynamicStylesheetMedia = m; + } + // add style rule + if (ua.ie && ua.win) { + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { + dynamicStylesheet.addRule(sel, decl); + } + } + else { + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); + } + } + } + + function setVisibility(id, isVisible) { + if (!autoHideShow) { return; } + var v = isVisible ? "visible" : "hidden"; + if (isDomLoaded && getElementById(id)) { + getElementById(id).style.visibility = v; + } + else { + createCSS("#" + id, "visibility:" + v); + } + } + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) + */ + var cleanup = function() { + if (ua.ie && ua.win) { + window.attachEvent("onunload", function() { + // remove listeners to avoid memory leaks + var ll = listenersArr.length; + for (var i = 0; i < ll; i++) { + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); + } + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect + var il = objIdArr.length; + for (var j = 0; j < il; j++) { + removeSWF(objIdArr[j]); + } + // cleanup library's main closures to avoid memory leaks + for (var k in ua) { + ua[k] = null; + } + ua = null; + for (var l in swfobject) { + swfobject[l] = null; + } + swfobject = null; + }); + } + }(); + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { + if (ua.w3 && objectIdStr && swfVersionStr) { + var regObj = {}; + regObj.id = objectIdStr; + regObj.swfVersion = swfVersionStr; + regObj.expressInstall = xiSwfUrlStr; + regObj.callbackFn = callbackFn; + regObjArr[regObjArr.length] = regObj; + setVisibility(objectIdStr, false); + } + else if (callbackFn) { + callbackFn({success:false, id:objectIdStr}); + } + }, + + getObjectById: function(objectIdStr) { + if (ua.w3) { + return getObjectById(objectIdStr); + } + }, + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + setVisibility(replaceElemIdStr, false); + addDomLoadEvent(function() { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + if (att.id == replaceElemIdStr) { + setVisibility(replaceElemIdStr, true); + } + callbackObj.success = true; + callbackObj.ref = obj; + } + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install + att.data = xiSwfUrlStr; + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + return; + } + else { // show alternative content + setVisibility(replaceElemIdStr, true); + } + if (callbackFn) { callbackFn(callbackObj); } + }); + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + switchOffAutoHideShow: function() { + autoHideShow = false; + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { + if (ua.w3 && canExpressInstall()) { + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + } + }, + + removeSWF: function(objElemIdStr) { + if (ua.w3) { + removeSWF(objElemIdStr); + } + }, + + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { + if (ua.w3) { + createCSS(selStr, declStr, mediaStr, newStyleBoolean); + } + }, + + addDomLoadEvent: addDomLoadEvent, + + addLoadEvent: addLoadEvent, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + }, + + // For internal usage only + expressInstallCallback: function() { + if (isExpressInstallActive) { + var obj = getElementById(EXPRESS_INSTALL_ID); + if (obj && storedAltContent) { + obj.parentNode.replaceChild(storedAltContent, obj); + if (storedAltContentId) { + setVisibility(storedAltContentId, true); + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } + } + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } + } + isExpressInstallActive = false; + } + } + }; +}(); diff --git a/flash/ImageScroll/bin-debug/test.php b/flash/ImageScroll/bin-debug/test.php new file mode 100644 index 0000000000..186ae70706 --- /dev/null +++ b/flash/ImageScroll/bin-debug/test.php @@ -0,0 +1,42 @@ + + + + +hello + +' + + > + + + + diff --git a/flash/ImageScroll/bin-debug/textLayout_1.0.0.595.swf b/flash/ImageScroll/bin-debug/textLayout_1.0.0.595.swf new file mode 100644 index 0000000000..70c12ac31c Binary files /dev/null and b/flash/ImageScroll/bin-debug/textLayout_1.0.0.595.swf differ diff --git a/flash/ImageScroll/bin-release/AC_OETags.js b/flash/ImageScroll/bin-release/AC_OETags.js new file mode 100644 index 0000000000..ba5d24aac3 --- /dev/null +++ b/flash/ImageScroll/bin-release/AC_OETags.js @@ -0,0 +1,292 @@ +// Flash Player Version Detection - Rev 1.6 +// Detect Client Browser type +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved. +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } else if (versionRevision[0] == "b") { + versionRevision = versionRevision.substring(1); + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + var qIndex = src.indexOf('?'); + if ( qIndex != -1) + { + // Add the extention (if needed) before the query params + var path = src.substring(0, qIndex); + if (path.length >= ext.length && path.lastIndexOf(ext) == (path.length - ext.length)) + return src; + else + return src.replace(/\?/, ext+'?'); + } + else + { + // Add the extension (if needed) to the end of the URL + if (src.length >= ext.length && src.lastIndexOf(ext) == (src.length - ext.length)) + return src; // Already have extension + else + return src + ext; + } +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + str += ''; + } else { + str += ' + + + + + + + + + + + + + + + + + + + + +
+

+ To view this page ensure that Adobe Flash Player version + 10.0.0 or greater is installed. +

+ +
+ + + + diff --git a/flash/ImageScroll/bin-release/ImageScroll.swf b/flash/ImageScroll/bin-release/ImageScroll.swf new file mode 100644 index 0000000000..92be76b48f Binary files /dev/null and b/flash/ImageScroll/bin-release/ImageScroll.swf differ diff --git a/flash/ImageScroll/bin-release/assets/main.css b/flash/ImageScroll/bin-release/assets/main.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/flash/ImageScroll/bin-release/framework_4.0.0.14159.swz b/flash/ImageScroll/bin-release/framework_4.0.0.14159.swz new file mode 100644 index 0000000000..4381f2d4e4 Binary files /dev/null and b/flash/ImageScroll/bin-release/framework_4.0.0.14159.swz differ diff --git a/flash/ImageScroll/bin-release/history/history.css b/flash/ImageScroll/bin-release/history/history.css new file mode 100644 index 0000000000..dbc47c61b9 --- /dev/null +++ b/flash/ImageScroll/bin-release/history/history.css @@ -0,0 +1,6 @@ +/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ + +#ie_historyFrame { width: 0px; height: 0px; display:none } +#firefox_anchorDiv { width: 0px; height: 0px; display:none } +#safari_formDiv { width: 0px; height: 0px; display:none } +#safari_rememberDiv { width: 0px; height: 0px; display:none } diff --git a/flash/ImageScroll/bin-release/history/history.js b/flash/ImageScroll/bin-release/history/history.js new file mode 100644 index 0000000000..b56be2f338 --- /dev/null +++ b/flash/ImageScroll/bin-release/history/history.js @@ -0,0 +1,710 @@ +BrowserHistoryUtils = { + addEvent: function(elm, evType, fn, useCapture) { + useCapture = useCapture || false; + if (elm.addEventListener) { + elm.addEventListener(evType, fn, useCapture); + return true; + } + else if (elm.attachEvent) { + var r = elm.attachEvent('on' + evType, fn); + return r; + } + else { + elm['on' + evType] = fn; + } + } +} + +BrowserHistory = (function() { + // type of browser + var browser = { + ie: false, + ie8: false, + firefox: false, + safari: false, + opera: false, + version: -1 + }; + + // if setDefaultURL has been called, our first clue + // that the SWF is ready and listening + //var swfReady = false; + + // the URL we'll send to the SWF once it is ready + //var pendingURL = ''; + + // Default app state URL to use when no fragment ID present + var defaultHash = ''; + + // Last-known app state URL + var currentHref = document.location.href; + + // Initial URL (used only by IE) + var initialHref = document.location.href; + + // Initial URL (used only by IE) + var initialHash = document.location.hash; + + // History frame source URL prefix (used only by IE) + var historyFrameSourcePrefix = 'history/historyFrame.html?'; + + // History maintenance (used only by Safari) + var currentHistoryLength = -1; + + var historyHash = []; + + var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash); + + var backStack = []; + var forwardStack = []; + + var currentObjectId = null; + + //UserAgent detection + var useragent = navigator.userAgent.toLowerCase(); + + if (useragent.indexOf("opera") != -1) { + browser.opera = true; + } else if (useragent.indexOf("msie") != -1) { + browser.ie = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4)); + if (browser.version == 8) + { + browser.ie = false; + browser.ie8 = true; + } + } else if (useragent.indexOf("safari") != -1) { + browser.safari = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7)); + } else if (useragent.indexOf("gecko") != -1) { + browser.firefox = true; + } + + if (browser.ie == true && browser.version == 7) { + window["_ie_firstload"] = false; + } + + function hashChangeHandler() + { + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + + // Accessor functions for obtaining specific elements of the page. + function getHistoryFrame() + { + return document.getElementById('ie_historyFrame'); + } + + function getAnchorElement() + { + return document.getElementById('firefox_anchorDiv'); + } + + function getFormElement() + { + return document.getElementById('safari_formDiv'); + } + + function getRememberElement() + { + return document.getElementById("safari_remember_field"); + } + + // Get the Flash player object for performing ExternalInterface callbacks. + // Updated for changes to SWFObject2. + function getPlayer(id) { + var i; + + if (id && document.getElementById(id)) { + var r = document.getElementById(id); + if (typeof r.SetVariable != "undefined") { + return r; + } + else { + var o = r.getElementsByTagName("object"); + var e = r.getElementsByTagName("embed"); + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + return o[i]; + } + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + return e[i]; + } + } + } + else { + var o = document.getElementsByTagName("object"); + var e = document.getElementsByTagName("embed"); + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + { + return e[i]; + } + } + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + { + return o[i]; + } + } + } + return undefined; + } + + function getPlayers() { + var i; + var players = []; + if (players.length == 0) { + var tmp = document.getElementsByTagName('object'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + if (players.length == 0 || players[0].object == null) { + var tmp = document.getElementsByTagName('embed'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + return players; + } + + function getIframeHash() { + var doc = getHistoryFrame().contentWindow.document; + var hash = String(doc.location.search); + if (hash.length == 1 && hash.charAt(0) == "?") { + hash = ""; + } + else if (hash.length >= 2 && hash.charAt(0) == "?") { + hash = hash.substring(1); + } + return hash; + } + + /* Get the current location hash excluding the '#' symbol. */ + function getHash() { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + var idx = document.location.href.indexOf('#'); + return (idx >= 0) ? document.location.href.substr(idx+1) : ''; + } + + /* Get the current location hash excluding the '#' symbol. */ + function setHash(hash) { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + if (hash == '') hash = '#' + document.location.hash = hash; + } + + function createState(baseUrl, newUrl, flexAppUrl) { + return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null }; + } + + /* Add a history entry to the browser. + * baseUrl: the portion of the location prior to the '#' + * newUrl: the entire new URL, including '#' and following fragment + * flexAppUrl: the portion of the location following the '#' only + */ + function addHistoryEntry(baseUrl, newUrl, flexAppUrl) { + + //delete all the history entries + forwardStack = []; + + if (browser.ie) { + //Check to see if we are being asked to do a navigate for the first + //history entry, and if so ignore, because it's coming from the creation + //of the history iframe + if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) { + currentHref = initialHref; + return; + } + if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) { + newUrl = baseUrl + '#' + defaultHash; + flexAppUrl = defaultHash; + } else { + // for IE, tell the history frame to go somewhere without a '#' + // in order to get this entry into the browser history. + getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl; + } + setHash(flexAppUrl); + } else { + + //ADR + if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) { + initialState = createState(baseUrl, newUrl, flexAppUrl); + } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) { + backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl); + } + + if (browser.safari) { + // for Safari, submit a form whose action points to the desired URL + if (browser.version <= 419.3) { + var file = window.location.pathname.toString(); + file = file.substring(file.lastIndexOf("/")+1); + getFormElement().innerHTML = '
'; + //get the current elements and add them to the form + var qs = window.location.search.substring(1); + var qs_arr = qs.split("&"); + for (var i = 0; i < qs_arr.length; i++) { + var tmp = qs_arr[i].split("="); + var elem = document.createElement("input"); + elem.type = "hidden"; + elem.name = tmp[0]; + elem.value = tmp[1]; + document.forms.historyForm.appendChild(elem); + } + document.forms.historyForm.submit(); + } else { + top.location.hash = flexAppUrl; + } + // We also have to maintain the history by hand for Safari + historyHash[history.length] = flexAppUrl; + _storeStates(); + } else { + // Otherwise, write an anchor into the page and tell the browser to go there + addAnchor(flexAppUrl); + setHash(flexAppUrl); + + // For IE8 we must restore full focus/activation to our invoking player instance. + if (browser.ie8) + getPlayer().focus(); + } + } + backStack.push(createState(baseUrl, newUrl, flexAppUrl)); + } + + function _storeStates() { + if (browser.safari) { + getRememberElement().value = historyHash.join(","); + } + } + + function handleBackButton() { + //The "current" page is always at the top of the history stack. + var current = backStack.pop(); + if (!current) { return; } + var last = backStack[backStack.length - 1]; + if (!last && backStack.length == 0){ + last = initialState; + } + forwardStack.push(current); + } + + function handleForwardButton() { + //summary: private method. Do not call this directly. + + var last = forwardStack.pop(); + if (!last) { return; } + backStack.push(last); + } + + function handleArbitraryUrl() { + //delete all the history entries + forwardStack = []; + } + + /* Called periodically to poll to see if we need to detect navigation that has occurred */ + function checkForUrlChange() { + + if (browser.ie) { + if (currentHref != document.location.href && currentHref + '#' != document.location.href) { + //This occurs when the user has navigated to a specific URL + //within the app, and didn't use browser back/forward + //IE seems to have a bug where it stops updating the URL it + //shows the end-user at this point, but programatically it + //appears to be correct. Do a full app reload to get around + //this issue. + if (browser.version < 7) { + currentHref = document.location.href; + document.location.reload(); + } else { + if (getHash() != getIframeHash()) { + // this.iframe.src = this.blankURL + hash; + var sourceToSet = historyFrameSourcePrefix + getHash(); + getHistoryFrame().src = sourceToSet; + currentHref = document.location.href; + } + } + } + } + + if (browser.safari) { + // For Safari, we have to check to see if history.length changed. + if (currentHistoryLength >= 0 && history.length != currentHistoryLength) { + //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|")); + var flexAppUrl = getHash(); + if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */) + { + // If it did change and we're running Safari 3.x or earlier, + // then we have to look the old state up in our hand-maintained + // array since document.location.hash won't have changed, + // then call back into BrowserManager. + currentHistoryLength = history.length; + flexAppUrl = historyHash[currentHistoryLength]; + } + + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + _storeStates(); + } + } + if (browser.firefox) { + if (currentHref != document.location.href) { + var bsl = backStack.length; + + var urlActions = { + back: false, + forward: false, + set: false + } + + if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) { + urlActions.back = true; + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + handleBackButton(); + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if (forwardStack.length > 0) { + if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) { + urlActions.forward = true; + handleForwardButton(); + } + } + + // ok, that didn't work, try someplace back in the history stack + if ((bsl >= 2) && (backStack[bsl - 2])) { + if (backStack[bsl - 2].flexAppUrl == getHash()) { + urlActions.back = true; + handleBackButton(); + } + } + + if (!urlActions.back && !urlActions.forward) { + var foundInStacks = { + back: -1, + forward: -1 + } + + for (var i = 0; i < backStack.length; i++) { + if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.back = i; + } + } + for (var i = 0; i < forwardStack.length; i++) { + if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.forward = i; + } + } + handleArbitraryUrl(); + } + + // Firefox changed; do a callback into BrowserManager to tell it. + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + } + //setTimeout(checkForUrlChange, 50); + } + + /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */ + function addAnchor(flexAppUrl) + { + if (document.getElementsByName(flexAppUrl).length == 0) { + getAnchorElement().innerHTML += "" + flexAppUrl + ""; + } + } + + var _initialize = function () { + if (browser.ie) + { + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html"); + } + } + historyFrameSourcePrefix = iframe_location + "?"; + var src = historyFrameSourcePrefix; + + var iframe = document.createElement("iframe"); + iframe.id = 'ie_historyFrame'; + iframe.name = 'ie_historyFrame'; + iframe.src = 'javascript:false;'; + + try { + document.body.appendChild(iframe); + } catch(e) { + setTimeout(function() { + document.body.appendChild(iframe); + }, 0); + } + } + + if (browser.safari) + { + var rememberDiv = document.createElement("div"); + rememberDiv.id = 'safari_rememberDiv'; + document.body.appendChild(rememberDiv); + rememberDiv.innerHTML = ''; + + var formDiv = document.createElement("div"); + formDiv.id = 'safari_formDiv'; + document.body.appendChild(formDiv); + + var reloader_content = document.createElement('div'); + reloader_content.id = 'safarireloader'; + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + html = (new String(s.src)).replace(".js", ".html"); + } + } + reloader_content.innerHTML = ''; + document.body.appendChild(reloader_content); + reloader_content.style.position = 'absolute'; + reloader_content.style.left = reloader_content.style.top = '-9999px'; + iframe = reloader_content.getElementsByTagName('iframe')[0]; + + if (document.getElementById("safari_remember_field").value != "" ) { + historyHash = document.getElementById("safari_remember_field").value.split(","); + } + + } + + if (browser.firefox || browser.ie8) + { + var anchorDiv = document.createElement("div"); + anchorDiv.id = 'firefox_anchorDiv'; + document.body.appendChild(anchorDiv); + } + + if (browser.ie8) + document.body.onhashchange = hashChangeHandler; + //setTimeout(checkForUrlChange, 50); + } + + return { + historyHash: historyHash, + backStack: function() { return backStack; }, + forwardStack: function() { return forwardStack }, + getPlayer: getPlayer, + initialize: function(src) { + _initialize(src); + }, + setURL: function(url) { + document.location.href = url; + }, + getURL: function() { + return document.location.href; + }, + getTitle: function() { + return document.title; + }, + setTitle: function(title) { + try { + backStack[backStack.length - 1].title = title; + } catch(e) { } + //if on safari, set the title to be the empty string. + if (browser.safari) { + if (title == "") { + try { + var tmp = window.location.href.toString(); + title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#")); + } catch(e) { + title = ""; + } + } + } + document.title = title; + }, + setDefaultURL: function(def) + { + defaultHash = def; + def = getHash(); + //trailing ? is important else an extra frame gets added to the history + //when navigating back to the first page. Alternatively could check + //in history frame navigation to compare # and ?. + if (browser.ie) + { + window['_ie_firstload'] = true; + var sourceToSet = historyFrameSourcePrefix + def; + var func = function() { + getHistoryFrame().src = sourceToSet; + window.location.replace("#" + def); + setInterval(checkForUrlChange, 50); + } + try { + func(); + } catch(e) { + window.setTimeout(function() { func(); }, 0); + } + } + + if (browser.safari) + { + currentHistoryLength = history.length; + if (historyHash.length == 0) { + historyHash[currentHistoryLength] = def; + var newloc = "#" + def; + window.location.replace(newloc); + } else { + //alert(historyHash[historyHash.length-1]); + } + //setHash(def); + setInterval(checkForUrlChange, 50); + } + + + if (browser.firefox || browser.opera) + { + var reg = new RegExp("#" + def + "$"); + if (window.location.toString().match(reg)) { + } else { + var newloc ="#" + def; + window.location.replace(newloc); + } + setInterval(checkForUrlChange, 50); + //setHash(def); + } + + }, + + /* Set the current browser URL; called from inside BrowserManager to propagate + * the application state out to the container. + */ + setBrowserURL: function(flexAppUrl, objectId) { + if (browser.ie && typeof objectId != "undefined") { + currentObjectId = objectId; + } + //fromIframe = fromIframe || false; + //fromFlex = fromFlex || false; + //alert("setBrowserURL: " + flexAppUrl); + //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ; + + var pos = document.location.href.indexOf('#'); + var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href; + var newUrl = baseUrl + '#' + flexAppUrl; + + if (document.location.href != newUrl && document.location.href + '#' != newUrl) { + currentHref = newUrl; + addHistoryEntry(baseUrl, newUrl, flexAppUrl); + currentHistoryLength = history.length; + } + }, + + browserURLChange: function(flexAppUrl) { + var objectId = null; + if (browser.ie && currentObjectId != null) { + objectId = currentObjectId; + } + pendingURL = ''; + + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + try { + pl[i].browserURLChange(flexAppUrl); + } catch(e) { } + } + } else { + try { + getPlayer(objectId).browserURLChange(flexAppUrl); + } catch(e) { } + } + + currentObjectId = null; + }, + getUserAgent: function() { + return navigator.userAgent; + }, + getPlatform: function() { + return navigator.platform; + } + + } + +})(); + +// Initialization + +// Automated unit testing and other diagnostics + +function setURL(url) +{ + document.location.href = url; +} + +function backButton() +{ + history.back(); +} + +function forwardButton() +{ + history.forward(); +} + +function goForwardOrBackInHistory(step) +{ + history.go(step); +} + +//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); }); +(function(i) { + var u =navigator.userAgent;var e=/*@cc_on!@*/false; + var st = setTimeout; + if(/webkit/i.test(u)){ + st(function(){ + var dr=document.readyState; + if(dr=="loaded"||dr=="complete"){i()} + else{st(arguments.callee,10);}},10); + } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){ + document.addEventListener("DOMContentLoaded",i,false); + } else if(e){ + (function(){ + var t=document.createElement('doc:rdy'); + try{t.doScroll('left'); + i();t=null; + }catch(e){st(arguments.callee,0);}})(); + } else{ + window.onload=i; + } +})( function() {BrowserHistory.initialize();} ); diff --git a/flash/ImageScroll/bin-release/history/historyFrame.html b/flash/ImageScroll/bin-release/history/historyFrame.html new file mode 100644 index 0000000000..07e3806f0e --- /dev/null +++ b/flash/ImageScroll/bin-release/history/historyFrame.html @@ -0,0 +1,29 @@ + + + + + + + + Hidden frame for Browser History support. + + diff --git a/flash/ImageScroll/bin-release/osmf_flex.4.0.0.13495.swz b/flash/ImageScroll/bin-release/osmf_flex.4.0.0.13495.swz new file mode 100644 index 0000000000..8b580fc33c Binary files /dev/null and b/flash/ImageScroll/bin-release/osmf_flex.4.0.0.13495.swz differ diff --git a/flash/ImageScroll/bin-release/playerProductInstall.swf b/flash/ImageScroll/bin-release/playerProductInstall.swf new file mode 100644 index 0000000000..bdc3437856 Binary files /dev/null and b/flash/ImageScroll/bin-release/playerProductInstall.swf differ diff --git a/flash/ImageScroll/bin-release/rpc_4.0.0.14159.swz b/flash/ImageScroll/bin-release/rpc_4.0.0.14159.swz new file mode 100644 index 0000000000..5a87f133b7 Binary files /dev/null and b/flash/ImageScroll/bin-release/rpc_4.0.0.14159.swz differ diff --git a/flash/ImageScroll/bin-release/spark_4.0.0.14159.swz b/flash/ImageScroll/bin-release/spark_4.0.0.14159.swz new file mode 100644 index 0000000000..f5220d7f9c Binary files /dev/null and b/flash/ImageScroll/bin-release/spark_4.0.0.14159.swz differ diff --git a/flash/ImageScroll/bin-release/sparkskins_4.0.0.14159.swz b/flash/ImageScroll/bin-release/sparkskins_4.0.0.14159.swz new file mode 100644 index 0000000000..36c905d641 Binary files /dev/null and b/flash/ImageScroll/bin-release/sparkskins_4.0.0.14159.swz differ diff --git a/flash/ImageScroll/bin-release/swfobject.js b/flash/ImageScroll/bin-release/swfobject.js new file mode 100644 index 0000000000..bf35c07c8f --- /dev/null +++ b/flash/ImageScroll/bin-release/swfobject.js @@ -0,0 +1,777 @@ +/*! SWFObject v2.2 + is released under the MIT License +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + ON_READY_STATE_CHANGE = "onreadystatechange", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + domLoadFnArr = [main], + regObjArr = [], + objIdArr = [], + listenersArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + isDomLoaded = false, + isExpressInstallActive = false, + dynamicStylesheet, + dynamicStylesheetMedia, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }(), + + /* Cross-browser onDomLoad + - Will fire an event as soon as the DOM of a web page is loaded + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ + - Regular onload serves as fallback + */ + onDomLoad = function() { + if (!ua.w3) { return; } + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically + callDomLoadFunctions(); + } + if (!isDomLoaded) { + if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); + } + if (ua.ie && ua.win) { + doc.attachEvent(ON_READY_STATE_CHANGE, function() { + if (doc.readyState == "complete") { + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); + callDomLoadFunctions(); + } + }); + if (win == top) { // if not inside an iframe + (function(){ + if (isDomLoaded) { return; } + try { + doc.documentElement.doScroll("left"); + } + catch(e) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + } + if (ua.wk) { + (function(){ + if (isDomLoaded) { return; } + if (!/loaded|complete/.test(doc.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + addLoadEvent(callDomLoadFunctions); + } + }(); + + function callDomLoadFunctions() { + if (isDomLoaded) { return; } + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); + t.parentNode.removeChild(t); + } + catch (e) { return; } + isDomLoaded = true; + var dl = domLoadFnArr.length; + for (var i = 0; i < dl; i++) { + domLoadFnArr[i](); + } + } + + function addDomLoadEvent(fn) { + if (isDomLoaded) { + fn(); + } + else { + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ + } + } + + /* Cross-browser onload + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ + - Will fire an event as soon as a web page including all of its assets are loaded + */ + function addLoadEvent(fn) { + if (typeof win.addEventListener != UNDEF) { + win.addEventListener("load", fn, false); + } + else if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("load", fn, false); + } + else if (typeof win.attachEvent != UNDEF) { + addListener(win, "onload", fn); + } + else if (typeof win.onload == "function") { + var fnOld = win.onload; + win.onload = function() { + fnOld(); + fn(); + }; + } + else { + win.onload = fn; + } + } + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { + testPlayerVersion(); + } + else { + matchVersions(); + } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + /* Perform Flash Player and SWF version matching; static publishing only + */ + function matchVersions() { + var rl = regObjArr.length; + if (rl > 0) { + for (var i = 0; i < rl; i++) { // for each registered object element + var id = regObjArr[i].id; + var cb = regObjArr[i].callbackFn; + var cbObj = {success:false, id:id}; + if (ua.pv[0] > 0) { + var obj = getElementById(id); + if (obj) { + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! + setVisibility(id, true); + if (cb) { + cbObj.success = true; + cbObj.ref = getObjectById(id); + cb(cbObj); + } + } + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported + var att = {}; + att.data = regObjArr[i].expressInstall; + att.width = obj.getAttribute("width") || "0"; + att.height = obj.getAttribute("height") || "0"; + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } + // parse HTML object param element's name-value pairs + var par = {}; + var p = obj.getElementsByTagName("param"); + var pl = p.length; + for (var j = 0; j < pl; j++) { + if (p[j].getAttribute("name").toLowerCase() != "movie") { + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); + } + } + showExpressInstall(att, par, id, cb); + } + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF + displayAltContent(obj); + if (cb) { cb(cbObj); } + } + } + } + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) + setVisibility(id, true); + if (cb) { + var o = getObjectById(id); // test whether there is an HTML object element or not + if (o && typeof o.SetVariable != UNDEF) { + cbObj.success = true; + cbObj.ref = o; + } + cb(cbObj); + } + } + } + } + } + + function getObjectById(objectIdStr) { + var r = null; + var o = getElementById(objectIdStr); + if (o && o.nodeName == "OBJECT") { + if (typeof o.SetVariable != UNDEF) { + r = o; + } + else { + var n = o.getElementsByTagName(OBJECT)[0]; + if (n) { + r = n; + } + } + } + return r; + } + + /* Requirements for Adobe Express Install + - only one instance can be active at a time + - fp 6.0.65 or higher + - Win/Mac OS only + - no Webkit engines older than version 312 + */ + function canExpressInstall() { + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); + } + + /* Show the Adobe Express Install dialog + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 + */ + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { + isExpressInstallActive = true; + storedCallbackFn = callbackFn || null; + storedCallbackObj = {success:false, id:replaceElemIdStr}; + var obj = getElementById(replaceElemIdStr); + if (obj) { + if (obj.nodeName == "OBJECT") { // static publishing + storedAltContent = abstractAltContent(obj); + storedAltContentId = null; + } + else { // dynamic publishing + storedAltContent = obj; + storedAltContentId = replaceElemIdStr; + } + att.id = EXPRESS_INSTALL_ID; + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + fv; + } + else { + par.flashvars = fv; + } + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + if (ua.ie && ua.win && obj.readyState != 4) { + var newObj = createElement("div"); + replaceElemIdStr += "SWFObjectNew"; + newObj.setAttribute("id", replaceElemIdStr); + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + createSWF(att, par, replaceElemIdStr); + } + } + + /* Functions to abstract and display alternative content + */ + function displayAltContent(obj) { + if (ua.ie && ua.win && obj.readyState != 4) { + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + var el = createElement("div"); + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content + el.parentNode.replaceChild(abstractAltContent(obj), el); + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.replaceChild(abstractAltContent(obj), obj); + } + } + + function abstractAltContent(obj) { + var ac = createElement("div"); + if (ua.win && ua.ie) { + ac.innerHTML = obj.innerHTML; + } + else { + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; + if (nestedObj) { + var c = nestedObj.childNodes; + if (c) { + var cl = c.length; + for (var i = 0; i < cl; i++) { + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { + ac.appendChild(c[i].cloneNode(true)); + } + } + } + } + } + return ac; + } + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += ''; + } + } + el.outerHTML = '' + par + ''; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (ua.ie && ua.win) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } + } + + function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + for (var i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } + } + + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Updated attachEvent function for Internet Explorer + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks + */ + function addListener(target, eventType, fn) { + target.attachEvent(eventType, fn); + listenersArr[listenersArr.length] = [target, eventType, fn]; + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; + } + + /* Cross-browser dynamic CSS creation + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php + */ + function createCSS(sel, decl, media, newStyle) { + if (ua.ie && ua.mac) { return; } + var h = doc.getElementsByTagName("head")[0]; + if (!h) { return; } // to also support badly authored HTML pages that lack a head element + var m = (media && typeof media == "string") ? media : "screen"; + if (newStyle) { + dynamicStylesheet = null; + dynamicStylesheetMedia = null; + } + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { + // create dynamic stylesheet + get a global reference to it + var s = createElement("style"); + s.setAttribute("type", "text/css"); + s.setAttribute("media", m); + dynamicStylesheet = h.appendChild(s); + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; + } + dynamicStylesheetMedia = m; + } + // add style rule + if (ua.ie && ua.win) { + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { + dynamicStylesheet.addRule(sel, decl); + } + } + else { + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); + } + } + } + + function setVisibility(id, isVisible) { + if (!autoHideShow) { return; } + var v = isVisible ? "visible" : "hidden"; + if (isDomLoaded && getElementById(id)) { + getElementById(id).style.visibility = v; + } + else { + createCSS("#" + id, "visibility:" + v); + } + } + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) + */ + var cleanup = function() { + if (ua.ie && ua.win) { + window.attachEvent("onunload", function() { + // remove listeners to avoid memory leaks + var ll = listenersArr.length; + for (var i = 0; i < ll; i++) { + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); + } + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect + var il = objIdArr.length; + for (var j = 0; j < il; j++) { + removeSWF(objIdArr[j]); + } + // cleanup library's main closures to avoid memory leaks + for (var k in ua) { + ua[k] = null; + } + ua = null; + for (var l in swfobject) { + swfobject[l] = null; + } + swfobject = null; + }); + } + }(); + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { + if (ua.w3 && objectIdStr && swfVersionStr) { + var regObj = {}; + regObj.id = objectIdStr; + regObj.swfVersion = swfVersionStr; + regObj.expressInstall = xiSwfUrlStr; + regObj.callbackFn = callbackFn; + regObjArr[regObjArr.length] = regObj; + setVisibility(objectIdStr, false); + } + else if (callbackFn) { + callbackFn({success:false, id:objectIdStr}); + } + }, + + getObjectById: function(objectIdStr) { + if (ua.w3) { + return getObjectById(objectIdStr); + } + }, + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + setVisibility(replaceElemIdStr, false); + addDomLoadEvent(function() { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + if (att.id == replaceElemIdStr) { + setVisibility(replaceElemIdStr, true); + } + callbackObj.success = true; + callbackObj.ref = obj; + } + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install + att.data = xiSwfUrlStr; + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + return; + } + else { // show alternative content + setVisibility(replaceElemIdStr, true); + } + if (callbackFn) { callbackFn(callbackObj); } + }); + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + switchOffAutoHideShow: function() { + autoHideShow = false; + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { + if (ua.w3 && canExpressInstall()) { + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + } + }, + + removeSWF: function(objElemIdStr) { + if (ua.w3) { + removeSWF(objElemIdStr); + } + }, + + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { + if (ua.w3) { + createCSS(selStr, declStr, mediaStr, newStyleBoolean); + } + }, + + addDomLoadEvent: addDomLoadEvent, + + addLoadEvent: addLoadEvent, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + }, + + // For internal usage only + expressInstallCallback: function() { + if (isExpressInstallActive) { + var obj = getElementById(EXPRESS_INSTALL_ID); + if (obj && storedAltContent) { + obj.parentNode.replaceChild(storedAltContent, obj); + if (storedAltContentId) { + setVisibility(storedAltContentId, true); + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } + } + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } + } + isExpressInstallActive = false; + } + } + }; +}(); diff --git a/flash/ImageScroll/bin-release/test.php b/flash/ImageScroll/bin-release/test.php new file mode 100644 index 0000000000..186ae70706 --- /dev/null +++ b/flash/ImageScroll/bin-release/test.php @@ -0,0 +1,42 @@ + + + + +hello + +' + + > + + + + diff --git a/flash/ImageScroll/bin-release/textLayout_1.0.0.595.swz b/flash/ImageScroll/bin-release/textLayout_1.0.0.595.swz new file mode 100644 index 0000000000..18e69504dd Binary files /dev/null and b/flash/ImageScroll/bin-release/textLayout_1.0.0.595.swz differ diff --git a/flash/ImageScroll/html-template/history/history.css b/flash/ImageScroll/html-template/history/history.css new file mode 100644 index 0000000000..dbc47c61b9 --- /dev/null +++ b/flash/ImageScroll/html-template/history/history.css @@ -0,0 +1,6 @@ +/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ + +#ie_historyFrame { width: 0px; height: 0px; display:none } +#firefox_anchorDiv { width: 0px; height: 0px; display:none } +#safari_formDiv { width: 0px; height: 0px; display:none } +#safari_rememberDiv { width: 0px; height: 0px; display:none } diff --git a/flash/ImageScroll/html-template/history/history.js b/flash/ImageScroll/html-template/history/history.js new file mode 100644 index 0000000000..b56be2f338 --- /dev/null +++ b/flash/ImageScroll/html-template/history/history.js @@ -0,0 +1,710 @@ +BrowserHistoryUtils = { + addEvent: function(elm, evType, fn, useCapture) { + useCapture = useCapture || false; + if (elm.addEventListener) { + elm.addEventListener(evType, fn, useCapture); + return true; + } + else if (elm.attachEvent) { + var r = elm.attachEvent('on' + evType, fn); + return r; + } + else { + elm['on' + evType] = fn; + } + } +} + +BrowserHistory = (function() { + // type of browser + var browser = { + ie: false, + ie8: false, + firefox: false, + safari: false, + opera: false, + version: -1 + }; + + // if setDefaultURL has been called, our first clue + // that the SWF is ready and listening + //var swfReady = false; + + // the URL we'll send to the SWF once it is ready + //var pendingURL = ''; + + // Default app state URL to use when no fragment ID present + var defaultHash = ''; + + // Last-known app state URL + var currentHref = document.location.href; + + // Initial URL (used only by IE) + var initialHref = document.location.href; + + // Initial URL (used only by IE) + var initialHash = document.location.hash; + + // History frame source URL prefix (used only by IE) + var historyFrameSourcePrefix = 'history/historyFrame.html?'; + + // History maintenance (used only by Safari) + var currentHistoryLength = -1; + + var historyHash = []; + + var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash); + + var backStack = []; + var forwardStack = []; + + var currentObjectId = null; + + //UserAgent detection + var useragent = navigator.userAgent.toLowerCase(); + + if (useragent.indexOf("opera") != -1) { + browser.opera = true; + } else if (useragent.indexOf("msie") != -1) { + browser.ie = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4)); + if (browser.version == 8) + { + browser.ie = false; + browser.ie8 = true; + } + } else if (useragent.indexOf("safari") != -1) { + browser.safari = true; + browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7)); + } else if (useragent.indexOf("gecko") != -1) { + browser.firefox = true; + } + + if (browser.ie == true && browser.version == 7) { + window["_ie_firstload"] = false; + } + + function hashChangeHandler() + { + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + + // Accessor functions for obtaining specific elements of the page. + function getHistoryFrame() + { + return document.getElementById('ie_historyFrame'); + } + + function getAnchorElement() + { + return document.getElementById('firefox_anchorDiv'); + } + + function getFormElement() + { + return document.getElementById('safari_formDiv'); + } + + function getRememberElement() + { + return document.getElementById("safari_remember_field"); + } + + // Get the Flash player object for performing ExternalInterface callbacks. + // Updated for changes to SWFObject2. + function getPlayer(id) { + var i; + + if (id && document.getElementById(id)) { + var r = document.getElementById(id); + if (typeof r.SetVariable != "undefined") { + return r; + } + else { + var o = r.getElementsByTagName("object"); + var e = r.getElementsByTagName("embed"); + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + return o[i]; + } + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + return e[i]; + } + } + } + else { + var o = document.getElementsByTagName("object"); + var e = document.getElementsByTagName("embed"); + for (i = 0; i < e.length; i++) { + if (typeof e[i].browserURLChange != "undefined") + { + return e[i]; + } + } + for (i = 0; i < o.length; i++) { + if (typeof o[i].browserURLChange != "undefined") + { + return o[i]; + } + } + } + return undefined; + } + + function getPlayers() { + var i; + var players = []; + if (players.length == 0) { + var tmp = document.getElementsByTagName('object'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + if (players.length == 0 || players[0].object == null) { + var tmp = document.getElementsByTagName('embed'); + for (i = 0; i < tmp.length; i++) + { + if (typeof tmp[i].browserURLChange != "undefined") + players.push(tmp[i]); + } + } + return players; + } + + function getIframeHash() { + var doc = getHistoryFrame().contentWindow.document; + var hash = String(doc.location.search); + if (hash.length == 1 && hash.charAt(0) == "?") { + hash = ""; + } + else if (hash.length >= 2 && hash.charAt(0) == "?") { + hash = hash.substring(1); + } + return hash; + } + + /* Get the current location hash excluding the '#' symbol. */ + function getHash() { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + var idx = document.location.href.indexOf('#'); + return (idx >= 0) ? document.location.href.substr(idx+1) : ''; + } + + /* Get the current location hash excluding the '#' symbol. */ + function setHash(hash) { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + if (hash == '') hash = '#' + document.location.hash = hash; + } + + function createState(baseUrl, newUrl, flexAppUrl) { + return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null }; + } + + /* Add a history entry to the browser. + * baseUrl: the portion of the location prior to the '#' + * newUrl: the entire new URL, including '#' and following fragment + * flexAppUrl: the portion of the location following the '#' only + */ + function addHistoryEntry(baseUrl, newUrl, flexAppUrl) { + + //delete all the history entries + forwardStack = []; + + if (browser.ie) { + //Check to see if we are being asked to do a navigate for the first + //history entry, and if so ignore, because it's coming from the creation + //of the history iframe + if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) { + currentHref = initialHref; + return; + } + if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) { + newUrl = baseUrl + '#' + defaultHash; + flexAppUrl = defaultHash; + } else { + // for IE, tell the history frame to go somewhere without a '#' + // in order to get this entry into the browser history. + getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl; + } + setHash(flexAppUrl); + } else { + + //ADR + if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) { + initialState = createState(baseUrl, newUrl, flexAppUrl); + } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) { + backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl); + } + + if (browser.safari) { + // for Safari, submit a form whose action points to the desired URL + if (browser.version <= 419.3) { + var file = window.location.pathname.toString(); + file = file.substring(file.lastIndexOf("/")+1); + getFormElement().innerHTML = '
'; + //get the current elements and add them to the form + var qs = window.location.search.substring(1); + var qs_arr = qs.split("&"); + for (var i = 0; i < qs_arr.length; i++) { + var tmp = qs_arr[i].split("="); + var elem = document.createElement("input"); + elem.type = "hidden"; + elem.name = tmp[0]; + elem.value = tmp[1]; + document.forms.historyForm.appendChild(elem); + } + document.forms.historyForm.submit(); + } else { + top.location.hash = flexAppUrl; + } + // We also have to maintain the history by hand for Safari + historyHash[history.length] = flexAppUrl; + _storeStates(); + } else { + // Otherwise, write an anchor into the page and tell the browser to go there + addAnchor(flexAppUrl); + setHash(flexAppUrl); + + // For IE8 we must restore full focus/activation to our invoking player instance. + if (browser.ie8) + getPlayer().focus(); + } + } + backStack.push(createState(baseUrl, newUrl, flexAppUrl)); + } + + function _storeStates() { + if (browser.safari) { + getRememberElement().value = historyHash.join(","); + } + } + + function handleBackButton() { + //The "current" page is always at the top of the history stack. + var current = backStack.pop(); + if (!current) { return; } + var last = backStack[backStack.length - 1]; + if (!last && backStack.length == 0){ + last = initialState; + } + forwardStack.push(current); + } + + function handleForwardButton() { + //summary: private method. Do not call this directly. + + var last = forwardStack.pop(); + if (!last) { return; } + backStack.push(last); + } + + function handleArbitraryUrl() { + //delete all the history entries + forwardStack = []; + } + + /* Called periodically to poll to see if we need to detect navigation that has occurred */ + function checkForUrlChange() { + + if (browser.ie) { + if (currentHref != document.location.href && currentHref + '#' != document.location.href) { + //This occurs when the user has navigated to a specific URL + //within the app, and didn't use browser back/forward + //IE seems to have a bug where it stops updating the URL it + //shows the end-user at this point, but programatically it + //appears to be correct. Do a full app reload to get around + //this issue. + if (browser.version < 7) { + currentHref = document.location.href; + document.location.reload(); + } else { + if (getHash() != getIframeHash()) { + // this.iframe.src = this.blankURL + hash; + var sourceToSet = historyFrameSourcePrefix + getHash(); + getHistoryFrame().src = sourceToSet; + currentHref = document.location.href; + } + } + } + } + + if (browser.safari) { + // For Safari, we have to check to see if history.length changed. + if (currentHistoryLength >= 0 && history.length != currentHistoryLength) { + //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|")); + var flexAppUrl = getHash(); + if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */) + { + // If it did change and we're running Safari 3.x or earlier, + // then we have to look the old state up in our hand-maintained + // array since document.location.hash won't have changed, + // then call back into BrowserManager. + currentHistoryLength = history.length; + flexAppUrl = historyHash[currentHistoryLength]; + } + + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + _storeStates(); + } + } + if (browser.firefox) { + if (currentHref != document.location.href) { + var bsl = backStack.length; + + var urlActions = { + back: false, + forward: false, + set: false + } + + if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) { + urlActions.back = true; + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + handleBackButton(); + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if (forwardStack.length > 0) { + if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) { + urlActions.forward = true; + handleForwardButton(); + } + } + + // ok, that didn't work, try someplace back in the history stack + if ((bsl >= 2) && (backStack[bsl - 2])) { + if (backStack[bsl - 2].flexAppUrl == getHash()) { + urlActions.back = true; + handleBackButton(); + } + } + + if (!urlActions.back && !urlActions.forward) { + var foundInStacks = { + back: -1, + forward: -1 + } + + for (var i = 0; i < backStack.length; i++) { + if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.back = i; + } + } + for (var i = 0; i < forwardStack.length; i++) { + if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.forward = i; + } + } + handleArbitraryUrl(); + } + + // Firefox changed; do a callback into BrowserManager to tell it. + currentHref = document.location.href; + var flexAppUrl = getHash(); + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + } + //setTimeout(checkForUrlChange, 50); + } + + /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */ + function addAnchor(flexAppUrl) + { + if (document.getElementsByName(flexAppUrl).length == 0) { + getAnchorElement().innerHTML += "" + flexAppUrl + ""; + } + } + + var _initialize = function () { + if (browser.ie) + { + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html"); + } + } + historyFrameSourcePrefix = iframe_location + "?"; + var src = historyFrameSourcePrefix; + + var iframe = document.createElement("iframe"); + iframe.id = 'ie_historyFrame'; + iframe.name = 'ie_historyFrame'; + iframe.src = 'javascript:false;'; + + try { + document.body.appendChild(iframe); + } catch(e) { + setTimeout(function() { + document.body.appendChild(iframe); + }, 0); + } + } + + if (browser.safari) + { + var rememberDiv = document.createElement("div"); + rememberDiv.id = 'safari_rememberDiv'; + document.body.appendChild(rememberDiv); + rememberDiv.innerHTML = ''; + + var formDiv = document.createElement("div"); + formDiv.id = 'safari_formDiv'; + document.body.appendChild(formDiv); + + var reloader_content = document.createElement('div'); + reloader_content.id = 'safarireloader'; + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + html = (new String(s.src)).replace(".js", ".html"); + } + } + reloader_content.innerHTML = ''; + document.body.appendChild(reloader_content); + reloader_content.style.position = 'absolute'; + reloader_content.style.left = reloader_content.style.top = '-9999px'; + iframe = reloader_content.getElementsByTagName('iframe')[0]; + + if (document.getElementById("safari_remember_field").value != "" ) { + historyHash = document.getElementById("safari_remember_field").value.split(","); + } + + } + + if (browser.firefox || browser.ie8) + { + var anchorDiv = document.createElement("div"); + anchorDiv.id = 'firefox_anchorDiv'; + document.body.appendChild(anchorDiv); + } + + if (browser.ie8) + document.body.onhashchange = hashChangeHandler; + //setTimeout(checkForUrlChange, 50); + } + + return { + historyHash: historyHash, + backStack: function() { return backStack; }, + forwardStack: function() { return forwardStack }, + getPlayer: getPlayer, + initialize: function(src) { + _initialize(src); + }, + setURL: function(url) { + document.location.href = url; + }, + getURL: function() { + return document.location.href; + }, + getTitle: function() { + return document.title; + }, + setTitle: function(title) { + try { + backStack[backStack.length - 1].title = title; + } catch(e) { } + //if on safari, set the title to be the empty string. + if (browser.safari) { + if (title == "") { + try { + var tmp = window.location.href.toString(); + title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#")); + } catch(e) { + title = ""; + } + } + } + document.title = title; + }, + setDefaultURL: function(def) + { + defaultHash = def; + def = getHash(); + //trailing ? is important else an extra frame gets added to the history + //when navigating back to the first page. Alternatively could check + //in history frame navigation to compare # and ?. + if (browser.ie) + { + window['_ie_firstload'] = true; + var sourceToSet = historyFrameSourcePrefix + def; + var func = function() { + getHistoryFrame().src = sourceToSet; + window.location.replace("#" + def); + setInterval(checkForUrlChange, 50); + } + try { + func(); + } catch(e) { + window.setTimeout(function() { func(); }, 0); + } + } + + if (browser.safari) + { + currentHistoryLength = history.length; + if (historyHash.length == 0) { + historyHash[currentHistoryLength] = def; + var newloc = "#" + def; + window.location.replace(newloc); + } else { + //alert(historyHash[historyHash.length-1]); + } + //setHash(def); + setInterval(checkForUrlChange, 50); + } + + + if (browser.firefox || browser.opera) + { + var reg = new RegExp("#" + def + "$"); + if (window.location.toString().match(reg)) { + } else { + var newloc ="#" + def; + window.location.replace(newloc); + } + setInterval(checkForUrlChange, 50); + //setHash(def); + } + + }, + + /* Set the current browser URL; called from inside BrowserManager to propagate + * the application state out to the container. + */ + setBrowserURL: function(flexAppUrl, objectId) { + if (browser.ie && typeof objectId != "undefined") { + currentObjectId = objectId; + } + //fromIframe = fromIframe || false; + //fromFlex = fromFlex || false; + //alert("setBrowserURL: " + flexAppUrl); + //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ; + + var pos = document.location.href.indexOf('#'); + var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href; + var newUrl = baseUrl + '#' + flexAppUrl; + + if (document.location.href != newUrl && document.location.href + '#' != newUrl) { + currentHref = newUrl; + addHistoryEntry(baseUrl, newUrl, flexAppUrl); + currentHistoryLength = history.length; + } + }, + + browserURLChange: function(flexAppUrl) { + var objectId = null; + if (browser.ie && currentObjectId != null) { + objectId = currentObjectId; + } + pendingURL = ''; + + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + try { + pl[i].browserURLChange(flexAppUrl); + } catch(e) { } + } + } else { + try { + getPlayer(objectId).browserURLChange(flexAppUrl); + } catch(e) { } + } + + currentObjectId = null; + }, + getUserAgent: function() { + return navigator.userAgent; + }, + getPlatform: function() { + return navigator.platform; + } + + } + +})(); + +// Initialization + +// Automated unit testing and other diagnostics + +function setURL(url) +{ + document.location.href = url; +} + +function backButton() +{ + history.back(); +} + +function forwardButton() +{ + history.forward(); +} + +function goForwardOrBackInHistory(step) +{ + history.go(step); +} + +//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); }); +(function(i) { + var u =navigator.userAgent;var e=/*@cc_on!@*/false; + var st = setTimeout; + if(/webkit/i.test(u)){ + st(function(){ + var dr=document.readyState; + if(dr=="loaded"||dr=="complete"){i()} + else{st(arguments.callee,10);}},10); + } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){ + document.addEventListener("DOMContentLoaded",i,false); + } else if(e){ + (function(){ + var t=document.createElement('doc:rdy'); + try{t.doScroll('left'); + i();t=null; + }catch(e){st(arguments.callee,0);}})(); + } else{ + window.onload=i; + } +})( function() {BrowserHistory.initialize();} ); diff --git a/flash/ImageScroll/html-template/history/historyFrame.html b/flash/ImageScroll/html-template/history/historyFrame.html new file mode 100644 index 0000000000..07e3806f0e --- /dev/null +++ b/flash/ImageScroll/html-template/history/historyFrame.html @@ -0,0 +1,29 @@ + + + + + + + + Hidden frame for Browser History support. + + diff --git a/flash/ImageScroll/html-template/index.template.html b/flash/ImageScroll/html-template/index.template.html new file mode 100644 index 0000000000..47b00d1204 --- /dev/null +++ b/flash/ImageScroll/html-template/index.template.html @@ -0,0 +1,105 @@ + + + + + + ${title} + + + + + + + + + + + + +
+

+ To view this page ensure that Adobe Flash Player version + ${version_major}.${version_minor}.${version_revision} or greater is installed. +

+ +
+ + + + diff --git a/flash/ImageScroll/html-template/playerProductInstall.swf b/flash/ImageScroll/html-template/playerProductInstall.swf new file mode 100644 index 0000000000..bdc3437856 Binary files /dev/null and b/flash/ImageScroll/html-template/playerProductInstall.swf differ diff --git a/flash/ImageScroll/html-template/swfobject.js b/flash/ImageScroll/html-template/swfobject.js new file mode 100644 index 0000000000..bf35c07c8f --- /dev/null +++ b/flash/ImageScroll/html-template/swfobject.js @@ -0,0 +1,777 @@ +/*! SWFObject v2.2 + is released under the MIT License +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + ON_READY_STATE_CHANGE = "onreadystatechange", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + domLoadFnArr = [main], + regObjArr = [], + objIdArr = [], + listenersArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + isDomLoaded = false, + isExpressInstallActive = false, + dynamicStylesheet, + dynamicStylesheetMedia, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }(), + + /* Cross-browser onDomLoad + - Will fire an event as soon as the DOM of a web page is loaded + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ + - Regular onload serves as fallback + */ + onDomLoad = function() { + if (!ua.w3) { return; } + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically + callDomLoadFunctions(); + } + if (!isDomLoaded) { + if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); + } + if (ua.ie && ua.win) { + doc.attachEvent(ON_READY_STATE_CHANGE, function() { + if (doc.readyState == "complete") { + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); + callDomLoadFunctions(); + } + }); + if (win == top) { // if not inside an iframe + (function(){ + if (isDomLoaded) { return; } + try { + doc.documentElement.doScroll("left"); + } + catch(e) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + } + if (ua.wk) { + (function(){ + if (isDomLoaded) { return; } + if (!/loaded|complete/.test(doc.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + addLoadEvent(callDomLoadFunctions); + } + }(); + + function callDomLoadFunctions() { + if (isDomLoaded) { return; } + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); + t.parentNode.removeChild(t); + } + catch (e) { return; } + isDomLoaded = true; + var dl = domLoadFnArr.length; + for (var i = 0; i < dl; i++) { + domLoadFnArr[i](); + } + } + + function addDomLoadEvent(fn) { + if (isDomLoaded) { + fn(); + } + else { + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ + } + } + + /* Cross-browser onload + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ + - Will fire an event as soon as a web page including all of its assets are loaded + */ + function addLoadEvent(fn) { + if (typeof win.addEventListener != UNDEF) { + win.addEventListener("load", fn, false); + } + else if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("load", fn, false); + } + else if (typeof win.attachEvent != UNDEF) { + addListener(win, "onload", fn); + } + else if (typeof win.onload == "function") { + var fnOld = win.onload; + win.onload = function() { + fnOld(); + fn(); + }; + } + else { + win.onload = fn; + } + } + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { + testPlayerVersion(); + } + else { + matchVersions(); + } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + /* Perform Flash Player and SWF version matching; static publishing only + */ + function matchVersions() { + var rl = regObjArr.length; + if (rl > 0) { + for (var i = 0; i < rl; i++) { // for each registered object element + var id = regObjArr[i].id; + var cb = regObjArr[i].callbackFn; + var cbObj = {success:false, id:id}; + if (ua.pv[0] > 0) { + var obj = getElementById(id); + if (obj) { + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! + setVisibility(id, true); + if (cb) { + cbObj.success = true; + cbObj.ref = getObjectById(id); + cb(cbObj); + } + } + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported + var att = {}; + att.data = regObjArr[i].expressInstall; + att.width = obj.getAttribute("width") || "0"; + att.height = obj.getAttribute("height") || "0"; + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } + // parse HTML object param element's name-value pairs + var par = {}; + var p = obj.getElementsByTagName("param"); + var pl = p.length; + for (var j = 0; j < pl; j++) { + if (p[j].getAttribute("name").toLowerCase() != "movie") { + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); + } + } + showExpressInstall(att, par, id, cb); + } + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF + displayAltContent(obj); + if (cb) { cb(cbObj); } + } + } + } + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) + setVisibility(id, true); + if (cb) { + var o = getObjectById(id); // test whether there is an HTML object element or not + if (o && typeof o.SetVariable != UNDEF) { + cbObj.success = true; + cbObj.ref = o; + } + cb(cbObj); + } + } + } + } + } + + function getObjectById(objectIdStr) { + var r = null; + var o = getElementById(objectIdStr); + if (o && o.nodeName == "OBJECT") { + if (typeof o.SetVariable != UNDEF) { + r = o; + } + else { + var n = o.getElementsByTagName(OBJECT)[0]; + if (n) { + r = n; + } + } + } + return r; + } + + /* Requirements for Adobe Express Install + - only one instance can be active at a time + - fp 6.0.65 or higher + - Win/Mac OS only + - no Webkit engines older than version 312 + */ + function canExpressInstall() { + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); + } + + /* Show the Adobe Express Install dialog + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 + */ + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { + isExpressInstallActive = true; + storedCallbackFn = callbackFn || null; + storedCallbackObj = {success:false, id:replaceElemIdStr}; + var obj = getElementById(replaceElemIdStr); + if (obj) { + if (obj.nodeName == "OBJECT") { // static publishing + storedAltContent = abstractAltContent(obj); + storedAltContentId = null; + } + else { // dynamic publishing + storedAltContent = obj; + storedAltContentId = replaceElemIdStr; + } + att.id = EXPRESS_INSTALL_ID; + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + fv; + } + else { + par.flashvars = fv; + } + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + if (ua.ie && ua.win && obj.readyState != 4) { + var newObj = createElement("div"); + replaceElemIdStr += "SWFObjectNew"; + newObj.setAttribute("id", replaceElemIdStr); + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + createSWF(att, par, replaceElemIdStr); + } + } + + /* Functions to abstract and display alternative content + */ + function displayAltContent(obj) { + if (ua.ie && ua.win && obj.readyState != 4) { + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + var el = createElement("div"); + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content + el.parentNode.replaceChild(abstractAltContent(obj), el); + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.replaceChild(abstractAltContent(obj), obj); + } + } + + function abstractAltContent(obj) { + var ac = createElement("div"); + if (ua.win && ua.ie) { + ac.innerHTML = obj.innerHTML; + } + else { + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; + if (nestedObj) { + var c = nestedObj.childNodes; + if (c) { + var cl = c.length; + for (var i = 0; i < cl; i++) { + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { + ac.appendChild(c[i].cloneNode(true)); + } + } + } + } + } + return ac; + } + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += ''; + } + } + el.outerHTML = '' + par + ''; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (ua.ie && ua.win) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } + } + + function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + for (var i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } + } + + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Updated attachEvent function for Internet Explorer + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks + */ + function addListener(target, eventType, fn) { + target.attachEvent(eventType, fn); + listenersArr[listenersArr.length] = [target, eventType, fn]; + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; + } + + /* Cross-browser dynamic CSS creation + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php + */ + function createCSS(sel, decl, media, newStyle) { + if (ua.ie && ua.mac) { return; } + var h = doc.getElementsByTagName("head")[0]; + if (!h) { return; } // to also support badly authored HTML pages that lack a head element + var m = (media && typeof media == "string") ? media : "screen"; + if (newStyle) { + dynamicStylesheet = null; + dynamicStylesheetMedia = null; + } + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { + // create dynamic stylesheet + get a global reference to it + var s = createElement("style"); + s.setAttribute("type", "text/css"); + s.setAttribute("media", m); + dynamicStylesheet = h.appendChild(s); + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; + } + dynamicStylesheetMedia = m; + } + // add style rule + if (ua.ie && ua.win) { + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { + dynamicStylesheet.addRule(sel, decl); + } + } + else { + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); + } + } + } + + function setVisibility(id, isVisible) { + if (!autoHideShow) { return; } + var v = isVisible ? "visible" : "hidden"; + if (isDomLoaded && getElementById(id)) { + getElementById(id).style.visibility = v; + } + else { + createCSS("#" + id, "visibility:" + v); + } + } + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) + */ + var cleanup = function() { + if (ua.ie && ua.win) { + window.attachEvent("onunload", function() { + // remove listeners to avoid memory leaks + var ll = listenersArr.length; + for (var i = 0; i < ll; i++) { + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); + } + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect + var il = objIdArr.length; + for (var j = 0; j < il; j++) { + removeSWF(objIdArr[j]); + } + // cleanup library's main closures to avoid memory leaks + for (var k in ua) { + ua[k] = null; + } + ua = null; + for (var l in swfobject) { + swfobject[l] = null; + } + swfobject = null; + }); + } + }(); + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { + if (ua.w3 && objectIdStr && swfVersionStr) { + var regObj = {}; + regObj.id = objectIdStr; + regObj.swfVersion = swfVersionStr; + regObj.expressInstall = xiSwfUrlStr; + regObj.callbackFn = callbackFn; + regObjArr[regObjArr.length] = regObj; + setVisibility(objectIdStr, false); + } + else if (callbackFn) { + callbackFn({success:false, id:objectIdStr}); + } + }, + + getObjectById: function(objectIdStr) { + if (ua.w3) { + return getObjectById(objectIdStr); + } + }, + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + setVisibility(replaceElemIdStr, false); + addDomLoadEvent(function() { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + if (att.id == replaceElemIdStr) { + setVisibility(replaceElemIdStr, true); + } + callbackObj.success = true; + callbackObj.ref = obj; + } + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install + att.data = xiSwfUrlStr; + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + return; + } + else { // show alternative content + setVisibility(replaceElemIdStr, true); + } + if (callbackFn) { callbackFn(callbackObj); } + }); + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + switchOffAutoHideShow: function() { + autoHideShow = false; + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { + if (ua.w3 && canExpressInstall()) { + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + } + }, + + removeSWF: function(objElemIdStr) { + if (ua.w3) { + removeSWF(objElemIdStr); + } + }, + + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { + if (ua.w3) { + createCSS(selStr, declStr, mediaStr, newStyleBoolean); + } + }, + + addDomLoadEvent: addDomLoadEvent, + + addLoadEvent: addLoadEvent, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + }, + + // For internal usage only + expressInstallCallback: function() { + if (isExpressInstallActive) { + var obj = getElementById(EXPRESS_INSTALL_ID); + if (obj && storedAltContent) { + obj.parentNode.replaceChild(storedAltContent, obj); + if (storedAltContentId) { + setVisibility(storedAltContentId, true); + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } + } + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } + } + isExpressInstallActive = false; + } + } + }; +}(); diff --git a/flash/ImageScroll/src/DisplayItem.as b/flash/ImageScroll/src/DisplayItem.as new file mode 100644 index 0000000000..959f70282e --- /dev/null +++ b/flash/ImageScroll/src/DisplayItem.as @@ -0,0 +1 @@ +package { import flash.display.Sprite; import flash.events.Event; public class DisplayItem extends Sprite { protected static const FADE_RATE :Number = 0.05; protected static const ALPHA_ON :Number = 1; protected static const ALPHA_OFF :Number = 0.8; public function DisplayItem(){ } protected function fadeIn(e:Event):void { if(alpha>=ALPHA_ON){ alpha = ALPHA_ON; removeEventListener(Event.ENTER_FRAME, fadeIn); return } alpha += FADE_RATE; } protected function fadeOut(e:Event):void { if(alpha<=ALPHA_OFF){ alpha = ALPHA_OFF; removeEventListener(Event.ENTER_FRAME, fadeOut); return; } alpha -= FADE_RATE; } } } \ No newline at end of file diff --git a/flash/ImageScroll/src/ImageScroll.mxml b/flash/ImageScroll/src/ImageScroll.mxml new file mode 100644 index 0000000000..3cec249fbb --- /dev/null +++ b/flash/ImageScroll/src/ImageScroll.mxml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + diff --git a/flash/ImageScroll/src/NavItem.as b/flash/ImageScroll/src/NavItem.as new file mode 100644 index 0000000000..723c6e7331 --- /dev/null +++ b/flash/ImageScroll/src/NavItem.as @@ -0,0 +1 @@ +package { import flash.display.Loader; import flash.display.Shape; import flash.display.Sprite; import flash.net.URLRequest; public class NavItem extends Sprite { private var _ref :Number; // private var _source:String; private var _width:int private var _height:int private var loader :Loader; /* public function imgLoaded(e:Event):void { this._width = e.currentTarget.width; this._height = e.currentTarget.height; //the background holds fills in the shape to the proper size //while the image is loaded var background:Shape = new Shape(); background.graphics.drawRect(0, 0, this._width, this._height); addChild(background); addChild(e.currentTarget.content); } */ /** * Constructor for a NavItem * @param ref * @param source * @param width * */ public function NavItem(ref:Number, source:String, width:Number, height:Number) { super(); _ref = ref; // _source = source; _width = width; _height = height; //the background holds fills in the shape to the proper size //while the image is loaded var background:Shape = new Shape(); background.graphics.drawRect(0, 0, _width, _height); addChild(background); //load the image loader = new Loader(); // loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded); var request:URLRequest = new URLRequest(source); loader.load(request); addChild(loader); } /** * The reference number of the NavItem * @return * */ public function get ref():Number { return _ref; } } } \ No newline at end of file diff --git a/flash/ImageScroll/src/Navigator.as b/flash/ImageScroll/src/Navigator.as new file mode 100644 index 0000000000..ef5698a319 --- /dev/null +++ b/flash/ImageScroll/src/Navigator.as @@ -0,0 +1 @@ +package { import flash.display.Sprite; import flash.events.Event; /** * Based on the work of Peter Wright: * http://www.f-90.co.uk/blog/ * * This is a slide panel thumbnail navigator for displaying * a continuous scrolling list of thumbnail images for use * in slideshows and other navigation. * * @author Joel Hooks * */ public class Navigator extends Sprite { /** * Array of NavItem objects to display in the scroll list */ private var _navArray :Array; /** * Currently selected NavItem */ private var _centerX :Number = 200; /** * The sum of all the NavItem widths */ private var totalWidth :Number = 0; /** * The current width of the container. * * TODO: containerHeight for vertical layouts. * Update on app resize. */ private var _containerWidth:Number = 0; /** * The width of an individual item. * * TODO: This should be changed to accept variables * as well as adding a height for vertical layouts. */ private var _speed:int; private var _space:int; /** * Constructor for Navigator * * @param images XML list of images to load * @param damping Controls the transition speed as list scrolls * @param thumbSize the size of the thumbnail object * @param centerX The mid-point. * @param containerWidth The width of the container holding the navigator. * @param slideShow is this a slideshow? * @param slideDelatSeconds how many seconds to hold each fram in a slideshow. * */ public function Navigator(xml:XML, damping:Number, centerX:Number, containerWidth:Number, zoom:Number, speed:int, spaceBetweenImages:int, media:String) { _centerX = centerX; _navArray = []; _containerWidth = containerWidth; _speed = speed; _space = spaceBetweenImages; var count:int = 0; var navItem:NavItem; var mediaNS:Namespace = new Namespace('http://search.yahoo.com/mrss/'); var nodeName:QName = new QName(mediaNS, media); for each( var item:XML in xml.channel.item ) { var z:XMLList = item.child(nodeName)[0].(@isDefault=="true");; navItem = new NavItem(count, z.@url, z.@width, z.@height); addChild(navItem); navItem.width *= zoom; navItem.height *= zoom; _navArray.push(navItem); totalWidth += navItem.width + _space; count++; } _navArray[0].x = 0; for( var i:int=0; i - + - + diff --git a/hudson/build.properties b/hudson/build.properties index e61ac9eed0..12294dcf26 100644 --- a/hudson/build.properties +++ b/hudson/build.properties @@ -1,5 +1,5 @@ # temp pour lint -dir.src=/tmp/jenkinsWorking +dir.src=/tmp/jenkinsWorking-dev # test.ci -dir.dest=/home/sites_web/test.ci/pv3 +dir.dest=/home/sites_web/test-dev.ci.alchemyasp.com/pv3 diff --git a/hudson/config.json b/hudson/config.json new file mode 100644 index 0000000000..e3c23af2a4 --- /dev/null +++ b/hudson/config.json @@ -0,0 +1,4 @@ +{ + 'ignoreSslErrors': true, + 'localToRemoteUrlAccessEnabled': true +} diff --git a/hudson/run-qunit.js b/hudson/run-qunit.js new file mode 100644 index 0000000000..54c1d5ddcb --- /dev/null +++ b/hudson/run-qunit.js @@ -0,0 +1,74 @@ +/** + * Wait until the test condition is true or a timeout occurs. Useful for waiting + * on a server response or for a ui change (fadeIn, etc.) to occur. + * + * @param testFx javascript condition that evaluates to a boolean, + * it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or + * as a callback function. + * @param onReady what to do when testFx condition is fulfilled, + * it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or + * as a callback function. + * @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used. + */ +function waitFor(testFx, onReady, timeOutMillis) { + var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3001, //< Default Max Timout is 3s + start = new Date().getTime(), + condition = false, + interval = setInterval(function() { + if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) { + // If not time-out yet and condition not yet fulfilled + condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code + } else { + if(!condition) { + // If condition still not fulfilled (timeout but condition is 'false') + console.log("'waitFor()' timeout"); + phantom.exit(1); + } else { + // Condition fulfilled (timeout and/or condition is 'true') + console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms."); + typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled + clearInterval(interval); //< Stop this interval + } + } + }, 100); //< repeat check every 250ms +}; + + +if (phantom.args.length === 0 || phantom.args.length > 2) { + console.log('Usage: run-qunit.js URL'); + phantom.exit(1); +} + +var page = require('webpage').create(); + +// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") +page.onConsoleMessage = function(msg) { + console.log(msg); +}; + +page.open(phantom.args[0], function(status){ + if (status !== "success") { + console.log("Unable to access network"); + phantom.exit(1); + } else { + waitFor(function(){ + return page.evaluate(function(){ + var el = document.getElementById('qunit-testresult'); + if (el && el.innerText.match('completed')) { + return true; + } + return false; + }); + }, function(){ + var failedNum = page.evaluate(function(){ + var el = document.getElementById('qunit-testresult'); + console.log(el.innerText); + try { + return el.getElementsByClassName('failed')[0].innerHTML; + } catch (e) { } + return 10000; + }); + phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0); + }); + } +}); diff --git a/hudson/testJS.sh b/hudson/testJS.sh new file mode 100755 index 0000000000..2d61299367 --- /dev/null +++ b/hudson/testJS.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +printHelp(){ + echo ""; + echo "Use : [/bin/bash] testJS.sh /path/to/sources/ \"http[s]://your.instance.com/\" "; + echo ""; + echo "Run JS Unittest recursively."; + echo "You have to put trailing slashes !"; + echo ""; +} + + +sources=$1; +instance=$2; +fullprint=$3; + +readme=$sources"README.md" + +# Directory exists ? +echo -n "Directory check : "; +if [ ! -d $sources ] +then + echo "Directory does not exists"; + printHelp; + exit 1; +fi + +# Phraseanet directory ? +if [ ! -e $readme ] +then + echo "Not a Phraseanet Directory"; + exit 1; +fi + +echo "ok !"; + + +# Valid link ? + +echo -n "Check link validity : "; +wget --no-check-certificate $instance --output-document=/dev/null +if [ ! $? -eq 0 ] +then + echo "Link does not exists."; + exit 1; +fi + +echo "ok !"; + +echo ""; +echo ""; +testOK=0 +# recursively tests files +for jsfiles in `ls $sources"www/include/js/tests/"` +do + echo -n $jsfiles" : "; + phantomjs --config=$sources"hudson/config.json" $sources"hudson/run-qunit.js" $instance"/include/js/tests/"$jsfiles > /tmp/jsunitphantom + if [ ! $? -eq 0 ] + then + echo "nok !"; + cat /tmp/jsunitphantom; + testOK=1; + else + echo "ok !"; + fi + echo ""; + echo ""; +done + +exit $testOK; diff --git a/launchpadToLocales.php b/launchpadToLocales.php new file mode 100755 index 0000000000..03b694323c --- /dev/null +++ b/launchpadToLocales.php @@ -0,0 +1,66 @@ +#!/usr/bin/env php +files() + ->name('phraseanet-*.po') + ->in( + array( + __DIR__ . '/' . $argv[1], + ) + ) +; + +$count = 0; + +foreach ($finder as $file) +{ + preg_match('/phraseanet-(.*)\.po/', $file->getFileName(), $matches); + + $current_file = $file->getRealPath(); + $locale = $matches[1]; + + $dest_file = __DIR__ . '/locale/' . $locale . '/LC_MESSAGES/phraseanet.po'; + + if (!file_exists($dest_file)) + { + echo "Destination $dest_file does not exists" . PHP_EOL; + continue; + } + + system(sprintf('cp %s %s', $current_file, $dest_file)); + + $count++; +} + +echo "$count files upgraded" . PHP_EOL; + +exit($count ? 1 : 0); diff --git a/lib/Alchemy/Phrasea/Application/Admin.php b/lib/Alchemy/Phrasea/Application/Admin.php new file mode 100644 index 0000000000..c0f458ccc5 --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Admin.php @@ -0,0 +1,47 @@ +getConfiguration()->isDebug(); + + $app->mount('/', new Controller\Root()); + $app->mount('/publications', new Controller\Publications()); + $app->mount('/users', new Controller\Users()); + $app->mount('/fields', new Controller\Fields()); + $app->mount('/subdefs', new Controller\Subdefs); + $app->mount('/description', new Controller\Description()); + $app->mount('/tests/connection', new ControllerUtils\ConnectionTest()); + $app->mount('/tests/pathurl', new ControllerUtils\PathFileTest()); + + $app->error(function(\Exception $e) + { + return $e->getMessage(); + }); + + return $app; + }); diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php new file mode 100644 index 0000000000..9cdd1a3729 --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Api.php @@ -0,0 +1,766 @@ +protect(function ($result) + { + $response = new Response( + $result->format() + , $result->get_http_code() + , array('Content-Type' => $result->get_content_type()) + ); + $response->setCharset('UTF-8'); + + return $response; + }); + + /** + * Api Service + * @var Closure + */ + $app['api'] = function () use ($app) + { + return new \API_V1_adapter(false, $app["appbox"], $app["Core"]); + }; + + + + $parseRoute = function ($route, Response $response) + { + $ressource = $general = $aspect = $action = null; + $exploded_route = explode('/', \p4string::delFirstSlash(\p4string::delEndSlash($route))); + if (sizeof($exploded_route) > 0 && $response->isOk()) + { + $ressource = $exploded_route[0]; + + if (sizeof($exploded_route) == 2 && (int) $exploded_route[1] == 0) + { + $general = $exploded_route[1]; + } + else + { + switch ($ressource) + { + case \API_V1_Log::DATABOXES_RESSOURCE : + if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) + $aspect = $exploded_route[2]; + break; + case \API_V1_Log::RECORDS_RESSOURCE : + if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 4) + { + if (!isset($exploded_route[3])) + $aspect = "record"; + elseif (preg_match("/^set/", $exploded_route[3])) + $action = $exploded_route[3]; + else + $aspect = $exploded_route[3]; + } + break; + case \API_V1_Log::BASKETS_RESSOURCE : + if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) + { + if (preg_match("/^set/", $exploded_route[2]) || preg_match("/^delete/", $exploded_route[2])) + $action = $exploded_route[2]; + else + $aspect = $exploded_route[2]; + } + break; + case \API_V1_Log::FEEDS_RESSOURCE : + if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) + $aspect = $exploded_route[2]; + break; + } + } + } + + return array('ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action); + }; + + + + /** + * oAuth verification process + */ + $app->before(function($request) use ($app) + { + $session = $app["appbox"]->get_session(); + $oauth2_adapter = new \API_OAuth2_Adapter($app["appbox"]); + $oauth2_adapter->verifyAccessToken(); + + $app['p4user'] = \User_Adapter::getInstance($oauth2_adapter->get_usr_id(), $app["appbox"]); + $app['token'] = \API_OAuth2_Token::load_by_oauth_token($app["appbox"], $oauth2_adapter->getToken()); + + if ($session->is_authenticated()) + { + return; + } + + if ($oauth2_adapter->has_ses_id()) + { + try + { + $session->restore($app['p4user'], $oauth2_adapter->get_ses_id()); + + return; + } + catch (\Exception $e) + { + + } + } + $auth = new \Session_Authentication_None($app['p4user']); + $session->authenticate($auth); + $oauth2_adapter->remember_this_ses_id($session->get_ses_id()); + + return; + }); + + + /** + * oAUth log process + */ + $app->after(function (Request $request, Response $response) use ($app, $parseRoute) + { + $account = $app['token']->get_account(); + $pathInfo = $request->getPathInfo(); + $route = $parseRoute($pathInfo, $response); + $log = \API_V1_Log::create( + $app["appbox"] + , $account + , $request->getMethod() . " " . $pathInfo + , $response->getStatusCode() + , $response->headers->get('content-type') + , $route['ressource'] + , $route['general'] + , $route['aspect'] + , $route['action'] + ); + }); + + /** + * Method Not Allowed Closure + */ + $bad_request_exception = function() + { + throw new \API_V1_exception_badrequest(); + }; + + /** + * ******************************************************************* + * Route : /databoxes/list/FORMAT/ + * + * Method : GET + * + * Parameters : + * + */ + $route = '/databoxes/list/'; + $app->get( + $route, function() use ($app) + { + return $app['response']($app['api']->get_databoxes($app['request'])); + } + ); + + /** + * ******************************************************************* + * + * Route /databoxes/DATABOX_ID/collections/FORMAT/ + * + * Method : GET + * + * Parameters ; + * DATABOX_ID : required INT + */ + $route = '/databoxes/{databox_id}/collections/'; + $app->get( + $route, function($databox_id) use ($app) + { + $result = $app['api']->get_databox_collections($app['request'], $databox_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+'); + + $app->get('/databoxes/{any_id}/collections/', $bad_request_exception); + + + /** + * ******************************************************************* + * Route /databoxes/DATABOX_ID/status/FORMAT/ + * + * Method : GET + * + * Parameters ; + * DATABOX_ID : required INT + * + */ + $route = '/databoxes/{databox_id}/status/'; + $app->get( + $route, function($databox_id) use ($app) + { + $result = $app['api']->get_databox_status($app['request'], $databox_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+'); + + $app->get('/databoxes/{any_id}/status/', $bad_request_exception); + + /** + * Route /databoxes/DATABOX_ID/metadatas/FORMAT/ + * + * Method : GET + * + * Parameters ; + * DATABOX_ID : required INT + */ + $route = '/databoxes/{databox_id}/metadatas/'; + $app->get( + $route, function($databox_id) use ($app) + { + $result = $app['api']->get_databox_metadatas($app['request'], $databox_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+'); + + $app->get('/databoxes/{any_id}/metadatas/', $bad_request_exception); + + /** + * Route /databoxes/DATABOX_ID/termsOfUse/FORMAT/ + * + * Method : GET + * + * Parameters ; + * DATABOX_ID : required INT + */ + $route = '/databoxes/{databox_id}/termsOfUse/'; + $app->get( + $route, function($databox_id) use ($app) + { + $result = $app['api']->get_databox_terms($app['request'], $databox_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+'); + + $app->get('/databoxes/{any_id}/termsOfUse/', $bad_request_exception); + + + + + + /** + * Route : /records/search/FORMAT/ + * + * Method : GET or POST + * + * Parameters : + * bases[] : array + * status[] : array + * fields[] : array + * record_type : boolean + * media_type : string + * + * Response : + * Array of record objects + * + */ + $route = '/records/search/'; + $app->match( + $route, function() use ($app) + { + $result = $app['api']->search_records($app['request']); + + return $app['response']($result); + } + ); + + + $route = '/records/{databox_id}/{record_id}/caption/'; + $app->get( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->caption_records($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->get('/records/{any_id}/{anyother_id}/caption/', $bad_request_exception); + + + /** + * Route : /records/DATABOX_ID/RECORD_ID/metadatas/FORMAT/ + * + * Method : GET + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/metadatas/'; + $app->get( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->get_record_metadatas($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->get('/records/{any_id}/{anyother_id}/metadatas/', $bad_request_exception); + + /** + * Route : /records/DATABOX_ID/RECORD_ID/status/FORMAT/ + * + * Method : GET + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/status/'; + $app->get( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->get_record_status($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->get('/records/{any_id}/{anyother_id}/status/', $bad_request_exception); + + /** + * Route : /records/DATABOX_ID/RECORD_ID/related/FORMAT/ + * + * Method : GET + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/related/'; + $app->get( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->get_record_related($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->get('/records/{any_id}/{anyother_id}/related/', $bad_request_exception); + + /** + * Route : /records/DATABOX_ID/RECORD_ID/embed/FORMAT/ + * + * Method : GET + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/embed/'; + $app->get( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->get_record_embed($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->get('/records/{any_id}/{anyother_id}/embed/', $bad_request_exception); + + /** + * Route : /records/DATABOX_ID/RECORD_ID/setmetadatas/FORMAT/ + * + * Method : POST + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/setmetadatas/'; + $app->post( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->set_record_metadatas($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->post('/records/{any_id}/{anyother_id}/setmetadatas/', $bad_request_exception); + + /** + * Route : /records/DATABOX_ID/RECORD_ID/setstatus/FORMAT/ + * + * Method : POST + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/setstatus/'; + $app->post( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->set_record_status($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + + $app->post('/records/{any_id}/{anyother_id}/setstatus/', $bad_request_exception); + + + /** + * Route : /records/DATABOX_ID/RECORD_ID/setcollection/FORMAT/ + * + * Method : POST + * + * Parameters : + * DATABOX_ID : required INT + * RECORD_ID : required INT + * + */ + $route = '/records/{databox_id}/{record_id}/setcollection/'; + $app->post( + $route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->set_record_collection($app['request'], $databox_id, $record_id); + + return $app['response']($result); + } + )->assert('databox_id', '\d+')->assert('record_id', '\d+'); + $app->post('/records/{wrong_databox_id}/{wrong_record_id}/setcollection/', $bad_request_exception); + + + $route = '/records/{databox_id}/{record_id}/'; + $app->get($route, function($databox_id, $record_id) use ($app) + { + $result = $app['api']->get_record($app['request'], $databox_id, $record_id); + + return $app['response']($result); + })->assert('databox_id', '\d+')->assert('record_id', '\d+'); + $app->get('/records/{any_id}/{anyother_id}/', $bad_request_exception); + + /** + * Route : /baskets/list/FORMAT/ + * + * Method : POST + * + * Parameters : + * + */ + $route = '/baskets/list/'; + $app->get( + $route, function() use ($app) + { + $result = $app['api']->search_baskets($app['request']); + + return $app['response']($result); + } + ); + + + /** + * Route : /baskets/add/FORMAT/ + * + * Method : POST + * + * Parameters : + * + */ + $route = '/baskets/add/'; + $app->post( + $route, function() use ($app) + { + $result = $app['api']->create_basket($app['request']); + + return $app['response']($result); + } + ); + + + + /** + * Route : /baskets/BASKET_ID/content/FORMAT/ + * + * Method : GET + * + * Parameters : + * BASKET_ID : required INT + * + */ + $route = '/baskets/{basket_id}/content/'; + $app->get( + $route, function($basket_id) use ($app) + { + $result = $app['api']->get_basket($app['request'], $basket_id); + + return $app['response']($result); + } + )->assert('basket_id', '\d+'); + $app->get('/baskets/{wrong_basket_id}/content/', $bad_request_exception); + + + /** + * Route : /baskets/BASKET_ID/settitle/FORMAT/ + * + * Method : GET + * + * Parameters : + * BASKET_ID : required INT + * + */ + $route = '/baskets/{basket_id}/setname/'; + $app->post( + $route, function($basket_id) use ($app) + { + $result = $app['api']->set_basket_title($app['request'], $basket_id); + + return $app['response']($result); + } + )->assert('basket_id', '\d+'); + $app->post('/baskets/{wrong_basket_id}/setname/', $bad_request_exception); + + + /** + * Route : /baskets/BASKET_ID/setdescription/FORMAT/ + * + * Method : POST + * + * Parameters : + * BASKET_ID : required INT + * + */ + $route = '/baskets/{basket_id}/setdescription/'; + $app->post( + $route, function($basket_id) use ($app) + { + $result = $app['api']->set_basket_description($app['request'], $basket_id); + + return $app['response']($result); + } + )->assert('basket_id', '\d+'); + $app->post('/baskets/{wrong_basket_id}/setdescription/', $bad_request_exception); + + /** + * Route : /baskets/BASKET_ID/delete/FORMAT/ + * + * Method : POST + * + * Parameters : + * BASKET_ID : required INT + * + */ + $route = '/baskets/{basket_id}/delete/'; + $app->post( + $route, function($basket_id) use ($app) + { + $result = $app['api']->delete_basket($app['request'], $basket_id); + + return $app['response']($result); + } + )->assert('basket_id', '\d+'); + $app->post('/baskets/{wrong_basket_id}/delete/', $bad_request_exception); + + + /** + * Route : /feeds/list/FORMAT/ + * + * Method : POST + * + * Parameters : + * + */ +// public function search_publications(\Symfony\Component\HttpFoundation\Request $app['request']); + + + $route = '/feeds/list/'; + $app->get( + $route, function() use ($app) + { + $result = $app['api']->search_publications($app['request'], $app['p4user']); + + return $app['response']($result); + } + ); + + /** + * Route : /feeds/PUBLICATION_ID/content/FORMAT/ + * + * Method : GET + * + * Parameters : + * PUBLICATION_ID : required INT + * + */ +// public function get_publication(\Symfony\Component\HttpFoundation\Request $app['request'], $publication_id); + + $route = '/feeds/{feed_id}/content/'; + $app->get( + $route, function($feed_id) use ($app) + { + $result = $app['api']->get_publication($app['request'], $feed_id, $app['p4user']); + + return $app['response']($result); + } + )->assert('feed_id', '\d+'); + $app->get('/feeds/{wrong_feed_id}/content/', $bad_request_exception); + + /** + * ******************************************************************* + * + * Route Errors + * + */ + $app->error(function (\Exception $e) use ($app) + { + + if ($e instanceof \API_V1_exception_methodnotallowed) + $code = \API_V1_result::ERROR_METHODNOTALLOWED; + elseif ($e instanceof Exception\MethodNotAllowedHttpException) + $code = \API_V1_result::ERROR_METHODNOTALLOWED; + elseif ($e instanceof \API_V1_exception_badrequest) + $code = \API_V1_result::ERROR_BAD_REQUEST; + elseif ($e instanceof \API_V1_exception_forbidden) + $code = \API_V1_result::ERROR_FORBIDDEN; + elseif ($e instanceof \API_V1_exception_unauthorized) + $code = \API_V1_result::ERROR_UNAUTHORIZED; + elseif ($e instanceof \API_V1_exception_internalservererror) + $code = \API_V1_result::ERROR_INTERNALSERVERERROR; +// elseif ($e instanceof API_V1_exception_notfound) +// $code = API_V1_result::ERROR_NOTFOUND; + elseif ($e instanceof \Exception_NotFound) + $code = \API_V1_result::ERROR_NOTFOUND; + elseif ($e instanceof Exception\NotFoundHttpException) + $code = \API_V1_result::ERROR_NOTFOUND; + else + $code = \API_V1_result::ERROR_INTERNALSERVERERROR; + + $result = $app['api']->get_error_message($app['request'], $code); + + return $app['response']($result); + }); +//// public function get_version(); +//// +//// +//// /** +//// * Route : /records/DATABOX_ID/RECORD_ID/addtobasket/FORMAT/ +//// * +//// * Method : POST +//// * +//// * Parameters : +//// * DATABOX_ID : required INT +//// * RECORD_ID : required INT +//// * +//// */ +//// public function add_record_tobasket(\Symfony\Component\HttpFoundation\Request $app['request'], $databox_id, $record_id); +//// +//// +//// /** +//// * Route : /feeds/PUBLICATION_ID/remove/FORMAT/ +//// * +//// * Method : GET +//// * +//// * Parameters : +//// * PUBLICATION_ID : required INT +//// * +//// */ +//// public function remove_publications(\Symfony\Component\HttpFoundation\Request $app['request'], $publication_id); +//// +//// +//// /** +//// * Route : /users/search/FORMAT/ +//// * +//// * Method : POST-GET +//// * +//// * Parameters : +//// * +//// */ +//// public function search_users(\Symfony\Component\HttpFoundation\Request $app['request']); +//// +//// /** +//// * Route : /users/USER_ID/access/FORMAT/ +//// * +//// * Method : GET +//// * +//// * Parameters : +//// * USER_ID : required INT +//// * +//// */ +//// public function get_user_acces(\Symfony\Component\HttpFoundation\Request $app['request'], $usr_id); +//// +//// /** +//// * Route : /users/add/FORMAT/ +//// * +//// * Method : POST +//// * +//// * Parameters : +//// * +//// */ +//// public function add_user(\Symfony\Component\HttpFoundation\Request $app['request']); + return $app; + }); diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php new file mode 100644 index 0000000000..e7fb0f513d --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -0,0 +1,666 @@ +get_session(); + + $app["debug"] = $app["Core"]->getConfiguration()->isDebug(); + + $app->get('/', function (\Silex\Application $app) use ($session, $appbox) + { + \User_Adapter::updateClientInfos((6)); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $current_user = $app['Core']->getAuthenticatedUser(); + + /* @var $repository \Repositories\BasketRepository */ + + $basket_collection = array_merge( + $repository->findActiveByUser($current_user) + , $repository->findActiveValidationByUser($current_user) + ); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $browser = \Browser::getInstance(); + + $template = 'lightbox/index.twig'; + if (!$browser->isNewGeneration() && !$browser->isMobile()) + { + $template = 'lightbox/IE6/index.twig'; + } + + $output = $twig->render($template, array( + 'baskets_collection' => $basket_collection, + 'module_name' => 'Lightbox', + 'module' => 'lightbox' + ) + ); + $response = new Response($output); + $response->setCharset('UTF-8'); + + return $response; + } + ); + + $app->get('/ajax/NOTE_FORM/{sselcont_id}/', function(\Silex\Application $app, $sselcont_id) use ($session, $appbox) + { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + $browser = \Browser::getInstance(); + + if (!$browser->isMobile()) + { + return new Response(''); + } + + + $em = $app['Core']->getEntityManager(); + + /* @var $repository \Repositories\BasketElementRepository */ + $repository = $em->getRepository('\Entities\BasketElement'); + + $basket_element = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser()); + + $template = 'lightbox/note_form.twig'; + $output = $twig->render($template, array('basket_element' => $basket_element, 'module_name' => '')); + + return new Response($output); + } + )->assert('sselcont_id', '\d+'); + + $app->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function(\Silex\Application $app, $sselcont_id) + { + $browser = \Browser::getInstance(); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $em = $app['Core']->getEntityManager(); + + /* @var $repository \Repositories\BasketElementRepository */ + $repository = $em->getRepository('\Entities\BasketElement'); + + $BasketElement = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser()); + + if ($browser->isMobile()) + { + $output = $twig->render('lightbox/basket_element.twig', array( + 'basket_element' => $BasketElement, + 'module_name' => $BasketElement->getRecord()->get_title() + ) + ); + + return new Response($output); + } + else + { + $template_options = 'lightbox/sc_options_box.twig'; + $template_agreement = 'lightbox/agreement_box.twig'; + $template_selector = 'lightbox/selector_box.twig'; + $template_note = 'lightbox/sc_note.twig'; + $template_preview = 'common/preview.html'; + $template_caption = 'common/caption.html'; + + if (!$browser->isNewGeneration()) + { + $template_options = 'lightbox/IE6/sc_options_box.twig'; + $template_agreement = 'lightbox/IE6/agreement_box.twig'; + } + $appbox = \appbox::get_instance($app['Core']); + $usr_id = $appbox->get_session()->get_usr_id(); + + + $Basket = $BasketElement->getBasket(); + + $ret = array(); + $ret['number'] = $BasketElement->getRecord()->get_number(); + $ret['title'] = $BasketElement->getRecord()->get_title(); + + $ret['preview'] = $twig->render($template_preview, array('record' => $BasketElement->getRecord(), 'not_wrapped' => true)); + $ret['options_html'] = $twig->render($template_options, array('basket_element' => $BasketElement)); + $ret['agreement_html'] = $twig->render($template_agreement, array('basket' => $Basket, 'basket_element' => $BasketElement)); + $ret['selector_html'] = $twig->render($template_selector, array('basket_element' => $BasketElement)); + $ret['note_html'] = $twig->render($template_note, array('basket_element' => $BasketElement)); + $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $BasketElement->getRecord())); + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($ret, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + } + } + )->assert('sselcont_id', '\d+'); + + + + + $app->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(\Silex\Application $app, $entry_id, $item_id) + { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $appbox = \appbox::get_instance($app['Core']); + $entry = \Feed_Entry_Adapter::load_from_id($appbox, $entry_id); + $item = new \Feed_Entry_Item($appbox, $entry, $item_id); + + $browser = \Browser::getInstance(); + + if ($browser->isMobile()) + { + $output = $twig->render('lightbox/feed_element.twig', array( + 'feed_element' => $item, + 'module_name' => $item->get_record()->get_title() + ) + ); + + return new Response($output); + } + else + { + $template_options = 'lightbox/feed_options_box.twig'; + $template_preview = 'common/preview.html'; + $template_caption = 'common/caption.html'; + + if (!$browser->isNewGeneration()) + { + $template_options = 'lightbox/IE6/feed_options_box.twig'; + } + $usr_id = $appbox->get_session()->get_usr_id(); + + $ret = array(); + $ret['number'] = $item->get_record()->get_number(); + $ret['title'] = $item->get_record()->get_title(); + + $ret['preview'] = $twig->render($template_preview, array('record' => $item->get_record(), 'not_wrapped' => true)); + $ret['options_html'] = $twig->render($template_options, array('feed_element' => $item)); + $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $item->get_record())); + + + $ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = ''; + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($ret, 'json') + , 200 + , array('Content-type' => 'application/json') + ); + } + } + )->assert('entry_id', '\d+')->assert('item_id', '\d+'); + + $app->get('/validate/{ssel_id}/', function (\Silex\Application $app, $ssel_id) use ($session, $appbox) + { + + \User_Adapter::updateClientInfos((6)); + + $browser = \Browser::getInstance(); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $basket_collection = $repository->findActiveValidationAndBasketByUser( + $app['Core']->getAuthenticatedUser() + ); + + $basket = $repository->findUserBasket( + $ssel_id + , $app['Core']->getAuthenticatedUser() + , false + ); + + + if ($basket->getIsRead() === false) + { + $basket = $em->merge($basket); + $basket->setIsRead(true); + $em->flush(); + } + + if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) + { + $basket = $em->merge($basket); + $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true); + $em->flush(); + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $template = 'lightbox/validate.twig'; + + if (!$browser->isNewGeneration() && !$browser->isMobile()) + $template = 'lightbox/IE6/validate.twig'; + + $response = new Response($twig->render($template, array( + 'baskets_collection' => $basket_collection, + 'basket' => $basket, + 'local_title' => strip_tags($basket->getName()), + 'module' => 'lightbox', + 'module_name' => _('admin::monitor: module validation') + ) + )); + $response->setCharset('UTF-8'); + + return $response; + } + )->assert('ssel_id', '\d+'); + + $app->get('/compare/{ssel_id}/', function (\Silex\Application $app, $ssel_id) use ($session, $appbox) + { + + \User_Adapter::updateClientInfos((6)); + + $browser = \Browser::getInstance(); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $basket_collection = $repository->findActiveValidationAndBasketByUser( + $app['Core']->getAuthenticatedUser() + ); + + $basket = $repository->findUserBasket( + $ssel_id + , $app['Core']->getAuthenticatedUser() + , false + ); + + + if ($basket->getIsRead() === false) + { + $basket = $em->merge($basket); + $basket->setIsRead(true); + $em->flush(); + } + + if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) + { + $basket = $em->merge($basket); + $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true); + $em->flush(); + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $template = 'lightbox/validate.twig'; + + if (!$browser->isNewGeneration() && !$browser->isMobile()) + $template = 'lightbox/IE6/validate.twig'; + + $response = new Response($twig->render($template, array( + 'baskets_collection' => $basket_collection, + 'basket' => $basket, + 'local_title' => strip_tags($basket->getName()), + 'module' => 'lightbox', + 'module_name' => _('admin::monitor: module validation') + ) + )); + $response->setCharset('UTF-8'); + + return $response; + } + )->assert('ssel_id', '\d+'); + + + + $app->get('/feeds/entry/{entry_id}/', function (\Silex\Application $app, $entry_id) use ($session, $appbox) + { + + \User_Adapter::updateClientInfos((6)); + + $browser = \Browser::getInstance(); + + $feed_entry = \Feed_Entry_Adapter::load_from_id($appbox, $entry_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $template = 'lightbox/feed.twig'; + + if (!$browser->isNewGeneration() && !$browser->isMobile()) + $template = 'lightbox/IE6/feed.twig'; + + $output = $twig->render($template, array( + 'feed_entry' => $feed_entry, + 'first_item' => array_shift($feed_entry->get_content()), + 'local_title' => $feed_entry->get_title(), + 'module' => 'lightbox', + 'module_name' => _('admin::monitor: module validation') + ) + ); + $response = new Response($output, 200); + $response->setCharset('UTF-8'); + + return $response; + } + )->assert('entry_id', '\d+'); + + $app->get('/ajax/LOAD_REPORT/{ssel_id}/', function(\Silex\Application $app, $ssel_id) + { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $browser = \Browser::getInstance(); + + $template = 'lightbox/basket_content_report.twig'; + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $basket = $repository->findUserBasket( + $ssel_id + , $app['Core']->getAuthenticatedUser() + , false + ); + + $response = new Response($twig->render($template, array('basket' => $basket))); + $response->setCharset('UTF-8'); + + return $response; + } + )->assert('ssel_id', '\d+'); + + $app->post('/ajax/SET_NOTE/{sselcont_id}/', function (\Silex\Application $app, $sselcont_id) + { + $output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')); + + $request = $app['request']; + $note = $request->get('note'); + + if (is_null($note)) + { + Return new Response('You must provide a note value', 400); + } + + $em = $app['Core']->getEntityManager(); + + /* @var $repository \Repositories\BasketElementRepository */ + $repository = $em->getRepository('\Entities\BasketElement'); + + $basket_element = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser()); + + $validationDatas = $basket_element->getUserValidationDatas($app['Core']->getAuthenticatedUser()); + + $validationDatas->setNote($note); + + $em->merge($validationDatas); + + $em->flush(); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $browser = \Browser::getInstance(); + + if ($browser->isMobile()) + { + $datas = $twig->render('lightbox/sc_note.twig', array('basket_element' => $basket_element)); + + $output = array('error' => false, 'datas' => $datas); + } + else + { + $template = 'lightbox/sc_note.twig'; + + $datas = $twig->render($template, array('basket_element' => $basket_element)); + + $output = array('error' => false, 'datas' => $datas); + } + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($output, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + } + )->assert('sselcont_id', '\d+'); + + $app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(\Silex\Application $app, $sselcont_id) + { + $request = $app['request']; + $agreement = $request->get('agreement'); + + if (is_null($agreement)) + { + Return new Response('You must provide an agreement value', 400); + } + + $agreement = $agreement > 0; + + $releasable = false; + try + { + $ret = array( + 'error' => true, + 'releasable' => false, + 'datas' => _('Erreur lors de la mise a jour des donnes ') + ); + + $user = $app['Core']->getAuthenticatedUser(); + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\BasketElement'); + + /* @var $repository \Repositories\BasketElementRepository */ + $basket_element = $repository->findUserElement( + $sselcont_id + , $user + ); + /* @var $basket_element \Entities\BasketElement */ + $validationDatas = $basket_element->getUserValidationDatas($user); + + if (!$basket_element->getBasket() + ->getValidation() + ->getParticipant($user)->getCanAgree()) + { + throw new ControllerException('You can not agree on this'); + } + + $validationDatas->setAgreement($agreement); + + $participant = $basket_element->getBasket() + ->getValidation() + ->getParticipant($user); + + $em->merge($basket_element); + + $em->flush(); + + $releasable = false; + if ($participant->isReleasable() === true) + { + $releasable = _('Do you want to send your report ?'); + } + + $ret = array( + 'error' => false + , 'datas' => '' + , 'releasable' => $releasable + ); + } + catch (ControllerException $e) + { + $ret['datas'] = $e->getMessage(); + } + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($ret, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + } + )->assert('sselcont_id', '\d+'); + + + $app->post('/ajax/SET_RELEASE/{ssel_id}/', function(\Silex\Application $app, $ssel_id) use ($session, $appbox) + { + + $em = $app['Core']->getEntityManager(); + + $user = $app['Core']->getAuthenticatedUser(); + + $repository = $em->getRepository('\Entities\Basket'); + + $datas = array('error' => true, 'datas' => ''); + + try + { + /* @var $repository \Repositories\BasketRepository */ + $basket = $repository->findUserBasket( + $ssel_id + , $user + , false + ); + + if (!$basket->getValidation()) + { + throw new ControllerException('There is no validation session attached to this basket'); + } + + if (!$basket->getValidation()->getParticipant($user)->getCanAgree()) + { + throw new ControllerException('You have not right to agree'); + } + + /* @var $basket \Entities\Basket */ + $participant = $basket->getValidation()->getParticipant($user); + + $appbox = \appbox::get_instance($app['Core']); + $evt_mngr = \eventsmanager_broker::getInstance($appbox, $app['Core']); + + $expires = new \DateTime('+10 days'); + $url = $appbox->get_registry()->get('GV_ServerName') + . 'lightbox/index.php?LOG=' . \random::getUrlToken( + \random::TYPE_VALIDATE + , $basket->getValidation()->getInitiator()->get_id() + , $expires + , $basket->getId() + ); + + + $to = $basket->getValidation()->getInitiator()->get_id(); + $params = array( + 'ssel_id' => $basket->getId(), + 'from' => $app['Core']->getAuthenticatedUser()->get_id(), + 'url' => $url, + 'to' => $to + ); + + + + $evt_mngr->trigger('__VALIDATION_DONE__', $params); + + + $participant->setIsConfirmed(true); + + $em->merge($participant); + + $em->flush(); + + $datas = array('error' => false, 'datas' => _('Envoie avec succes')); + } + catch (ControllerException $e) + { + $datas = array('error' => true, 'datas' => $e->getMessage()); + } + + $Serializer = $app['Core']['Serializer']; + + $response = new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + + $response->setCharset('UTF-8'); + + return $response; + } + )->assert('ssel_id', '\d+'); + + + + $app->error(function($e) use($app) + { + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + $registry = \registry::get_instance(); + + $template = 'lightbox/error.twig'; + + if ($registry->get('GV_debug')) + { + $options = array( + 'module' => 'validation', + 'module_name' => _('admin::monitor: module validation'), + 'error' => sprintf( + '%s in %s on line %s ' + , $e->getMessage() + , $e->getFile() + , $e->getLine() + ) + ); + } + else + { + $options = array( + 'module' => 'validation', + 'module_name' => _('admin::monitor: module validation'), + 'error' => '' + ); + } + $output = $twig->render($template, $options); + $response = new Response($output, 404); + $response->setCharset('UTF-8'); + + return $response; + }); + + return $app; + } +); diff --git a/lib/classes/module/api/OAuthv2.php b/lib/Alchemy/Phrasea/Application/OAuth2.php similarity index 74% rename from lib/classes/module/api/OAuthv2.php rename to lib/Alchemy/Phrasea/Application/OAuth2.php index e27cdc31ee..78b423e05e 100644 --- a/lib/classes/module/api/OAuthv2.php +++ b/lib/Alchemy/Phrasea/Application/OAuth2.php @@ -9,6 +9,17 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Application; + +require_once __DIR__ . "/../../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../../lib/classes/API/OAuth2/Autoloader.class.php"; + +\API_OAuth2_Autoloader::register(); + +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; + /** * * @@ -20,40 +31,26 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../../lib/bootstrap.php"; -require_once dirname(__FILE__) . "/../../../../lib/classes/API/OAuth2/Autoloader.class.php"; -bootstrap::register_autoloads(); -API_OAuth2_Autoloader::register(); - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - return call_user_func(function() { - $app = new Silex\Application(); + $app = new \Silex\Application(); - $app->register(new Silex\Provider\ValidatorServiceProvider(), array( + $app['Core'] = \bootstrap::getCore(); + + $app->register(new \Silex\Provider\ValidatorServiceProvider(), array( 'validator.class_path' => __DIR__ . '/../../../../lib/vendor/symfony/src', )); - $app['appbox'] = function() + $app['appbox'] = function() use ($app) { - return appbox::get_instance(); + return \appbox::get_instance($app['Core']); }; - $app['supertwig'] = $app->share(function() - { - $twig = new supertwig(); - $twig->addFilter(array('prettyDate' => 'phraseadate::getPrettyString')); - - return $twig; - }); $app['oauth'] = function($app) { - return new API_OAuth2_Adapter($app['appbox']); + return new \API_OAuth2_Adapter($app['appbox']); }; @@ -61,7 +58,7 @@ return call_user_func(function() { if ($app['appbox']->get_session()->is_authenticated()) { - $user = user_adapter::getInstance( + $user = \user_adapter::getInstance( $app['appbox']->get_session()->get_usr_id() , $app['appbox'] ); @@ -82,8 +79,11 @@ return call_user_func(function() */ $app['response'] = $app->protect(function ($template, $variable) use ($app) { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + $response = new Response( - $app['supertwig']->render($template, $variable) + $twig->render($template, $variable) , 200 , array('Content-Type' => 'text/html') ); @@ -108,7 +108,8 @@ return call_user_func(function() { $request = $app['request']; $oauth2_adapter = $app['oauth']; - $twig = $app['supertwig']; + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); $session = $app['appbox']->get_session(); //Check for auth params, send error or redirect if not valid @@ -118,7 +119,7 @@ return call_user_func(function() $app_authorized = false; $errorMessage = false; - $client = API_OAuth2_Application::load_from_client_id($app['appbox'], $params['client_id']); + $client = \API_OAuth2_Application::load_from_client_id($app['appbox'], $params['client_id']); $oauth2_adapter->setClient($client); @@ -141,10 +142,10 @@ return call_user_func(function() { $login = $request->get("login"); $password = $request->get("password"); - $auth = new Session_Authentication_Native($app['appbox'], $login, $password); + $auth = new \Session_Authentication_Native($app['appbox'], $login, $password); $session->authenticate($auth); } - catch (Exception $e) + catch (\Exception $e) { $params = array( "auth" => $oauth2_adapter @@ -172,7 +173,7 @@ return call_user_func(function() } //check if current client is alreadu authorized by current user - $user_auth_clients = API_OAuth2_Application::load_authorized_app_by_user($app['appbox'], $app['user']); + $user_auth_clients = \API_OAuth2_Application::load_authorized_app_by_user($app['appbox'], $app['user']); foreach ($user_auth_clients as $auth_client) { @@ -206,6 +207,7 @@ return call_user_func(function() if ($oauth2_adapter->isNativeApp($params['redirect_uri'])) { $params = $oauth2_adapter->finishNativeClientAuthorization($app_authorized, $params); + $params['user'] = $app['user']; $html = $twig->render("api/auth/native_app_access_token.twig", $params); return new Response($html, 200, array("content-type" => "text/html")); @@ -248,7 +250,7 @@ return call_user_func(function() $route = '/applications'; $app->get($route, function() use ($app) { - $apps = API_OAuth2_Application::load_app_by_user($app['appbox'], $app['user']); + $apps = \API_OAuth2_Application::load_app_by_user($app['appbox'], $app['user']); return $app['response']('api/auth/applications.twig', array("apps" => $apps, 'user' => $app['user'])); }); @@ -259,7 +261,7 @@ return call_user_func(function() $route = "/applications/dev"; $app->get($route, function() use ($app) { - $rs = API_OAuth2_Application::load_dev_app_by_user($app['appbox'], $app['user']); + $rs = \API_OAuth2_Application::load_dev_app_by_user($app['appbox'], $app['user']); return $app['response']('api/auth/application_dev.twig', array("apps" => $rs)); }); @@ -270,7 +272,7 @@ return call_user_func(function() $route = "/applications/dev/new"; $app->get($route, function() use ($app) { - $var = array("violations" => null); + $var = array("violations" => null, 'form' => null, 'request' => $app['request']); return $app['response']('api/auth/application_dev_new.twig', $var); }); @@ -281,7 +283,15 @@ return call_user_func(function() $app->post($route, function() use ($app) { $submit = false; - $post = new API_OAuth2_Form_DevApp($app['request']); + if ($app['request']->get("type") == "desktop") + { + $post = new \API_OAuth2_Form_DevAppDesktop($app['request']); + } + else + { + $post = new \API_OAuth2_Form_DevAppInternet($app['request']); + } + $violations = $app['validator']->validate($post); if ($violations->count() == 0) @@ -291,11 +301,11 @@ return call_user_func(function() if ($submit) { - $application = API_OAuth2_Application::create($app['appbox'], $app['user'], $request->get('name')); - $application->set_description($request->get('description')) - ->set_redirect_uri($request->get('callback')) - ->set_type($request->get('type')) - ->set_website($request->get('website')); + $application = \API_OAuth2_Application::create($app['appbox'], $app['user'], $post->getName()); + $application->set_description($post->getDescription()) + ->set_redirect_uri($post->getSchemeCallback().$post->getCallback()) + ->set_type($post->getType()) + ->set_website($post->getSchemeWebsite().$post->getWebsite()); return $app->redirect("/api/oauthv2/applications/dev/" . $application->get_id() . "/show"); } @@ -315,12 +325,12 @@ return call_user_func(function() $route = "/applications/dev/{id}/show"; $app->get($route, function($id) use ($app) { - $client = new API_OAuth2_Application($app['appbox'], $id); + $client = new \API_OAuth2_Application($app['appbox'], $id); $token = $client->get_user_account($app['user'])->get_token()->get_value(); $var = array("app" => $client, "user" => $app['user'], "token" => $token); return $app['response']('api/auth/application_dev_show.twig', $var); - }); + })->assert('id', '\d+'); /** * revoke access from a user to the app @@ -332,16 +342,22 @@ return call_user_func(function() $result = array("ok" => false); try { - $account = new API_OAuth2_Account($app['appbox'], $app['request']->get('account_id')); + $account = new \API_OAuth2_Account($app['appbox'], $app['request']->get('account_id')); $account->set_revoked((bool) $app['request']->get('revoke')); $result['ok'] = true; } - catch (Exception $e) + catch (\Exception $e) { } - return new Response(json_encode($result), 200, array("content-type" => "application/json")); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($result, 'json') + , 200 + , array("content-type" => "application/json") + ); }); $route = "/applications/{id}/generate_access_token/"; @@ -350,7 +366,7 @@ return call_user_func(function() $result = array("ok" => false); try { - $client = new API_OAuth2_Application($app['appbox'], $id); + $client = new \API_OAuth2_Application($app['appbox'], $id); $account = $client->get_user_account($app['user']); $token = $account->get_token(); @@ -358,20 +374,26 @@ return call_user_func(function() if ($token instanceof API_OAuth2_Token) $token->renew(); else - $token = API_OAuth2_Token::create($app['appbox'], $account); + $token = \API_OAuth2_Token::create($app['appbox'], $account); $result = array( "ok" => true , 'token' => $token->get_value() ); } - catch (Exception $e) + catch (\Exception $e) { } - return new response(json_encode($result), 200, array("content-type" => "application/json")); - }); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($result, 'json') + , 200 + , array("content-type" => "application/json") + ); + })->assert('id', '\d+'); $route = "/applications/oauth_callback"; $app->post($route, function() use ($app) @@ -381,16 +403,22 @@ return call_user_func(function() $result = array("success" => false); try { - $client = new API_OAuth2_Application($app['appbox'], $app_id); + $client = new \API_OAuth2_Application($app['appbox'], $app_id); $client->set_redirect_uri($app_callback); $result['success'] = true; } - catch (Exception $e) + catch (\Exception $e) { } - return new Response(json_encode($result), 200, array("content-type" => "application/json")); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($result, 'json') + , 200 + , array("content-type" => "application/json") + ); }); $route = "/applications/{id}"; @@ -399,33 +427,39 @@ return call_user_func(function() $result = array("success" => false); try { - $client = new API_OAuth2_Application($app['appbox'], $id); + $client = new \API_OAuth2_Application($app['appbox'], $id); $client->delete(); $result['success'] = true; } - catch (Exception $e) + catch (\Exception $e) { } - return new Response(json_encode($result), 200, array("content-type" => "application/json")); - }); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($result, 'json') + , 200 + , array("content-type" => "application/json") + ); + })->assert('id', '\d+'); /** * ******************************************************************* * * Route Errors * */ - $app->error(function (Exception $e) use ($app) + $app->error(function (\Exception $e) use ($app) { - if ($e instanceof NotFoundHttpException || $e instanceof Exception_NotFound) + if ($e instanceof NotFoundHttpException || $e instanceof \Exception_NotFound) { return new Response('The requested page could not be found.', 404); } $code = $e instanceof HttpExceptionInterface ? $e->getStatusCode() : 500; - return new Response('We are sorry, but something went terribly wrong.
' . $e->getMessage(), $code); + return new Response('We are sorry, but something went wrong.
' . $e->getMessage(), $code); }); diff --git a/lib/Alchemy/Phrasea/Application/Overview.php b/lib/Alchemy/Phrasea/Application/Overview.php new file mode 100644 index 0000000000..00f466468a --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Overview.php @@ -0,0 +1,248 @@ +get_session(); + + $app["debug"] = $app["Core"]->getConfiguration()->isDebug(); + + $deliver_content = function(\Session_Handler $session, \record_adapter $record, $subdef, $watermark, $stamp, $app) + { + + $file = $record->get_subdef($subdef); + if ($file->get_baseurl() !== '') + { + return $app->redirect($file->get_url()); + } + + $pathIn = $pathOut = $file->get_pathfile(); + + if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) + { + $pathOut = \recordutils_image::watermark($record->get_base_id(), $record->get_record_id()); + } + elseif ($stamp === true && $file->get_type() === \media_subdef::TYPE_IMAGE) + { + $pathOut = \recordutils_image::stamp($record->get_base_id(), $record->get_record_id()); + } + + + $log_id = null; + try + { + $registry = \registry::get_instance(); + $logger = $session->get_logger($record->get_databox()); + $log_id = $logger->get_id(); + + $referrer = 'NO REFERRER'; + + if (isset($_SERVER['HTTP_REFERER'])) + $referrer = $_SERVER['HTTP_REFERER']; + + $record->log_view($log_id, $referrer, $registry->get('GV_sit')); + } + catch (\Exception $e) + { + + } + + return \set_export::stream_file($pathOut, $file->get_file(), $file->get_mime(), 'attachment'); + }; + + $app->get('/datafiles/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef) use ($app, $session, $deliver_content) + { + + $databox = \databox::get_instance((int) $sbas_id); + $record = new \record_adapter($sbas_id, $record_id); + + $record->get_type(); + + if (!$session->is_authenticated()) + throw new \Exception_Session_NotAuthenticated(); + + $user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core'])); + + if (!$user->ACL()->has_access_to_subdef($record, $subdef)) + throw new \Exception_UnauthorizedAction(); + + $stamp = false; + $watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark'); + + if ($watermark) + { + $subdef_class = $databox + ->get_subdef_structure() + ->get_subdef($record->get_type(), $subdef) + ->get_class(); + + if ($subdef_class == \databox_subdefAbstract::CLASS_PREVIEW && $user->ACL()->has_preview_grant($record)) + { + $watermark = false; + } + elseif ($subdef_class == \databox_subdefAbstract::CLASS_DOCUMENT && $user->ACL()->has_hd_grant($record)) + { + $watermark = false; + } + } + + if ($watermark) + { + + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\BasketElement'); + + /* @var $repository \Repositories\BasketElementRepository */ + + $ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $user); + $ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $user); + + if ($ValidationByRecord && $ValidationByRecord->count() > 0) + { + $watermark = false; + } + elseif ($ReceptionByRecord && $ReceptionByRecord->count() > 0) + { + $watermark = false; + } + } + + return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/view/' + , function($label, $sbas_id, $record_id, $key, $subdef) use($app) + { + + $databox = \databox::get_instance((int) $sbas_id); + $record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef); + if (!($record instanceof \record_adapter)) + throw new \Exception('bad luck'); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render('overview.twig', array('subdef_name' => $subdef, 'module_name' => 'overview', 'module' => 'overview', 'view' => 'overview', 'record' => $record)); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/' + , function($label, $sbas_id, $record_id, $key, $subdef) use ($app, $session, $deliver_content) + { + $databox = \databox::get_instance((int) $sbas_id); + $record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef); + if (!($record instanceof \record_adapter)) + throw new \Exception('bad luck'); + + $watermark = $stamp = false; + + if ($session->is_authenticated()) + { + $user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core'])); + + $watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark'); + + if ($watermark) + { + + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\BasketElement'); + + if ($repository->findReceivedValidationElementsByRecord($record, $user)->count() > 0) + { + $watermark = false; + } + elseif ($repository->findReceivedElementsByRecord($record, $user)->count() > 0) + { + $watermark = false; + } + } + + return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); + } + else + { + $collection = \collection::get_from_base_id($record->get_base_id()); + switch ($collection->get_pub_wm()) + { + default: + case 'none': + $watermark = false; + break; + case 'stamp': + $stamp = true; + break; + case 'wm': + $watermark = false; + break; + } + } + + return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); + } + ) + ->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $app->error(function (\Exception $e) + { + if ($e instanceof \Exception_Session_NotAuthenticated) + { + $code = 403; + $message = 'Forbidden'; + } + elseif ($e instanceof \Exception_NotAllowed) + { + $code = 403; + $message = 'Forbidden'; + } + elseif ($e instanceof \Exception_NotFound) + { + $code = 404; + $message = 'Not Found'; + } + else + { + $code = 404; + $message = 'Not Found'; + } + + return new Response($message, $code); + }); + + + + + return $app; + } +); diff --git a/lib/Alchemy/Phrasea/Application/Prod.php b/lib/Alchemy/Phrasea/Application/Prod.php new file mode 100644 index 0000000000..2d65ce3bf4 --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Prod.php @@ -0,0 +1,134 @@ +getConfiguration()->isDebug(); + + $app->before(function(Request $request) + { + $request->setRequestFormat( + $request->getFormat( + array_shift( + $request->getAcceptableContentTypes() + ) + ) + ); + }); + + $app->mount('/UserPreferences/', new Controller\UserPreferences()); + $app->mount('/query/', new Controller\Query()); + $app->mount('/baskets', new Controller\Basket()); + $app->mount('/story', new Controller\Story()); + $app->mount('/WorkZone', new Controller\WorkZone()); + $app->mount('/lists', new Controller\UsrLists()); + $app->mount('/MustacheLoader', new Controller\MustacheLoader()); + $app->mount('/records/edit', new Controller\Edit()); + $app->mount('/records/movecollection', new Controller\MoveCollection()); + $app->mount('/bridge/', new Controller\Bridge()); + $app->mount('/push/', new Controller\Push()); + $app->mount('/printer/', new Controller\Printer()); + $app->mount('/TOU/', new Controller\TOU()); + $app->mount('/feeds', new Controller\Feed()); + $app->mount('/tooltip', new Controller\Tooltip()); + $app->mount('/language', new Controller\Language()); + $app->mount('/', new Controller\Root()); + + $app->error(function (\Exception $e, $code) use ($app) + { + /* @var $request \Symfony\Component\HttpFoundation\Request */ + $request = $app['request']; + + if ($e instanceof \Bridge_Exception) + { + + $params = array( + 'message' => $e->getMessage() + , 'file' => $e->getFile() + , 'line' => $e->getLine() + , 'r_method' => $request->getMethod() + , 'r_action' => $request->getRequestUri() + , 'r_parameters' => ($request->getMethod() == 'GET' ? array() : $request->request->all()) + ); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + if ($e instanceof \Bridge_Exception_ApiConnectorNotConfigured) + { + $params = array_merge($params, array('account' => $app['current_account'])); + + return new response($twig->render('/prod/actions/Bridge/notconfigured.twig', $params), 200); + } + elseif ($e instanceof \Bridge_Exception_ApiConnectorNotConnected) + { + $params = array_merge($params, array('account' => $app['current_account'])); + + return new response($twig->render('/prod/actions/Bridge/disconnected.twig', $params), 200); + } + elseif ($e instanceof \Bridge_Exception_ApiConnectorAccessTokenFailed) + { + $params = array_merge($params, array('account' => $app['current_account'])); + + return new response($twig->render('/prod/actions/Bridge/disconnected.twig', $params), 200); + } + elseif ($e instanceof \Bridge_Exception_ApiDisabled) + { + $params = array_merge($params, array('api' => $e->get_api())); + + return new response($twig->render('/prod/actions/Bridge/deactivated.twig', $params), 200); + } + + return new response($twig->render('/prod/actions/Bridge/error.twig', $params), 200); + } + if ($request->getRequestFormat() == 'json') + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + + $json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($json, 200, array('Content-Type' => 'application/json')); + } + if($e instanceof \Exception_BadRequest) + { + return new Response('Bad Request', 400); + } + if($e instanceof \Exception_NotFound) + { + return new Response('Not Found', 404); + } + if($e instanceof \Exception_Forbidden) + { + return new Response('Not Found', 403); + } + }); + + + return $app; + }); diff --git a/lib/Alchemy/Phrasea/Application/Root.php b/lib/Alchemy/Phrasea/Application/Root.php new file mode 100644 index 0000000000..3ce3d7c29d --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Root.php @@ -0,0 +1,80 @@ +send(); + } + + $app->get('/', function() use ($app) + { + $browser = \Browser::getInstance(); + if ($browser->isMobile()) + + return $app->redirect("/login/?redirect=/lightbox"); + elseif ($browser->isNewGeneration()) + + return $app->redirect("/login/?redirect=/prod"); + else + + return $app->redirect("/login/?redirect=/client"); + }); + + $app->get('/robots.txt', function() use ($app) + { + $appbox = \appbox::get_instance($app['Core']); + + $registry = $appbox->get_registry(); + + if ($registry->get('GV_allow_search_engine') === true) + { + $buffer = "User-Agent: *\n" + . "Allow: /\n"; + } + else + { + $buffer = "User-Agent: *\n" + . "Disallow: /\n"; + } + + $response = new Response($buffer, 200, array('Content-Type' => 'text/plain')); + $response->setCharset('UTF-8'); + + return $response; + }); + + $app->mount('/feeds/', new Controller\RSSFeeds()); + + return $app; + } +); diff --git a/lib/Alchemy/Phrasea/Application/Setup.php b/lib/Alchemy/Phrasea/Application/Setup.php new file mode 100644 index 0000000000..180615c736 --- /dev/null +++ b/lib/Alchemy/Phrasea/Application/Setup.php @@ -0,0 +1,94 @@ +before(function($a) use ($app) + { + if (\setup::is_installed()) + { + $appbox = \appbox::get_instance($app['Core']); + + if (!$appbox->need_major_upgrade()) + { + throw new \Exception_Setup_PhraseaAlreadyInstalled(); + } + + $app['upgrade'] = true; + } + elseif (\setup::needUpgradeConfigurationFile()) + { + $connexionInc = new \SplFileObject(__DIR__ . '/../../../../config/connexion.inc'); + $configInc = new \SplFileObject(__DIR__ . '/../../../../config/config.inc'); + + $configuration = \Alchemy\Phrasea\Core\Configuration::build(); + $configuration->upgradeFromOldConf($configInc, $connexionInc); + + $app['install'] = true; + } + else + { + $app['install'] = true; + } + + return; + }); + + + $app->get('/', function() use ($app) + { + if ($app['install'] === true) + + return $app->redirect('/setup/installer/'); + if ($app['upgrade'] === true) + + return $app->redirect('/setup/upgrader/'); + }); + + + $app->mount('/installer/', new Controller\Installer()); + $app->mount('/upgrader/', new Controller\Upgrader()); + $app->mount('/test', new ControllerUtils\PathFileTest()); + $app->mount('/connection_test', new ControllerUtils\ConnectionTest()); + + $app->error(function($e) use ($app) + { + if ($e instanceof \Exception_Setup_PhraseaAlreadyInstalled) + { + return $app->redirect('/login/'); + } + + return new Response('Internal Server Error', 500); + }); + + return $app; + }); diff --git a/lib/Alchemy/Phrasea/Cache/ApcCache.php b/lib/Alchemy/Phrasea/Cache/ApcCache.php new file mode 100644 index 0000000000..59f4d643c0 --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/ApcCache.php @@ -0,0 +1,60 @@ +contains($key)) + { + throw new Exception('Unable to retrieve the value'); + } + + return $this->fetch($key); + } + + public function deleteMulti(array $array_keys) + { + foreach ($array_keys as $id) + { + $this->delete($id); + } + + return $this; + } + + public function flush() + { + return apc_clear_cache() && apc_clear_cache('user'); + } + +} diff --git a/lib/Alchemy/Phrasea/Cache/ArrayCache.php b/lib/Alchemy/Phrasea/Cache/ArrayCache.php new file mode 100644 index 0000000000..50e32f7577 --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/ArrayCache.php @@ -0,0 +1,64 @@ +contains($id)) + { + throw new Exception(sprintf('Unable to find key %s', $id)); + } + + return $this->fetch($id); + } + + public function deleteMulti(array $array_keys) + { + foreach ($array_keys as $id) + { + $this->delete($id); + } + + return; + } + + public function flush() + { + $this->deleteAll(); + + return true; + } + +} diff --git a/lib/classes/cache/interface.class.php b/lib/Alchemy/Phrasea/Cache/Cache.php similarity index 63% rename from lib/classes/cache/interface.class.php rename to lib/Alchemy/Phrasea/Cache/Cache.php index 97e36d4fb0..91e94382fd 100644 --- a/lib/classes/cache/interface.class.php +++ b/lib/Alchemy/Phrasea/Cache/Cache.php @@ -9,27 +9,27 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Cache; + +use Doctrine\Common\Cache\Cache as DoctrineCache; + /** * - * @package cache + * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -interface cache_interface +interface Cache extends DoctrineCache { - public function set($key, $value, $expiration); - public function get($key); - - public function delete($key); - - public function deleteMulti(Array $array_keys); + public function isServer(); public function getStats(); public function flush(); - public function get_version(); + public function get($key); + + public function deleteMulti(array $array_keys); - public function ping(); } diff --git a/lib/Alchemy/Phrasea/Cache/Exception.php b/lib/Alchemy/Phrasea/Cache/Exception.php new file mode 100644 index 0000000000..5ed763014f --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/Exception.php @@ -0,0 +1,22 @@ +cacheFile = $file; + $this->parser = new \Symfony\Component\Yaml\Yaml(); + $this->core = $core; + + $this->registry = $this->parser->parse($file); + } + + protected function exists($name) + { + return isset($this->registry[$name]); + } + + public function flushAll() + { + foreach ($this->registry as $cacheKey => $service_name) + { + $this->get($cacheKey, $service_name)->getDriver()->flush(); + } + + return $this; + } + + public function get($cacheKey, $service_name) + { + try + { + $configuration = $this->core->getConfiguration()->getService($service_name); + $service = Builder::create($this->core, $configuration); + $driver = $service->getDriver(); + $write = true; + } + catch (\Exception $e) + { + $configuration = new \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag( + array('type' => 'Cache\\ArrayCache') + ); + $service = Builder::create($this->core, $configuration); + $driver = $service->getDriver(); + $write = false; + } + + if ($this->hasChange($cacheKey, $service_name)) + { + $driver->flush(); + + if ($write) + { + $this->registry[$cacheKey] = $service_name; + $this->save($cacheKey, $service_name); + } + } + + return $service; + } + + protected function hasChange($name, $driver) + { + return $this->exists($name) ? $this->registry[$name] !== $driver : true; + } + + protected function save($name, $driver) + { + $date = new \DateTime(); + + $this->registry[$name] = $driver; + + $datas = sprintf("#LastUpdate: %s\n", $date->format(DATE_ISO8601)) + . $this->parser->dump($this->registry, 6); + + file_put_contents($this->cacheFile->getPathname(), $datas); + } + +} + diff --git a/lib/Alchemy/Phrasea/Cache/MemcacheCache.php b/lib/Alchemy/Phrasea/Cache/MemcacheCache.php new file mode 100644 index 0000000000..084e98bb0a --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/MemcacheCache.php @@ -0,0 +1,60 @@ +getMemcache()->getstats(); + } + + public function get($key) + { + if (!$this->contains($key)) + { + throw new Exception('Unable to retrieve the value'); + } + + return $this->fetch($key); + } + + public function deleteMulti(array $array_keys) + { + foreach ($array_keys as $id) + { + $this->delete($id); + } + + return $this; + } + + public function flush() + { + return $this->getMemcache()->flush(); + } + +} diff --git a/lib/Alchemy/Phrasea/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Cache/RedisCache.php new file mode 100644 index 0000000000..c3234a9940 --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/RedisCache.php @@ -0,0 +1,132 @@ +_redis = $redis; + } + + /** + * Gets the memcache instance used by the cache. + * + * @return Memcache + */ + public function getRedis() + { + return $this->_redis; + } + + /** + * {@inheritdoc} + */ + public function getIds() + { + return $this->_redis->keys('*'); + } + + /** + * {@inheritdoc} + */ + protected function _doFetch($id) + { + return $this->_redis->get($id); + } + + /** + * {@inheritdoc} + */ + protected function _doContains($id) + { + return (bool) $this->_redis->get($id); + } + + /** + * {@inheritdoc} + */ + protected function _doSave($id, $data, $lifeTime = 0) + { + if (0 === $lifeTime) + { + return $this->_redis->set($id, $data); + } + else + { + return $this->_redis->setex($id, $lifeTime, $data); + } + } + + /** + * {@inheritdoc} + */ + protected function _doDelete($id) + { + return $this->_redis->delete($id); + } + + public function isServer() + { + return true; + } + + public function getStats() + { + return null; + } + + public function get($key) + { + if (!$this->contains($key)) + { + throw new Exception('Unable to retrieve the value'); + } + + return $this->fetch($key); + } + + public function deleteMulti(array $array_keys) + { + foreach ($array_keys as $id) + { + $this->delete($id); + } + + return $this; + } + + public function flush() + { + return $this->_redis->flushAll(); + } + +} diff --git a/lib/Alchemy/Phrasea/Cache/XcacheCache.php b/lib/Alchemy/Phrasea/Cache/XcacheCache.php new file mode 100644 index 0000000000..907639727f --- /dev/null +++ b/lib/Alchemy/Phrasea/Cache/XcacheCache.php @@ -0,0 +1,60 @@ +contains($key)) + { + throw new Exception('Unable to retrieve the value'); + } + + return $this->fetch($key); + } + + public function deleteMulti(array $array_keys) + { + foreach ($array_keys as $id) + { + $this->delete($id); + } + + return $this; + } + + public function flush() + { + return xcache_clear_cache(XC_TYPE_VAR, 0); + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Description.php b/lib/Alchemy/Phrasea/Controller/Admin/Description.php new file mode 100644 index 0000000000..53944dcdac --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Admin/Description.php @@ -0,0 +1,177 @@ +post('/{sbas_id}/', function(Application $app, $sbas_id) + { + $Core = $app['Core']; + $user = $Core->getAuthenticatedUser(); + + $request = $app['request']; + + if (!$user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) + { + throw new \Exception_Forbidden('You are not allowed to access this zone'); + } + + $databox = \databox::get_instance((int) $sbas_id); + $fields = $databox->get_meta_structure(); + $available_fields = \databox::get_available_metadatas(); + $available_dc_fields = $databox->get_available_dcfields(); + + + $databox->get_connection()->beginTransaction(); + $error = false; + try + { + if (is_array($request->get('field_ids'))) + { + foreach ($request->get('field_ids') as $id) + { + try + { + $field = \databox_field::get_instance($databox, $id); + $field->set_name($request->get('name_' . $id)); + $field->set_thumbtitle($request->get('thumbtitle_' . $id)); + $field->set_source($request->get('src_' . $id)); + $field->set_multi($request->get('multi_' . $id)); + $field->set_indexable($request->get('indexable_' . $id)); + $field->set_required($request->get('required_' . $id)); + $field->set_separator($request->get('separator_' . $id)); + $field->set_readonly($request->get('readonly_' . $id)); + $field->set_type($request->get('type_' . $id)); + $field->set_tbranch($request->get('tbranch_' . $id)); + $field->set_report($request->get('report_' . $id)); + + $field->setVocabularyControl(null); + $field->setVocabularyRestricted(false); + + try + { + $vocabulary = \Alchemy\Phrasea\Vocabulary\Controller::get($request->get('vocabulary_' . $id)); + $field->setVocabularyControl($vocabulary); + $field->setVocabularyRestricted($request->get('vocabularyrestricted_' . $id)); + } + catch (\Exception $e) + { + + } + + $dces_element = null; + + $class = 'databox_Field_DCES_' . $request->get('dces_' . $id); + if (class_exists($class)) + $dces_element = new $class(); + + $field->set_dces_element($dces_element); + $field->save(); + + } + catch (\Exception $e) + { + continue; + } + } + } + + if ($request->get('newfield')) + { + $field = \databox_field::create($databox, $request->get('newfield')); + } + + if (is_array($request->get('todelete_ids'))) + { + foreach ($request->get('todelete_ids') as $id) + { + try + { + $field = \databox_field::get_instance($databox, $id); + $field->delete(); + } + catch (\Exception $e) + { + + } + } + } + } + catch (\Exception $e) + { + $error = true; + } + + if ($error) + $databox->get_connection()->rollBack(); + else + $databox->get_connection()->commit(); + + return new RedirectResponse('/admin/description/' . $sbas_id . '/'); + })->assert('sbas_id', '\d+'); + + $controllers->get('/{sbas_id}/', function(Application $app, $sbas_id) + { + + $Core = $app['Core']; + $user = $Core->getAuthenticatedUser(); + + $request = $app['request']; + + if (!$user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) + { + throw new \Exception_Forbidden('You are not allowed to access this zone'); + } + + $databox = \databox::get_instance((int) $sbas_id); + $fields = $databox->get_meta_structure(); + $available_fields = \databox::get_available_metadatas(); + $available_dc_fields = $databox->get_available_dcfields(); + + + $params = array( + 'databox' => $databox, + 'fields' => $fields, + 'available_fields' => $available_fields, + 'available_dc_fields' => $available_dc_fields, + 'vocabularies' => \Alchemy\Phrasea\Vocabulary\Controller::getAvailable(), + ); + + return new Response($Core->getTwig()->render('admin/databox/doc_structure.twig', $params)); + })->assert('sbas_id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/classes/Controller/Admin/Fields.class.php b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php similarity index 62% rename from lib/classes/Controller/Admin/Fields.class.php rename to lib/Alchemy/Phrasea/Controller/Admin/Fields.php index 6b57acec60..5eb5cae355 100644 --- a/lib/classes/Controller/Admin/Fields.class.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Admin; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,31 +19,41 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -class Controller_Admin_Fields implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class Fields implements ControllerProviderInterface { public function connect(Application $app) { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); -// $session->close_storage(); + $appbox = \appbox::get_instance($app['Core']); $controllers = new ControllerCollection(); - $controllers->get('/checkmulti/', function() use ($app, $appbox) { $request = $app['request']; + $multi = ($request->get('multi') === 'true'); - $metadata = databox_field::load_class_from_xpath($request->get('source')); + $metadata = \databox_field::load_class_from_xpath($request->get('source')); $datas = array( 'result' => ($multi === $metadata->is_multi()) , 'is_multi' => $metadata->is_multi() ); - return new Response(p4string::jsonencode($datas)); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); }); $controllers->get('/checkreadonly/', function() use ($app, $appbox) @@ -55,14 +61,20 @@ class Controller_Admin_Fields implements ControllerProviderInterface $request = $app['request']; $readonly = ($request->get('readonly') === 'true'); - $metadata = databox_field::load_class_from_xpath($request->get('source')); + $metadata = \databox_field::load_class_from_xpath($request->get('source')); $datas = array( 'result' => ($readonly === $metadata->is_readonly()) , 'is_readonly' => $metadata->is_readonly() ); - return new Response(p4string::jsonencode($datas)); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); }); return $controllers; diff --git a/lib/classes/Controller/Admin/Publications.class.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php similarity index 63% rename from lib/classes/Controller/Admin/Publications.class.php rename to lib/Alchemy/Phrasea/Controller/Admin/Publications.php index 5fe10b997c..17540e6126 100644 --- a/lib/classes/Controller/Admin/Publications.class.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Admin; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,25 +19,30 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -class Controller_Admin_Publications implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class Publications implements ControllerProviderInterface { public function connect(Application $app) { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($app['Core']); $session = $appbox->get_session(); $controllers = new ControllerCollection(); $controllers->get('/list/', function() use ($app, $appbox) { - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feeds = Feed_Collection::load_all($appbox, $user); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $feeds = \Feed_Collection::load_all($appbox, $user); $template = 'admin/publications/list.html'; - - $twig = new supertwig(); - $twig->addFilter(array('formatdate' => 'phraseadate::getDate')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, array('feeds' => $feeds)); }); @@ -50,15 +51,15 @@ class Controller_Admin_Publications implements ControllerProviderInterface $controllers->post('/create/', function() use ($app, $appbox) { - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $request = $app['request']; - $feed = Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle')); + $feed = \Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle')); - if($request->get('public') == '1') - $feed->set_public (true); + if ($request->get('public') == '1') + $feed->set_public(true); elseif ($request->get('base_id')) - $feed->set_collection(collection::get_from_base_id($request->get('base_id'))); + $feed->set_collection(\collection::get_from_base_id($request->get('base_id'))); return $app->redirect('/admin/publications/list/'); }); @@ -66,31 +67,25 @@ class Controller_Admin_Publications implements ControllerProviderInterface $controllers->get('/feed/{id}/', function($id) use ($app, $appbox) { - $feed = new Feed_Adapter($appbox, $id); + $feed = new \Feed_Adapter($appbox, $id); - $template = 'admin/publications/fiche.html'; + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); - $twig = new supertwig(); - $twig->addFilter( - array( - 'formatdate' => 'phraseadate::getDate' - ) - ); - - return $twig->render($template + return $twig->render('admin/publications/fiche.html' , array( 'feed' => $feed , 'error' => $app['request']->get('error') ) ); - }); + })->assert('id', '\d+'); $controllers->post('/feed/{id}/update/', function($id) use ($app, $appbox) { - $feed = new Feed_Adapter($appbox, $id); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $feed = new \Feed_Adapter($appbox, $id); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); if (!$feed->is_owner($user)) @@ -100,9 +95,9 @@ class Controller_Admin_Publications implements ControllerProviderInterface try { - $collection = collection::get_from_base_id($request->get('base_id')); + $collection = \collection::get_from_base_id($request->get('base_id')); } - catch (Exception $e) + catch (\Exception $e) { $collection = null; } @@ -113,23 +108,27 @@ class Controller_Admin_Publications implements ControllerProviderInterface $feed->set_public($request->get('public')); return $app->redirect('/admin/publications/list/'); - }); + })->assert('id', '\d+'); $controllers->post('/feed/{id}/iconupload/', function($id) use ($app, $appbox) { - $feed = new Feed_Adapter($appbox, $id); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $feed = new \Feed_Adapter($appbox, $id); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); if (!$feed->is_owner($user)) return new Response('ERROR:you are not allowed'); - if ($_FILES['Filedata']['error'] !== 0) + $request = $app["request"]; + + $fileData = $request->files->get("Filedata"); + + if ($fileData['error'] !== 0) return new Response('ERROR:error while upload'); - $file = new system_file($_FILES['Filedata']['tmp_name']); + $file = new \system_file($fileData['tmp_name']); if (!in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif'))) return new Response('ERROR:bad filetype'); @@ -139,11 +138,11 @@ class Controller_Admin_Publications implements ControllerProviderInterface return new Response('ERROR:file too large'); $datas = $file->get_technical_datas(); - if (!isset($datas[system_file::TC_DATAS_WIDTH]) || !isset($datas[system_file::TC_DATAS_HEIGHT])) + if (!isset($datas[\system_file::TC_DATAS_WIDTH]) || !isset($datas[\system_file::TC_DATAS_HEIGHT])) return new Response('ERROR:file is not square'); - if ($datas[system_file::TC_DATAS_WIDTH] != $datas[system_file::TC_DATAS_HEIGHT]) + if ($datas[\system_file::TC_DATAS_WIDTH] != $datas[\system_file::TC_DATAS_HEIGHT]) return new Response('ERROR:file is not square'); @@ -151,7 +150,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface unlink($file->getPathname()); return new Response('FILEHREF:' . $feed->get_icon_url() . '?' . mt_rand(100000, 999999)); - }); + })->assert('id', '\d+'); $controllers->post('/feed/{id}/addpublisher/', function($id) use ($app, $appbox) { @@ -159,17 +158,17 @@ class Controller_Admin_Publications implements ControllerProviderInterface try { $request = $app['request']; - $user = User_Adapter::getInstance($request->get('usr_id'), $appbox); - $feed = new Feed_Adapter($appbox, $id); + $user = \User_Adapter::getInstance($request->get('usr_id'), $appbox); + $feed = new \Feed_Adapter($appbox, $id); $feed->add_publisher($user); } - catch (Exception $e) + catch (\Exception $e) { $error = $e->getMessage(); } - return $app->redirect('/admin/publications/feed/' . $id . '/'); - }); + return $app->redirect('/admin/publications/feed/' . $id . '/?err=' . $error); + })->assert('id', '\d+'); $controllers->post('/feed/{id}/removepublisher/', function($id) use ($app, $appbox) @@ -178,23 +177,23 @@ class Controller_Admin_Publications implements ControllerProviderInterface { $request = $app['request']; - $feed = new Feed_Adapter($appbox, $id); - $publisher = new Feed_Publisher_Adapter($appbox, $request->get('publisher_id')); + $feed = new \Feed_Adapter($appbox, $id); + $publisher = new \Feed_Publisher_Adapter($appbox, $request->get('publisher_id')); $user = $publisher->get_user(); if ($feed->is_publisher($user) === true && $feed->is_owner($user) === false) $publisher->delete(); } - catch (Exception $e) + catch (\Exception $e) { $error = $e->getMessage(); } return $app->redirect('/admin/publications/feed/' . $id . '/?err=' . $error); - }); + })->assert('id', '\d+'); $controllers->post('/feed/{id}/delete/', function($id) use ($app, $appbox) { - $feed = new Feed_Adapter($appbox, $id); + $feed = new \Feed_Adapter($appbox, $id); $feed->delete(); return $app->redirect('/admin/publications/list/'); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Root.php b/lib/Alchemy/Phrasea/Controller/Admin/Root.php new file mode 100644 index 0000000000..b08067f561 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Admin/Root.php @@ -0,0 +1,114 @@ +get('/', function(Application $app, Request $request) + { + + $Core = $app['Core']; + $appbox = \appbox::get_instance($app['Core']); + $user = $Core->getAuthenticatedUser(); + + \User_Adapter::updateClientInfos(3); + + $section = $request->get('section', false); + + $available = array( + 'connected' + , 'registrations' + , 'taskmanager' + , 'base' + , 'bases' + , 'collection' + , 'user' + , 'users' + ); + + $feature = 'connected'; + $featured = false; + $position = explode(':', $section); + if (count($position) > 0) + { + if (in_array($position[0], $available)) + { + $feature = $position[0]; + if (isset($position[1])) + $featured = $position[1]; + } + } + + $databoxes = $off_databoxes = array(); + foreach ($appbox->get_databoxes() as $databox) + { + try + { + if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) + continue; + + $connbas = $databox->get_connection(); + } + catch (\Exception $e) + { + $off_databoxes[] = $databox; + continue; + } + $databoxes[] = $databox; + } + + + $twig = $Core->getTwig(); + + return new Response($twig->render('admin/index.html.twig', array( + 'module' => 'admin' + , 'events' => \eventsmanager_broker::getInstance($appbox, $Core) + , 'module_name' => 'Admin' + , 'notice' => $request->get("notice") + , 'feature' => $feature + , 'featured' => $featured + , 'databoxes' => $databoxes + , 'off_databoxes' => $off_databoxes + , 'tree' => \module_admin::getTree($section) + )) + ); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php new file mode 100644 index 0000000000..0a59c55afa --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php @@ -0,0 +1,137 @@ +get('/{sbas_id}/', function(Application $app, $sbas_id) + { + $databox = \databox::get_instance((int) $sbas_id); + + return new response($app['Core']->getTwig()->render( + 'admin/subdefs.twig', array( + 'databox' => $databox, + 'subdefs' => $databox->get_subdef_structure() + ) + ) + ); + })->assert('sbas_id', '\d+'); + + $controllers->post('/{sbas_id}/', function(Application $app, Request $request, $sbas_id) + { + $delete_subdef = $request->get('delete_subdef'); + $toadd_subdef = $request->get('add_subdef'); + $Parmsubdefs = $request->get('subdefs', array()); + + $databox = \databox::get_instance((int) $sbas_id); + + $add_subdef = array('class' => null, 'name' => null, 'group' => null); + foreach ($add_subdef as $k => $v) + { + if (!isset($toadd_subdef[$k]) || trim($toadd_subdef[$k]) === '') + unset($add_subdef[$k]); + else + $add_subdef[$k] = $toadd_subdef[$k]; + } + + if ($delete_subdef) + { + $delete_subef = explode('_', $delete_subdef); + $group = $delete_subef[0]; + $name = $delete_subef[1]; + $subdefs = $databox->get_subdef_structure(); + $subdefs->delete_subdef($group, $name); + } + elseif (count($add_subdef) === 3) + { + $subdefs = $databox->get_subdef_structure(); + $UnicodeProcessor = new \unicode(); + + $group = $add_subdef['group']; + $name = $UnicodeProcessor->remove_nonazAZ09($add_subdef['name'], false); + $class = $add_subdef['class']; + + $subdefs->add_subdef($group, $name, $class); + } + else + { + $subdefs = $databox->get_subdef_structure(); + + $options = array(); + + foreach ($Parmsubdefs as $post_sub) + { + $post_sub_ex = explode('_', $post_sub); + + $group = $post_sub_ex[0]; + $name = $post_sub_ex[1]; + + $class = $request->get($post_sub . '_class'); + $downloadable = $request->get($post_sub . '_downloadable'); + + $defaults = array('path', 'baseurl', 'meta', 'mediatype'); + + foreach ($defaults as $def) + { + $parm_loc = $request->get($post_sub . '_' . $def); + + if ($def == 'meta' && !$parm_loc) + { + $parm_loc = "no"; + } + + $options[$def] = $parm_loc; + } + + $mediatype = $request->get($post_sub . '_mediatype'); + $media = $request->get($post_sub . '_' . $mediatype, array()); + + foreach ($media as $option => $value) + { + if ($option == 'resolution' && $mediatype == 'image') + { + $option = 'dpi'; + } + $options[$option] = $value; + } + $subdefs->set_subdef($group, $name, $class, $downloadable, $options); + } + } + + return new RedirectResponse('/admin/subdefs/' . $databox->get_sbas_id() . '/'); + })->assert('sbas_id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/classes/Controller/Admin/Users.class.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php similarity index 58% rename from lib/classes/Controller/Admin/Users.class.php rename to lib/Alchemy/Phrasea/Controller/Admin/Users.php index a71c471422..99748cb6ce 100644 --- a/lib/classes/Controller/Admin/Users.class.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -9,84 +9,98 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Controller\Admin; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Silex\Application; +use Silex\ControllerProviderInterface; +use Silex\ControllerCollection; +use Alchemy\Phrasea\Helper\User as UserHelper; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Silex\Application; -use Silex\ControllerProviderInterface; -use Silex\ControllerCollection; - -class Controller_Admin_Users implements ControllerProviderInterface +class Users implements ControllerProviderInterface { public function connect(Application $app) { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = \appbox::get_instance($app['Core']); $controllers = new ControllerCollection(); - $controllers->post('/rights/', function() use ($app) + $controllers->post('/rights/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $template = 'admin/editusers.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_name' => 'phrasea::bas_names')); - $twig->addFilter(array('sbas_name' => 'phrasea::sbas_names')); - $twig->addFilter(array('sbasFromBas' => 'phrasea::sbasFromBas')); - $twig->addFilter(array('geoname_name_from_id' => 'geonames::name_from_id')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, $rights->get_users_rights()); } ); - $controllers->get('/rights/', function() use ($app) + $controllers->get('/rights/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $template = 'admin/editusers.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_name' => 'phrasea::bas_names')); - $twig->addFilter(array('sbas_name' => 'phrasea::sbas_names')); - $twig->addFilter(array('sbasFromBas' => 'phrasea::sbasFromBas')); - $twig->addFilter(array('geoname_name_from_id' => 'geonames::name_from_id')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, $rights->get_users_rights()); } ); - $controllers->post('/delete/', function() use ($app) + $controllers->post('/rights/reset/', function(Application $app, Request $request) { - $request = $app['request']; + try + { + $core = $app['Core']; + $datas = array('error' => false); + $helper = new UserHelper\Edit($core, $request); + $helper->resetRights(); + } + catch (\Exception $e) + { + $datas['error'] = true; + $datas['message'] = $e->getMessage(); + } + return new Response( + $core->getSerializer()->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + } + ); - $module = new module_admin_route_users_edit($request); + $controllers->post('/delete/', function(Application $app) + { + $module = new UserHelper\Edit($app['Core'], $app['request']); $module->delete_users(); return $app->redirect('/admin/users/search/'); } ); - $controllers->post('/rights/apply/', function() use ($app) + $controllers->post('/rights/apply/', function(Application $app) { $datas = array('error' => true); try { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $rights->apply_rights(); if ($app['request']->get('template')) @@ -98,119 +112,106 @@ class Controller_Admin_Users implements ControllerProviderInterface $datas = array('error' => false); } - catch (Exception $e) + catch (\Exception $e) { $datas['message'] = $e->getMessage(); } + $Serializer = $app['Core']['Serializer']; + return new Response( - p4string::jsonencode($datas) + $Serializer->serialize($datas, 'json') , 200 , array('Content-Type' => 'application/json') ); } ); - $controllers->post('/rights/quotas/', function() use ($app) + $controllers->post('/rights/quotas/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $template = 'admin/editusers_quotas.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_name' => 'phrasea::bas_names')); - $twig->addFilter(array('sbas_name' => 'phrasea::sbas_names')); - $twig->addFilter(array('sbasFromBas' => 'phrasea::sbasFromBas')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, $rights->get_quotas()); } ); - $controllers->post('/rights/quotas/apply/', function() use ($app) + $controllers->post('/rights/quotas/apply/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $rights->apply_quotas(); return; } ); - $controllers->post('/rights/time/', function() use ($app) + $controllers->post('/rights/time/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $template = 'admin/editusers_timelimit.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_name' => 'phrasea::bas_names')); - $twig->addFilter(array('sbas_name' => 'phrasea::sbas_names')); - $twig->addFilter(array('sbasFromBas' => 'phrasea::sbasFromBas')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, $rights->get_time()); } ); - $controllers->post('/rights/time/apply/', function() use ($app) + $controllers->post('/rights/time/apply/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $rights->apply_time(); return; } ); - $controllers->post('/rights/masks/', function() use ($app) + $controllers->post('/rights/masks/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $template = 'admin/editusers_masks.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_name' => 'phrasea::bas_names')); - $twig->addFilter(array('sbas_name' => 'phrasea::sbas_names')); - $twig->addFilter(array('sbasFromBas' => 'phrasea::sbasFromBas')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, $rights->get_masks()); } ); - $controllers->post('/rights/masks/apply/', function() use ($app) + $controllers->post('/rights/masks/apply/', function(Application $app) { - $request = $app['request']; - $rights = new module_admin_route_users_edit($request); + $rights = new UserHelper\Edit($app['Core'], $app['request']); $rights->apply_masks(); return; } ); - $controllers->match('/search/', function() use ($app) + $controllers->match('/search/', function(Application $app) { - $request = $app['request']; - $users = new module_admin_route_users($request); + $users = new UserHelper\Manage($app['Core'], $app['request']); $template = 'admin/users.html'; - $twig = new supertwig(); - $twig->addFilter(array('floor' => 'floor')); - $twig->addFilter(array('getDate' => 'phraseadate::getDate')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); - return $twig->render($template, $users->search($request)); + return $twig->render($template, $users->search()); } ); $controllers->post('/search/export/', function() use ($app) { $request = $app['request']; - $users = new module_admin_route_users($request); + + $users = new UserHelper\Manage($app['Core'], $app['request']); + $template = 'admin/users.html'; - $twig = new supertwig(); - $twig->addFilter(array('floor' => 'floor')); - $twig->addFilter(array('getDate' => 'phraseadate::getDate')); - - $results = $users->export($request); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); $userTable = array( array( @@ -233,7 +234,7 @@ class Controller_Admin_Users implements ControllerProviderInterface ) ); - foreach ($results as $user) + foreach ($users->export() as $user) { /* @var $user \User_Adapter */ $userTable[] = array( @@ -256,7 +257,8 @@ class Controller_Admin_Users implements ControllerProviderInterface ); } - $CSVDatas = format::arr_to_csv($userTable); + + $CSVDatas = \format::arr_to_csv($userTable); $response = new Response($CSVDatas, 200, array('Content-Type' => 'text/plain')); $response->headers->set('Content-Disposition', 'attachment; filename=export.txt'); @@ -267,21 +269,22 @@ class Controller_Admin_Users implements ControllerProviderInterface $controllers->post('/apply_template/', function() use ($app) { - $request = $app['request']; - $users = new module_admin_route_users_edit($request); + $users = new UserHelper\Edit($app['Core'], $app['request']); $users->apply_template(); - return new Symfony\Component\HttpFoundation\RedirectResponse('/admin/users/search/'); + return new RedirectResponse('/admin/users/search/'); } ); - $controllers->get('/typeahead/search/', function() use ($app, $appbox) + $controllers->get('/typeahead/search/', function(Application $app) use ($appbox) { $request = $app['request']; - $user_query = new User_Query($appbox); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $user_query = new \User_Query($appbox); + + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $like_value = $request->get('term'); $rights = $request->get('filter_rights') ? : array(); $have_right = $request->get('have_right') ? : array(); @@ -289,16 +292,18 @@ class Controller_Admin_Users implements ControllerProviderInterface $on_base = $request->get('on_base') ? : array(); - $elligible_users = $user_query->on_sbas_where_i_am($user->ACL(), $rights) - ->like(User_Query::LIKE_EMAIL, $like_value) - ->like(User_Query::LIKE_FIRSTNAME, $like_value) - ->like(User_Query::LIKE_LASTNAME, $like_value) - ->like(User_Query::LIKE_LOGIN, $like_value) - ->like_match(User_Query::LIKE_MATCH_OR) - ->who_have_right($have_right) - ->who_have_not_right($have_not_right) - ->on_base_ids($on_base) - ->execute()->get_results(); + $elligible_users = $user_query + ->on_sbas_where_i_am($user->ACL(), $rights) + ->like(\User_Query::LIKE_EMAIL, $like_value) + ->like(\User_Query::LIKE_FIRSTNAME, $like_value) + ->like(\User_Query::LIKE_LASTNAME, $like_value) + ->like(\User_Query::LIKE_LOGIN, $like_value) + ->like_match(\User_Query::LIKE_MATCH_OR) + ->who_have_right($have_right) + ->who_have_not_right($have_not_right) + ->on_base_ids($on_base) + ->execute() + ->get_results(); $datas = array(); @@ -312,18 +317,24 @@ class Controller_Admin_Users implements ControllerProviderInterface ); } - return new Response(p4string::jsonencode($datas), 200, array('Content-type' => 'application/json')); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-type' => 'application/json') + ); }); - $controllers->post('/create/', function() use ($app) + $controllers->post('/create/', function(Application $app) { $datas = array('error' => false, 'message' => '', 'data' => null); try { $request = $app['request']; - $module = new module_admin_route_users($request); + $module = new UserHelper\Manage($app['Core'], $app['request']); if ($request->get('template') == '1') { $user = $module->create_template(); @@ -332,27 +343,29 @@ class Controller_Admin_Users implements ControllerProviderInterface { $user = $module->create_newuser(); } - if (!($user instanceof User_Adapter)) - throw new Exception('Unknown error'); + if (!($user instanceof \User_Adapter)) + throw new \Exception('Unknown error'); $datas['data'] = $user->get_id(); } - catch (Exception $e) + catch (\Exception $e) { $datas['error'] = true; $datas['message'] = $e->getMessage(); } - return new Response(p4string::jsonencode($datas)); + $Serializer = $app['Core']['Serializer']; + + return new Response($Serializer->serialize($datas, 'json'), 200, array("Content-Type" => "application/json")); } ); - $controllers->post('/export/csv/', function() use ($appbox, $app) + $controllers->post('/export/csv/', function(Application $app) use ($appbox) { $request = $app['request']; - $user_query = new User_Query($appbox); + $user_query = new \User_Query($appbox, $app['Core']); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $like_value = $request->get('like_value'); $like_field = $request->get('like_field'); $on_base = $request->get('base_id') ? : null; @@ -364,7 +377,7 @@ class Controller_Admin_Users implements ControllerProviderInterface ->on_sbas_ids($on_sbas); $offset = 0; - $geoname = new geonames(); + $geoname = new \geonames(); $buffer = array(); $buffer[] = array( @@ -400,8 +413,8 @@ class Controller_Admin_Users implements ControllerProviderInterface , $user->get_lastname() , $user->get_firstname() , $user->get_email() - , phraseadate::format_mysql($user->get_creation_date()) - , phraseadate::format_mysql($user->get_modification_date()) + , \phraseadate::format_mysql($user->get_creation_date()) + , \phraseadate::format_mysql($user->get_modification_date()) , $user->get_address() , $user->get_city() , $user->get_zipcode() @@ -416,11 +429,11 @@ class Controller_Admin_Users implements ControllerProviderInterface } while (count($results) > 0); - $out = format::arr_to_csv($buffer); + $out = \format::arr_to_csv($buffer); $headers = array( 'Content-type' => 'text/csv' - , 'Content-Disposition' => 'attachment; filename=export.txt;' + , 'Content-Disposition' => 'attachment; filename=export.txt' ); $response = new Response($out, 200, $headers); $response->setCharset('UTF-8'); @@ -433,3 +446,4 @@ class Controller_Admin_Users implements ControllerProviderInterface } } + diff --git a/lib/Alchemy/Phrasea/Controller/Exception.php b/lib/Alchemy/Phrasea/Controller/Exception.php new file mode 100644 index 0000000000..4fc86eb317 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Exception.php @@ -0,0 +1,21 @@ +post('/', function(Application $app) + { + $request = $app['request']; + + /* @var $request \Symfony\Component\HttpFoundation\Request */ + + $em = $app['Core']->getEntityManager(); + + $user = $app['Core']->getAuthenticatedUser(); + + $Basket = new \Entities\Basket(); + + $Basket->setName($request->get('name', '')); + $Basket->setOwner($app['Core']->getAuthenticatedUser()); + $Basket->setDescription($request->get('desc')); + + $em->persist($Basket); + + $n = 0; + + foreach (explode(';', $request->get('lst')) as $sbas_rec) + { + $sbas_rec = explode('_', $sbas_rec); + + if (count($sbas_rec) !== 2) + continue; + + $record = new \record_adapter($sbas_rec[0], $sbas_rec[1]); + + if (!$user->ACL()->has_access_to_base($record->get_base_id()) + && !$user->ACL()->has_hd_grant($record) + && !$user->ACL()->has_preview_grant($record)) + { + continue; + } + + if ($Basket->hasRecord($record)) + continue; + + $basket_element = new \Entities\BasketElement(); + $basket_element->setRecord($record); + $basket_element->setBasket($Basket); + + $em->persist($basket_element); + + $Basket->addBasketElement($basket_element); + + $n++; + } + + $em->flush(); + + if ($request->getRequestFormat() == 'json') + { + $data = array( + 'success' => true + , 'message' => _('Basket created') + , 'basket' => array( + 'id' => $Basket->getId() + ) + ); + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse(sprintf('/%d/', $Basket->getId())); + } + }); + + /** + * This route is used to delete a basket + * + * @accept JSON / HTML + * + */ + $controllers->post('/{basket_id}/delete/', function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + $em->remove($basket); + $em->flush(); + + $data = array( + 'success' => true + , 'message' => _('Basket has been deleted') + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+'); + + /** + * Removes a BasketElement + */ + $controllers->post( + '/{basket_id}/delete/{basket_element_id}/' + , function(Application $app, Request $request, $basket_id, $basket_element_id) + { + /* @var $em \Doctrine\ORM\EntityManager */ + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + foreach ($basket->getElements() as $basket_element) + { + /* @var $basket_element \Entities\BasketElement */ + if ($basket_element->getId() == $basket_element_id) + { + $em->remove($basket_element); + } + } + + $em->flush(); + + $data = array( + 'success' => true + , 'message' => _('Record removed from basket') + ); + + if ($request->getRequestFormat() == 'json') + { + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+')->assert('basket_element_id', '\d+'); + + /** + * Update name and description of a basket + * + * @param name string mandatory + * @param description string optionnal + * + */ + $controllers->post('/{basket_id}/update/', function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + $basket->setName($request->get('name', '')); + $basket->setDescription($request->get('description')); + + $em->merge($basket); + $em->flush(); + + $data = array( + 'success' => true + , 'message' => _('Basket has been updated') + , 'basket' => array('id' => $basket->getId()) + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+'); + + /** + * Get the form to update the Basket attributes (name and description) + */ + $controllers->get('/{basket_id}/update/', function(Application $app, $basket_id) + { + /* @var $em \Doctrine\ORM\EntityManager */ + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'prod/Baskets/Update.html.twig' + , array('basket' => $basket) + ) + ); + })->assert('basket_id', '\d+'); + + + /** + * Get the Basket reorder form + */ + $controllers->get( + '/{basket_id}/reorder/' + , function(Application $app, $basket_id) + { + /* @var $em \Doctrine\ORM\EntityManager */ + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'prod/Baskets/Reorder.html.twig' + , array('basket' => $basket) + ) + ); + })->assert('basket_id', '\d+'); + + + $controllers->post( + '/{basket_id}/reorder/' + , function(Application $app, $basket_id) + { + $ret = array('success' => false, 'message' => _('An error occured')); + try + { + /* @var $em \Doctrine\ORM\EntityManager */ + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + + $order = $app['request']->get('element'); + + + /* @var $basket \Entities\Basket */ + foreach ($basket->getElements() as $basketElement) + { + if (isset($order[$basketElement->getId()])) + { + $basketElement->setOrd($order[$basketElement->getId()]); + + $em->merge($basketElement); + } + } + + $em->flush(); + $ret = array('success' => true, 'message' => _('Basket updated')); + } + catch (\Exception $e) + { + + } + $Serializer = $app['Core']['Serializer']; + + return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json')); + })->assert('basket_id', '\d+'); + + + /** + * Toggle the status of a Basket + * + * @param acrhive : 0|1 (mandatory) + * + * @returns JSON / HTML + */ + $controllers->post('/{basket_id}/archive/', function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + $archive_status = !!$request->get('archive'); + + $basket->setArchived($archive_status); + + $em->merge($basket); + $em->flush(); + + if ($archive_status) + { + $message = _('Basket has been archived'); + } + else + { + $message = _('Basket has been unarchived'); + } + + $data = array( + 'success' => true + , 'archive' => $archive_status + , 'message' => $message + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+'); + + /** + * Add a BasketElement to a basket + */ + $controllers->post( + '/{basket_id}/addElements/' + , function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + $user = $app['Core']->getAuthenticatedUser(); + /* @var $user \User_Adapter */ + + $n = 0; + + foreach (explode(';', $request->get('lst')) as $sbas_rec) + { + $sbas_rec = explode('_', $sbas_rec); + + if (count($sbas_rec) !== 2) + continue; + + $record = new \record_adapter($sbas_rec[0], $sbas_rec[1]); + + if (!$user->ACL()->has_access_to_base($record->get_base_id()) + && !$user->ACL()->has_hd_grant($record) + && !$user->ACL()->has_preview_grant($record)) + { + continue; + } + + if ($basket->hasRecord($record)) + continue; + + $basket_element = new \Entities\BasketElement(); + $basket_element->setRecord($record); + $basket_element->setBasket($basket); + + $em->persist($basket_element); + + $basket->addBasketElement($basket_element); + + if(null !== $validationSession = $basket->getValidation()) + { + + $participants = $validationSession->getParticipants(); + + foreach($participants as $participant) + { + $validationData = new \Entities\ValidationData(); + $validationData->setParticipant($participant); + $validationData->setBasketElement($basket_element); + + $em->persist($validationData); + } + } + + $n++; + } + + $em->flush(); + + $data = array( + 'success' => true + , 'message' => sprintf(_('%d records added'), $n) + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+'); + + + + + /** + * + * Move Basket element from a basket to another + * + * @params elements Array : list of basket element id + * + */ + $controllers->post( + '/{basket_id}/stealElements/' + , function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + /* @var $em \Doctrine\ORM\EntityManager */ + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true); + + $user = $app['Core']->getAuthenticatedUser(); + /* @var $user \User_Adapter */ + + $n = 0; + + foreach ($request->get('elements') as $bask_element_id) + { + try + { + $basket_element = $em->getRepository('\Entities\BasketElement') + ->findUserElement($bask_element_id, $user); + } + catch (\Exception $e) + { + continue; + } + + $basket_element->setBasket($basket); + $basket->addBasketElement($basket_element); + $n++; + } + + $em->flush(); + + $data = array( + 'success' => true + , 'message' => sprintf(_('%d records moved'), $n) + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('basket_id', '\d+'); + + /** + * Get basket creation form + */ + $controllers->get('/create/', function(Application $app) + { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render('prod/Baskets/Create.html.twig', array())); + }); + + /** + * Get a basket + */ + $controllers->get('/{basket_id}/', function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false); + + if ($basket->getIsRead() === false) + { + $basket->setIsRead(true); + $em->flush(); + } + + if ($basket->getValidation()) + { + if ($basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) + { + $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true); + $em->flush(); + } + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $params = array( + 'basket' => $basket, + 'ordre' => $request->get('order') + ); + + $html = $twig->render('prod/WorkZone/Basket.html.twig', $params); + + return new Response($html); + })->assert('basket_id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/classes/Controller/Prod/Records/Bridge.class.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php similarity index 79% rename from lib/classes/Controller/Prod/Records/Bridge.class.php rename to lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index 2da0188b31..2ae0074c8f 100644 --- a/lib/classes/Controller/Prod/Records/Bridge.class.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Prod; + use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; @@ -22,17 +18,25 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Alchemy\Phrasea\Helper\Record as RecordHelper; -class Controller_Prod_Records_Bridge implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class Bridge implements ControllerProviderInterface { public function connect(Application $app) { $controllers = new ControllerCollection(); - $appbox = appbox::get_instance(); - $twig = new supertwig(); + $appbox = \appbox::get_instance($app['Core']); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); - $app['require_connection'] = $app->protect(function(Bridge_Account $account) use ($app) + $app['require_connection'] = $app->protect(function(\Bridge_Account $account) use ($app) { $app['current_account'] = function() use ($account) { @@ -40,24 +44,25 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface }; if (!$account->get_api()->get_connector()->is_configured()) - throw new Bridge_Exception_ApiConnectorNotConfigured(); + throw new \Bridge_Exception_ApiConnectorNotConfigured("Bridge API Connector is not configured"); if (!$account->get_api()->get_connector()->is_connected()) - throw new Bridge_Exception_ApiConnectorNotConnected (); + throw new \Bridge_Exception_ApiConnectorNotConnected("Bridge API Connector is not connected"); return; }); $controllers->post('/manager/' - , function() use ($app, $twig) + , function(Application $app) use ($twig) { - $route = new module_prod_route_records_bridge($app['request']); - $appbox = appbox::get_instance(); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $route = new RecordHelper\Bridge($app['Core'], $app['request']); + $appbox = \appbox::get_instance($app['Core']); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $params = array( - 'user_accounts' => Bridge_Account::get_accounts_by_user($appbox, $user) - , 'available_apis' => Bridge_Api::get_availables($appbox) + 'user_accounts' => \Bridge_Account::get_accounts_by_user($appbox, $user) + , 'available_apis' => \Bridge_Api::get_availables($appbox) , 'route' => $route + , 'current_account_id' => '' ); return new Response($twig->render('prod/actions/Bridge/index.twig', $params) @@ -66,8 +71,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $controllers->get('/login/{api_name}/', function($api_name) use ($app, $twig) { - $appbox = appbox::get_instance(); - $connector = Bridge_Api::get_connector_by_name($appbox->get_registry(), $api_name); + $appbox = \appbox::get_instance($app['Core']); + $connector = \Bridge_Api::get_connector_by_name($appbox->get_registry(), $api_name); return $app->redirect($connector->get_auth_url()); }); @@ -77,9 +82,9 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $error_message = ''; try { - $appbox = appbox::get_instance(); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $api = Bridge_Api::get_by_api_name($appbox, $api_name); + $appbox = \appbox::get_instance($app['Core']); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $api = \Bridge_Api::get_by_api_name($appbox, $api_name); $connector = $api->get_connector(); $response = $connector->connect(); @@ -88,11 +93,11 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface try { - $account = Bridge_Account::load_account_from_distant_id($appbox, $api, $user, $user_id); + $account = \Bridge_Account::load_account_from_distant_id($appbox, $api, $user, $user_id); } - catch (Bridge_Exception_AccountNotFound $e) + catch (\Bridge_Exception_AccountNotFound $e) { - $account = Bridge_Account::create($appbox, $api, $user, $user_id, $connector->get_user_name()); + $account = \Bridge_Account::create($appbox, $api, $user, $user_id, $connector->get_user_name()); } $settings = $account->get_settings(); @@ -105,7 +110,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $connector->reconnect(); } - catch (Exception $e) + catch (\Exception $e) { $error_message = $e->getMessage(); } @@ -119,13 +124,13 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $controllers->get('/adapter/{account_id}/logout/' , function($account_id) use ($app, $twig) { - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); $app['require_connection']($account); $account->get_api()->get_connector()->disconnect(); return $app->redirect('/prod/bridge/adapter/' . $account_id . '/load-elements/' . $account->get_api()->get_connector()->get_default_element_type() . '/'); - }); + })->assert('account_id', '\d+'); $controllers->get('/adapter/{account_id}/load-records/' @@ -134,9 +139,9 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $page = max((int) $app['request']->get('page'), 0); $quantity = 10; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); - $elements = Bridge_Element::get_elements_by_account($appbox, $account, $offset_start, $quantity); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); + $elements = \Bridge_Element::get_elements_by_account($appbox, $account, $offset_start, $quantity); $app['require_connection']($account); @@ -148,8 +153,6 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'notice_message' => $app['request']->get('notice') ); - $twig->addFilter(array('prettyDate' => 'phraseadate::getPrettyString')); - return new Response($twig->render('prod/actions/Bridge/records_list.twig', $params)); }) ->assert('account_id', '\d+'); @@ -160,8 +163,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $page = max((int) $app['request']->get('page'), 0); $quantity = 5; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); $app['require_connection']($account); @@ -176,8 +179,6 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'notice_message' => $app['request']->get('notice') ); - $twig->addFilter(array('prettyDate' => 'phraseadate::getPrettyString')); - return new Response($twig->render('prod/actions/Bridge/element_list.twig', $params)); }) ->assert('account_id', '\d+'); @@ -189,8 +190,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $page = max((int) $app['request']->get('page'), 0); $quantity = 5; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); $app['require_connection']($account); $elements = $account->get_api()->list_containers($type, $offset_start, $quantity); @@ -204,8 +205,6 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'notice_message' => $app['request']->get('notice') ); - $twig->addFilter(array('prettyDate' => 'phraseadate::getPrettyString')); - return new Response($twig->render('prod/actions/Bridge/element_list.twig', $params)); }) ->assert('account_id', '\d+'); @@ -215,8 +214,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , function($account_id, $action, $element_type) use ($app, $twig) { - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); $app['require_connection']($account); $request = $app['request']; @@ -239,11 +238,11 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface } foreach ($elements as $element_id) { - if ($class === Bridge_Api_Interface::OBJECT_CLASS_ELEMENT) + if ($class === \Bridge_Api_Interface::OBJECT_CLASS_ELEMENT) { $route_params = array('element' => $account->get_api()->get_element_from_id($element_id, $element_type)); } - if ($class === Bridge_Api_Interface::OBJECT_CLASS_CONTAINER) + if ($class === \Bridge_Api_Interface::OBJECT_CLASS_CONTAINER) { $route_params = array('element' => $account->get_api()->get_container_from_id($element_id, $element_type)); } @@ -260,7 +259,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface break; default: - throw new Exception(_('Vous essayez de faire une action que je ne connais pas !')); + throw new \Exception(_('Vous essayez de faire une action que je ne connais pas !')); break; } @@ -269,6 +268,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'destination' => $destination , 'element_type' => $element_type , 'action' => $action + , 'constraint_errors' => null + , 'adapter_action' => $action , 'elements' => $elements , 'error_message' => $app['request']->get('error') , 'notice_message' => $app['request']->get('notice') @@ -286,8 +287,8 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $controllers->post('/action/{account_id}/{action}/{element_type}/' , function($account_id, $action, $element_type) use ($app, $twig) { - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $account_id); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $account_id); $app['require_connection']($account); @@ -323,6 +324,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'element_type' => $element_type , 'action' => $action , 'elements' => $elements + , 'adapter_action' => $action , 'error_message' => _('Request contains invalid datas') , 'constraint_errors' => $errors , 'notice_message' => $app['request']->get('notice') @@ -340,7 +342,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $account->get_api()->update_element($element_type, $element_id, $datas); } } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?elements_list[]=' . $element_id . '&error=' . get_class($e) . ' : ' . $e->getMessage()); } @@ -349,14 +351,14 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface break; case 'createcontainer': - try { + $container_type = $request->get('f_container_type'); $account->get_api()->create_container($container_type, $app['request']); } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?error=' . get_class($e) . ' : ' . $e->getMessage()); @@ -374,7 +376,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $account->get_api()->add_element_to_container($element_type, $element_id, $destination, $container_id); } } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?error=' . get_class($e) . ' : ' . $e->getMessage()); } @@ -391,7 +393,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $account->get_api()->delete_object($element_type, $element_id); } } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?error=' . get_class($e) . $e->getMessage()); } @@ -399,7 +401,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface return $app->redirect('/prod/bridge/adapter/' . $account_id . '/load-' . $class . 's/' . $element_type . '/'); break; default: - throw new Exception('Unknown action'); + throw new \Exception('Unknown action'); break; } @@ -408,14 +410,15 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface })->assert('account_id', '\d+'); - $controllers->get('/upload/', function() use ($app, $twig) + $controllers->get('/upload/', function(Application $app) use ($twig) { $request = $app['request']; - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $request->get('account_id')); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $app['require_connection']($account); - $route = new module_prod_route_records_bridge($request); + $route = new RecordHelper\Bridge($app['Core'], $app['request']); + $route->grep_records($account->get_api()->acceptable_records()); $params = array( @@ -423,6 +426,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'account' => $account , 'error_message' => $app['request']->get('error') , 'notice_message' => $app['request']->get('notice') + , 'adapter_action' => 'upload' ); $html = $twig->render( @@ -434,29 +438,27 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $controllers->post('/upload/' - , function() use ($app, $twig) + , function(Application $app) use ($twig) { $errors = array(); $request = $app['request']; - $appbox = appbox::get_instance(); - $account = Bridge_Account::load_account($appbox, $request->get('account_id')); + $appbox = \appbox::get_instance($app['Core']); + $account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $app['require_connection']($account); - $route = new module_prod_route_records_bridge($request); + $route = new RecordHelper\Bridge($app['Core'], $app['request']); $route->grep_records($account->get_api()->acceptable_records()); $connector = $account->get_api()->get_connector(); /** * check constraints */ - $errors = array(); foreach ($route->get_elements() as $record) { $datas = $connector->get_upload_datas($request, $record); $errors = array_merge($errors, $connector->check_upload_constraints($datas, $record)); } - if (count($errors) > 0) { @@ -466,6 +468,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface , 'error_message' => _('Request contains invalid datas') , 'constraint_errors' => $errors , 'notice_message' => $app['request']->get('notice') + , 'adapter_action' => 'upload' ); $html = $twig->render('prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/upload.twig', $params); @@ -479,7 +482,7 @@ class Controller_Prod_Records_Bridge implements ControllerProviderInterface $datas = $connector->get_upload_datas($request, $record); $title = isset($datas["title"]) ? $datas["title"] : ''; $default_type = $connector->get_default_element_type(); - Bridge_Element::create($appbox, $account, $record, $title, Bridge_Element::STATUS_PENDING, $default_type, $datas); + \Bridge_Element::create($appbox, $account, $record, $title, \Bridge_Element::STATUS_PENDING, $default_type, $datas); } return $app->redirect('/prod/bridge/adapter/' . $account->get_id() . '/load-records/?notice=' . sprintf(_('%d elements en attente'), count($route->get_elements()))); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php new file mode 100644 index 0000000000..171aa30e59 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php @@ -0,0 +1,111 @@ +post('/', function(Application $app, Request $request) + { + $handler = new RecordHelper\Edit($app['Core'], $request); + + $handler->propose_editing(); + + $template = 'prod/actions/edit_default.twig'; + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render($template, array('edit' => $handler, 'message' => '')); + } + ); + + $controllers->get('/vocabulary/{vocabulary}/', function(Application $app, Request $request, $vocabulary) + { + $datas = array('success' => false, 'message' => '', 'results' => array()); + + $Serializer = $app['Core']['Serializer']; + + $sbas_id = (int) $request->get('sbas_id'); + + try + { + $VC = \Alchemy\Phrasea\Vocabulary\Controller::get($vocabulary); + $databox = \databox::get_instance($sbas_id); + } + catch (\Exception $e) + { + $datas['message'] = _('Vocabulary not found'); + + $datas = $Serializer->serialize($datas, 'json'); + + return new response($datas, 200, array('Content-Type' => 'application/json')); + } + + $query = $request->get('query'); + + $results = $VC->find($query, $app['Core']->getAuthenticatedUser(), $databox); + + $list = array(); + + foreach ($results as $Term) + { + /* @var $Term \Alchemy\Phrasea\Vocabulary\Term */ + $list[] = array( + 'id' => $Term->getId(), + 'context' => $Term->getContext(), + 'value' => $Term->getValue(), + ); + } + + $datas['success'] = true; + $datas['results'] = $list; + + return new response($Serializer->serialize($datas, 'json'), 200, array('Content-Type' => 'application/json')); + } + ); + + $controllers->post('/apply/', function(Application $app, Request $request) + { + $editing = new RecordHelper\Edit($app['Core'], $app['request']); + $editing->execute($request); + + $template = 'prod/actions/edit_default.twig'; + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render($template, array('edit' => $editing, 'message' => '')); + } + ); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php new file mode 100644 index 0000000000..312d4f482c --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php @@ -0,0 +1,334 @@ +getTwig(); + $appbox = \appbox::get_instance($app['Core']); + + /** + * I got a selection of docs, which publications are available forthese docs ? + */ + $controllers->post('/requestavailable/', function(Application $app, Request $request) use ($appbox, $twig) + { + $user = $app["Core"]->getAuthenticatedUser(); + $feeds = \Feed_Collection::load_all($appbox, $user); + $publishing = new RecordHelper\Feed($app['Core'], $request); + + $datas = $twig->render('prod/actions/publish/publish.html', array('publishing' => $publishing, 'feeds' => $feeds)); + + return new Response($datas); + }); + + + /** + * I've selected a publication for my ocs, let's publish them + */ + $controllers->post('/entry/create/', function(Application $app, Request $request) use ($appbox, $twig) + { + try + { + $user = $app["Core"]->getAuthenticatedUser(); + $feed = new \Feed_Adapter($appbox, $request->get('feed_id')); + $publisher = \Feed_Publisher_Adapter::getPublisher($appbox, $feed, $user); + + $title = $request->get('title'); + $subtitle = $request->get('subtitle'); + $author_name = $request->get('author_name'); + $author_mail = $request->get('author_mail'); + + $entry = \Feed_Entry_Adapter::create($appbox, $feed, $publisher, $title, $subtitle, $author_name, $author_mail); + + $publishing = new RecordHelper\Feed($app['Core'], $app['request']); + + foreach ($publishing->get_elements() as $record) + { + $item = \Feed_Entry_Item::create($appbox, $entry, $record); + } + $datas = array('error' => false, 'message' => false); + } + catch (\Exception $e) + { + $datas = array('error' => true, 'message' => _('An error occured'), 'details' => $e->getMessage()); + } + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + }); + + + $controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) use ($appbox, $twig) + { + + $user = $app["Core"]->getAuthenticatedUser(); + + $entry = \Feed_Entry_Adapter::load_from_id($appbox, $id); + + if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) + { + throw new \Exception_UnauthorizedAction(); + } + + $feeds = \Feed_Collection::load_all($appbox, $user); + + $datas = $twig->render('prod/actions/publish/publish_edit.html', array('entry' => $entry, 'feeds' => $feeds)); + + return new Response($datas); + })->assert('id', '\d+'); + + + $controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) use ($appbox, $twig) + { + $datas = array('error' => true, 'message' => '', 'datas' => ''); + try + { + $appbox->get_connection()->beginTransaction(); + + $user = $app["Core"]->getAuthenticatedUser(); + + $entry = \Feed_Entry_Adapter::load_from_id($appbox, $id); + + if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) + { + throw new \Exception_UnauthorizedAction(); + } + + $title = $request->get('title'); + $subtitle = $request->get('subtitle'); + $author_name = $request->get('author_name'); + $author_mail = $request->get('author_mail'); + + $entry->set_author_email($author_mail) + ->set_author_name($author_name) + ->set_title($title) + ->set_subtitle($subtitle); + + $items = explode(';', $request->get('sorted_lst')); + + foreach ($items as $item_sort) + { + $item_sort_datas = explode('_', $item_sort); + if (count($item_sort_datas) != 2) + { + continue; + } + + $item = new \Feed_Entry_Item($appbox, $entry, $item_sort_datas[0]); + + $item->set_ord($item_sort_datas[1]); + } + $appbox->get_connection()->commit(); + + $entry = $twig->render('prod/feeds/entry.html', array('entry' => $entry)); + + $datas = array('error' => false, 'message' => 'succes', 'datas' => $entry); + } + catch (\Exception_Feed_EntryNotFound $e) + { + $appbox->get_connection()->rollBack(); + $datas['message'] = _('Feed entry not found'); + } + catch (\Exception $e) + { + $appbox->get_connection()->rollBack(); + $datas['message'] = $e->getMessage(); + } + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + })->assert('id', '\d+'); + + + $controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) use ($appbox, $twig) + { + $datas = array('error' => true, 'message' => ''); + try + { + $appbox->get_connection()->beginTransaction(); + + $user = $app["Core"]->getAuthenticatedUser(); + + $entry = \Feed_Entry_Adapter::load_from_id($appbox, $id); + + if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id() + && $entry->get_feed()->is_owner($user) === false) + { + throw new \Exception_UnauthorizedAction(_('Action Forbidden : You are not the publisher')); + } + + $entry->delete(); + + $appbox->get_connection()->commit(); + $datas = array('error' => false, 'message' => 'succes'); + } + catch (\Exception_Feed_EntryNotFound $e) + { + $appbox->get_connection()->rollBack(); + $datas['message'] = _('Feed entry not found'); + } + catch (\Exception $e) + { + $appbox->get_connection()->rollBack(); + $datas['message'] = $e->getMessage(); + } + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + })->assert('id', '\d+'); + +//$app->post('/entry/{id}/addelement/', function($id) use ($app, $appbox, $twig) +// { +// +// }); +// +//$app->post('/element/{id}/update/', function($id) use ($app, $appbox, $twig) +// { +// +// }); +// +//$app->post('/element/{id}/delete/', function($id) use ($app, $appbox, $twig) +// { +// +// }); +//$app->get('/entry/{id}/', function($id) use ($app, $appbox, $twig) +// { +// +// }); + + $controllers->get('/', function(Application $app, Request $request) use ($appbox, $twig) + { + $request = $app['request']; + $page = (int) $request->get('page'); + $page = $page > 0 ? $page : 1; + + $user = $app["Core"]->getAuthenticatedUser(); + + $feeds = \Feed_Collection::load_all($appbox, $user); + + $datas = $twig->render('prod/feeds/feeds.html' + , array( + 'feeds' => $feeds + , 'feed' => $feeds->get_aggregate() + , 'page' => $page + ) + ); + + return new Response($datas); + }); + + + $controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) use ($appbox, $twig) + { + $page = (int) $request->get('page'); + $page = $page > 0 ? $page : 1; + + $user = $app["Core"]->getAuthenticatedUser(); + + $feed = \Feed_Adapter::load_with_user($appbox, $user, $id); + $feeds = \Feed_Collection::load_all($appbox, $user); + + $datas = $twig->render('prod/feeds/feeds.html', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page)); + + return new Response($datas); + })->assert('id', '\d+'); + + + $controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) use ( $appbox, $twig) + { + $renew = ($request->get('renew') === 'true'); + + $user = $app["Core"]->getAuthenticatedUser(); + + $feeds = \Feed_Collection::load_all($appbox, $user); + $registry = $appbox->get_registry(); + + + $output = array( + 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') + . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

+
', + 'titre' => _('publications::votre rss personnel') + ); + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($output, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + }); + + + $controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) use ($appbox, $twig) + { + $renew = ($request->get('renew') === 'true'); + $user = $app["Core"]->getAuthenticatedUser(); + $feed = \Feed_Adapter::load_with_user($appbox, $user, $id); + $registry = $appbox->get_registry(); + + $output = array( + 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') + . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

+
', + 'titre' => _('publications::votre rss personnel') + ); + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($output, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + })->assert('id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Language.php b/lib/Alchemy/Phrasea/Controller/Prod/Language.php new file mode 100644 index 0000000000..3fe97e5ea4 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Language.php @@ -0,0 +1,113 @@ +get("/", function(Application $app) + { + $registry = $app["Core"]->getRegistry(); + + $out = array(); + $out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); + $out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?'); + $out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); + $out['serverName'] = $registry->get('GV_ServerName'); + $out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'); + $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); + $out['hideMessage'] = _('phraseanet::Ne plus afficher ce message'); + $out['confirmGroup'] = _('Supprimer egalement les documents rattaches a ces regroupements'); + $out['confirmDelete'] = _('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?'); + $out['cancel'] = _('boutton::annuler'); + $out['deleteTitle'] = _('boutton::supprimer'); + $out['edit_hetero'] = _('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''); + $out['confirm_abandon'] = _('prod::editing::annulation: abandonner les modification ?'); + $out['loading'] = _('phraseanet::chargement'); + $out['valider'] = _('boutton::valider'); + $out['annuler'] = _('boutton::annuler'); + $out['create'] = _('boutton::creer'); + $out['rechercher'] = _('boutton::rechercher'); + $out['renewRss'] = _('boutton::renouveller'); + $out['candeletesome'] = _('Vous n\'avez pas les droits pour supprimer certains documents'); + $out['candeletedocuments'] = _('Vous n\'avez pas les droits pour supprimer ces documents'); + $out['needTitle'] = _('Vous devez donner un titre'); + $out['newPreset'] = _('Nouveau modele'); + $out['fermer'] = _('boutton::fermer'); + $out['feed_require_fields'] = _('Vous n\'avez pas rempli tous les champ requis'); + $out['feed_require_feed'] = _('Vous n\'avez pas selectionne de fil de publication'); + $out['removeTitle'] = _('panier::Supression d\'un element d\'un reportage'); + $out['confirmRemoveReg'] = _('panier::Attention, vous etes sur le point de supprimer un element du reportage. Merci de confirmer votre action.'); + $out['advsearch_title'] = _('phraseanet::recherche avancee'); + $out['bask_rename'] = _('panier:: renommer le panier'); + $out['reg_wrong_sbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre'); + $out['error'] = _('phraseanet:: Erreur'); + $out['warningDenyCgus'] = _('cgus :: Attention, si vous refuser les CGUs de cette base, vous n\'y aures plus acces'); + $out['cgusRelog'] = _('cgus :: Vous devez vous reauthentifier pour que vos parametres soient pris en compte.'); + $out['editDelMulti'] = _('edit:: Supprimer %s du champ dans les records selectionnes'); + $out['editAddMulti'] = _('edit:: Ajouter %s au champ courrant pour les records selectionnes'); + $out['editDelSimple'] = _('edit:: Supprimer %s du champ courrant'); + $out['editAddSimple'] = _('edit:: Ajouter %s au champ courrant'); + $out['cantDeletePublicOne'] = _('panier:: vous ne pouvez pas supprimer un panier public'); + $out['wrongsbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre'); + $out['max_record_selected'] = _('Vous ne pouvez pas selectionner plus de 800 enregistrements'); + $out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez'); + $out['error_test_publi'] = _('Erreur : soit les parametres sont incorrects, soit le serveur distant ne repond pas'); + $out['test_publi_ok'] = _('Les parametres sont corrects, le serveur distant est operationnel'); + $out['some_not_published'] = _('Certaines publications n\'ont pu etre effectuees, verifiez vos parametres'); + $out['error_not_published'] = _('Aucune publication effectuee, verifiez vos parametres'); + $out['warning_delete_publi'] = _('Attention, en supprimant ce preregalge, vous ne pourrez plus modifier ou supprimer de publications prealablement effectues avec celui-ci'); + $out['some_required_fields'] = _('edit::certains documents possedent des champs requis non remplis. Merci de les remplir pour valider votre editing'); + $out['nodocselected'] = _('Aucun document selectionne'); + $out['sureToRemoveList'] = _('Are you sure you want to delete this list ?'); + $out['newListName'] = _('New list name ?'); + $out['listNameCannotBeEmpty'] = _('List name can not be empty'); + $out['FeedBackName'] = _('Name'); + $out['FeedBackMessage'] = _('Message'); + $out['FeedBackDuration'] = _('Time for feedback (days)'); + $out['send'] = _('Send'); + $out['Recept'] = _('Accuse de reception'); + $out['nFieldsChanged'] = _('%d fields have been updated'); + $out['FeedBackNoUsersSelected'] = _('No users selected'); + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($out, 'json') + , 200 + , array('Content-Type' => 'application/json') + ); + }); + + return $controller; + } + +} diff --git a/lib/classes/Controller/Prod/Records/MoveCollection.class.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php similarity index 59% rename from lib/classes/Controller/Prod/Records/MoveCollection.class.php rename to lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index ce062387fd..0a057eac5c 100644 --- a/lib/classes/Controller/Prod/Records/MoveCollection.class.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -9,47 +9,52 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Controller\Prod; + +use Silex\Application; +use Silex\ControllerProviderInterface; +use Silex\ControllerCollection; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Alchemy\Phrasea\Helper\Record as RecordHelper; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -use Silex\Application; -use Silex\ControllerProviderInterface; -use Silex\ControllerCollection; - -class Controller_Prod_Records_MoveCollection implements ControllerProviderInterface +class MoveCollection implements ControllerProviderInterface { public function connect(Application $app) { $controllers = new ControllerCollection(); - $controllers->post('/', function() use ($app) + $controllers->post('/', function(Application $app, Request $request) { $request = $app['request']; - $move = new module_prod_route_records_move($request); + $move = new RecordHelper\MoveCollection($app['Core'], $app['request']); $move->propose(); $template = 'prod/actions/collection_default.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_names' => 'phrasea::bas_names')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, array('action' => $move, 'message' => '')); } ); - $controllers->post('/apply/', function() use ($app) + $controllers->post('/apply/', function(Application $app) { $request = $app['request']; - $move = new module_prod_route_records_move($request); + $move = new RecordHelper\MoveCollection($app['Core'], $app['request']); $move->execute($request); $template = 'prod/actions/collection_submit.twig'; - $twig = new supertwig(); - $twig->addFilter(array('bas_names' => 'phrasea::bas_names')); + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); return $twig->render($template, array('action' => $move, 'message' => '')); }); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MustacheLoader.php b/lib/Alchemy/Phrasea/Controller/Prod/MustacheLoader.php new file mode 100644 index 0000000000..184cfa20da --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/MustacheLoader.php @@ -0,0 +1,54 @@ +get('/', function(Application $app, Request $request) + { + $template_name = $request->get('template'); + + if (!preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) + { + throw new \Exception_BadRequest('Wrong template name : ' . $template_name); + } + + $template_path = realpath(__DIR__ . '/../../../../../templates/web/Mustache/Prod/' . $template_name . '.Mustache.html'); + + if (!file_exists($template_path)) + { + throw new \Exception_NotFound('Template does not exists : ' . $template_path); + } + + return new \Symfony\Component\HttpFoundation\Response(file_get_contents($template_path)); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Printer.php b/lib/Alchemy/Phrasea/Controller/Prod/Printer.php new file mode 100644 index 0000000000..96c4199ee5 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Printer.php @@ -0,0 +1,73 @@ +post('/', function(Application $app) + { + $printer = new RecordHelper\Printer($app['Core'], $app['request']); + + $template = 'prod/actions/printer_default.html.twig'; + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render($template, array('printer' => $printer, 'message' => '')); + } + ); + + + + $controllers->post('/print.pdf', function(Application $app) + { + $printer = new RecordHelper\Printer($app['Core'], $app['request']); + + $request = $app['request']; + + $session = \Session_Handler::getInstance(\appbox::get_instance($app['Core'])); + + $layout = $request->get('lay'); + + foreach ($printer->get_elements() as $record) + { + $session->get_logger($record->get_databox()) + ->log($record, \Session_Logger::EVENT_PRINT, $layout, ''); + } + $PDF = new PDFExport($printer->get_elements(), $layout); + + return new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf')); + } + ); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php new file mode 100644 index 0000000000..42d3fc66dc --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -0,0 +1,808 @@ + 'USER' + , 'usr_id' => $user->get_id() + , 'firstname' => $user->get_firstname() + , 'lastname' => $user->get_lastname() + , 'email' => $user->get_email() + , 'display_name' => $user->get_display_name() + ); + }; + } + + protected function getListFormatter() + { + $userFormatter = $this->getUserFormatter(); + + return function(\Entities\UsrList $List) use ($userFormatter) + { + $entries = array(); + + foreach ($List->getEntries() as $entry) + { + /* @var $entry \Entities\UsrListEntry */ + $entries[] = array( + 'Id' => $entry->getId(), + 'User' => $userFormatter($entry->getUser()) + ); + } + + return array( + 'type' => 'LIST' + , 'list_id' => $List->getId() + , 'name' => $List->getName() + , 'length' => count($entries) + , 'entries' => $entries + ); + }; + } + + protected function getUsersInSelectionExtractor() + { + return function(array $selection) + { + $Users = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($selection as $record) + { + /* @var $record record_adapter */ + foreach ($record->get_caption()->get_fields() as $caption_field) + { + foreach ($caption_field->get_values() as $value) + { + if (!$value->getVocabularyType()) + continue; + + if ($value->getVocabularyType()->getType() !== 'User') + continue; + + $user = $value->getRessource(); + + $Users->set($user->get_id(), $user); + } + } + } + + return $Users; + }; + } + + public function connect(Application $app) + { + $controllers = new ControllerCollection(); + + $userFormatter = $this->getUserFormatter(); + + $listFormatter = $this->getListFormatter(); + + $userSelection = $this->getUsersInSelectionExtractor(); + + $controllers->post('/sendform/', function(Application $app) use ($userSelection) + { + $push = new RecordHelper\Push($app['Core'], $app['request']); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\UsrList'); + + $RecommendedUsers = $userSelection($push->get_elements()); + + $params = array( + 'push' => $push, + 'message' => '', + 'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser()), + 'context' => 'Push', + 'RecommendedUsers' => $RecommendedUsers + ); + + $template = 'prod/actions/Push.html.twig'; + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render($template, $params)); + } + ); + + $controllers->post('/validateform/', function(Application $app) use ($userSelection) + { + $push = new RecordHelper\Push($app['Core'], $app['request']); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\UsrList'); + + $RecommendedUsers = $userSelection($push->get_elements()); + + $params = array( + 'push' => $push, + 'message' => '', + 'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser()), + 'context' => 'Feedback', + 'RecommendedUsers' => $RecommendedUsers + ); + + $template = 'prod/actions/Push.html.twig'; + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render($template, $params)); + } + ); + + $controllers->post('/send/', function(Application $app) + { + $request = $app['request']; + + $ret = array( + 'success' => false, + 'message' => _('Unable to send the documents') + ); + + try + { + $em = $app['Core']->getEntityManager(); + + $registry = $app['Core']->getRegistry(); + + $pusher = new RecordHelper\Push($app['Core'], $app['request']); + + $user = $app['Core']->getAuthenticatedUser(); + + $appbox = \appbox::get_instance($app['Core']); + + $push_name = $request->get('name'); + + if (trim($push_name) === '') + { + $push_name = sprintf(_('Push from %s'), $user->get_display_name()); + } + + $push_description = $request->get('push_description'); + + $receivers = $request->get('participants'); + + if (!is_array($receivers) || count($receivers) === 0) + { + throw new ControllerException(_('No receivers specified')); + } + + if (!is_array($pusher->get_elements()) || count($pusher->get_elements()) === 0) + { + throw new ControllerException(_('No elements to push')); + } + + + $events_manager = \eventsmanager_broker::getInstance(\appbox::get_instance($app['Core']), $app['Core']); + + foreach ($receivers as $receiver) + { + try + { + $user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $appbox); + } + catch (\Exception $e) + { + throw new ControllerException(sprintf(_('Unknown user %d'), $receiver['usr_id'])); + } + + $Basket = new \Entities\Basket(); + $Basket->setName($push_name); + $Basket->setDescription($push_description); + $Basket->setOwner($user_receiver); + $Basket->setPusher($user); + $Basket->setIsRead(false); + + $em->persist($Basket); + + foreach ($pusher->get_elements() as $element) + { + $BasketElement = new \Entities\BasketElement(); + $BasketElement->setRecord($element); + $BasketElement->setBasket($Basket); + + $em->persist($BasketElement); + + $Basket->addBasketElement($BasketElement); + + if ($receiver['HD']) + { + $user_receiver->ACL()->grant_hd_on( + $BasketElement->getRecord() + , $user + , \ACL::GRANT_ACTION_PUSH + ); + } + else + { + $user_receiver->ACL()->grant_preview_on( + $BasketElement->getRecord() + , $user + , \ACL::GRANT_ACTION_PUSH + ); + } + } + + $em->flush(); + + $url = $registry->get('GV_ServerName') + . 'lightbox/index.php?LOG=' + . \random::getUrlToken(\random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId()); + + $params = array( + 'from' => $user->get_id() + , 'from_email' => $user->get_email() + , 'to' => $user_receiver->get_id() + , 'to_email' => $user_receiver->get_email() + , 'to_name' => $user_receiver->get_display_name() + , 'url' => $url + , 'accuse' => !!$request->get('recept', false) + , 'message' => $request->get('message') + , 'ssel_id' => $Basket->getId() + ); + + $events_manager->trigger('__PUSH_DATAS__', $params); + } + + $em->flush(); + + $message = sprintf( + _('%1$d records have been sent to %2$d users') + , count($pusher->get_elements()) + , count($receivers) + ); + + $ret = array( + 'success' => true, + 'message' => $message + ); + } + catch (ControllerException $e) + { + $ret['message'] = $e->getMessage() . $e->getFile() . $e->getLine(); + } + + $Json = $app['Core']['Serializer']->serialize($ret, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + ); + + $controllers->post('/validate/', function(Application $app) + { + $request = $app['request']; + + $ret = array( + 'success' => false, + 'message' => _('Unable to send the documents') + ); + + $em = $app['Core']->getEntityManager(); + + $registry = $app['Core']->getRegistry(); + + /* @var $em \Doctrine\ORM\EntityManager */ + $em->beginTransaction(); + + try + { + $pusher = new RecordHelper\Push($app['Core'], $app['request']); + $user = $app['Core']->getAuthenticatedUser(); + + $events_manager = \eventsmanager_broker::getInstance(\appbox::get_instance($app['Core']), $app['Core']); + + $repository = $em->getRepository('\Entities\Basket'); + + $validation_name = $request->get('name'); + + if (trim($validation_name) === '') + { + $validation_name = sprintf(_('Validation from %s'), $user->get_display_name()); + } + + $validation_description = $request->get('validation_description'); + + $participants = $request->get('participants'); + + if (!is_array($participants) || count($participants) === 0) + { + throw new ControllerException(_('No participants specified')); + } + + if (!is_array($pusher->get_elements()) || count($pusher->get_elements()) === 0) + { + throw new ControllerException(_('No elements to validate')); + } + + if ($pusher->is_basket()) + { + $Basket = $pusher->get_original_basket(); + } + else + { + $Basket = new \Entities\Basket(); + $Basket->setName($validation_name); + $Basket->setDescription($validation_description); + $Basket->setOwner($user); + $Basket->setIsRead(false); + + $em->persist($Basket); + + foreach ($pusher->get_elements() as $element) + { + $BasketElement = new \Entities\BasketElement(); + $BasketElement->setRecord($element); + $BasketElement->setBasket($Basket); + + $em->persist($BasketElement); + + $Basket->addBasketElement($BasketElement); + } + $em->flush(); + } + + $em->refresh($Basket); + + if (!$Basket->getValidation()) + { + $Validation = new \Entities\ValidationSession(); + $Validation->setInitiator($app['Core']->getAuthenticatedUser()); + $Validation->setBasket($Basket); + + $duration = (int) $request->get('duration'); + + if ($duration > 0) + { + $date = new \DateTime('+' . $duration . ' day' . ($duration > 1 ? 's' : '')); + $Validation->setExpires($date); + } + + $Basket->setValidation($Validation); + $em->persist($Validation); + } + else + { + $Validation = $Basket->getValidation(); + } + + + $appbox = \appbox::get_instance($app['Core']); + + $found = false; + foreach ($participants as $key => $participant) + { + if ($participant['usr_id'] == $user->get_id()) + { + $found = true; + break; + } + } + + if (!$found) + { + $participants[$user->get_id()] = array( + 'see_others' => 1, + 'usr_id' => $user->get_id(), + 'agree' => 0, + 'HD' => 0 + ); + } + + foreach ($participants as $key => $participant) + { + foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam) + { + if (!array_key_exists($mandatoryparam, $participant)) + throw new ControllerException(sprintf(_('Missing mandatory parameter %s'), $mandatoryparam)); + } + + try + { + $participant_user = \User_Adapter::getInstance($participant['usr_id'], $appbox); + } + catch (\Exception $e) + { + throw new ControllerException(sprintf(_('Unknown user %d'), $receiver['usr_id'])); + } + + try + { + $Participant = $Validation->getParticipant($participant_user); + continue; + } + catch (\Exception_NotFound $e) + { + + } + + $Participant = new \Entities\ValidationParticipant(); + $Participant->setUser($participant_user); + $Participant->setSession($Validation); + + $Participant->setCanAgree($participant['agree']); + $Participant->setCanSeeOthers($participant['see_others']); + + $em->persist($Participant); + + foreach ($Basket->getElements() as $BasketElement) + { + $ValidationData = new \Entities\ValidationData(); + $ValidationData->setParticipant($Participant); + $ValidationData->setBasketElement($BasketElement); + $BasketElement->addValidationData($ValidationData); + + if ($participant['HD']) + { + $participant_user->ACL()->grant_hd_on( + $BasketElement->getRecord() + , $user + , \ACL::GRANT_ACTION_VALIDATE + ); + } + else + { + $participant_user->ACL()->grant_preview_on( + $BasketElement->getRecord() + , $user + , \ACL::GRANT_ACTION_VALIDATE + ); + } + + $em->merge($BasketElement); + $em->persist($ValidationData); + + $Participant->addValidationData($ValidationData); + } + + $Participant = $em->merge($Participant); + + $em->flush(); + + $url = $registry->get('GV_ServerName') + . 'lightbox/index.php?LOG=' + . \random::getUrlToken(\random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId()); + + $params = array( + 'from' => $user->get_id() + , 'from_email' => $user->get_email() + , 'to' => $participant_user->get_id() + , 'to_email' => $participant_user->get_email() + , 'to_name' => $participant_user->get_display_name() + , 'url' => $url + , 'accuse' => !!$request->get('recept', false) + , 'message' => $request->get('message') + , 'ssel_id' => $Basket->getId() + ); + + $events_manager->trigger('__PUSH_VALIDATION__', $params); + } + + $Basket = $em->merge($Basket); + $Validation = $em->merge($Validation); + + $em->flush(); + + $message = sprintf( + _('%1$d records have been sent for validation to %2$d users') + , count($pusher->get_elements()) + , count($request->get('participants')) + ); + + $ret = array( + 'success' => true, + 'message' => $message + ); + + $em->commit(); + } + catch (ControllerException $e) + { + $ret['message'] = $e->getMessage(); + $em->rollback(); + } + + $Json = $app['Core']['Serializer']->serialize($ret, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + ); + + $controllers->get('/user/{usr_id}/', function(Application $app, $usr_id) use ($userFormatter) + { + + $datas = null; + + $request = $app['request']; + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + $query = new \User_Query(\appbox::get_instance($app['Core'])); + + $query->on_bases_where_i_am($user->ACL(), array('canpush')); + + $query->in(array($usr_id)); + + $result = $query->include_phantoms() + ->limit(0, 1) + ->execute()->get_results(); + + if ($result) + { + foreach ($result as $user) + { + $datas = $userFormatter($user); + } + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + })->assert('usr_id', '\d+'); + + $controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) + { + $datas = null; + + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + + if ($list) + { + $datas = $listFormatter($list); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + })->assert('list_id', '\d+'); + + $controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) + { + $result = array('success' => false, 'message' => '', 'user' => null); + + $Serializer = $app['Core']['Serializer']; + + try + { + if (!$request->get('firstname')) + throw new ControllerException(_('First name is required')); + + if (!$request->get('lastname')) + throw new ControllerException(_('Last name is required')); + + if (!$request->get('email')) + throw new ControllerException(_('Email is required')); + + if (!\mail::validateEmail($request->get('email'))) + throw new ControllerException(_('Email is invalid')); + } + catch (ControllerException $e) + { + $result['message'] = $e->getMessage(); + + return new Response($Serializer->serialize($result, 'json'), 200, array('Content-Type' => 'application/json')); + } + + $appbox = \appbox::get_instance($app['Core']); + + $user = null; + $email = $request->get('email'); + + try + { + $usr_id = \User_Adapter::get_usr_id_from_email($email); + $user = \User_Adapter::getInstance($usr_id, $appbox); + + $result['message'] = _('User already exists'); + $result['success'] = true; + $result['user'] = $userFormatter($user); + } + catch (\Exception $e) + { + + } + + if (!$user instanceof \User_Adapter) + { + try + { + $password = \random::generatePassword(); + + $user = \User_Adapter::create($appbox, $email, $password, $email, false); + + $user->set_firstname($request->get('firstname')) + ->set_lastname($request->get('lastname')); + + if ($request->get('company')) + $user->set_company($request->get('company')); + if ($request->get('job')) + $user->set_company($request->get('job')); + if ($request->get('form_geonameid')) + $user->set_geonameid($request->get('form_geonameid')); + + $result['message'] = _('User successfully created'); + $result['success'] = true; + $result['user'] = $userFormatter($user); + } + catch (\Exception $e) + { + $result['message'] = _('Error while creating user'); + } + } + + + return new Response($Serializer->serialize($result, 'json'), 200, array('Content-Type' => 'application/json')); + }); + + $controllers->get('/add-user/', function(Application $app, Request $request) + { + $params = array('callback' => $request->get('callback')); + + return new Response($app['Core']['Twig']->render('prod/User/Add.html.twig', $params)); + }); + + $controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) + { + $request = $app['request']; + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + $query = new \User_Query(\appbox::get_instance($app['Core'])); + + $query->on_bases_where_i_am($user->ACL(), array('canpush')); + + $query->like(\User_Query::LIKE_FIRSTNAME, $request->get('query')) + ->like(\User_Query::LIKE_LASTNAME, $request->get('query')) + ->like(\User_Query::LIKE_LOGIN, $request->get('query')) + ->like_match(\User_Query::LIKE_MATCH_OR); + + $result = $query->include_phantoms() + ->limit(0, 50) + ->execute()->get_results(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $lists = $repository->findUserListLike($user, $request->get('query')); + + $datas = array(); + + if ($lists) + { + foreach ($lists as $list) + { + $datas[] = $listFormatter($list); + } + } + + if ($result) + { + foreach ($result as $user) + { + $datas[] = $userFormatter($user); + } + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + ); + + + + + $controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) + { + + $user = $app['Core']->getAuthenticatedUser(); + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + + $query = new \User_Query(\appbox::get_instance($app['Core'])); + + $query->on_bases_where_i_am($user->ACL(), array('canpush')); + + if ($request->get('query')) + { + $query->like($request->get('like_field'), $request->get('query')) + ->like_match(\User_Query::LIKE_MATCH_OR); + } + if (is_array($request->get('Activity'))) + { + $query->haveActivities($request->get('Activity')); + } + if (is_array($request->get('Template'))) + { + $query->haveTemplate($request->get('Template')); + } + if (is_array($request->get('Company'))) + { + $query->inCompanies($request->get('Company')); + } + if (is_array($request->get('Country'))) + { + $query->inCountries($request->get('Country')); + } + if (is_array($request->get('Position'))) + { + $query->havePositions($request->get('Position')); + } + + $sort = $request->get('srt', 'usr_creationdate'); + $ord = $request->get('ord', 'desc'); + + $perPage = 10; + $offset_start = Max(((int) $request->get('page') - 1) * $perPage, 0); + + $query->sort_by($sort, $ord); + + $results = $query->include_phantoms() + ->limit($offset_start, $perPage) + ->execute()->get_results(); + + $params = array( + 'query' => $query + , 'results' => $results + , 'list' => $list + , 'sort' => $sort + , 'ord' => $ord + ); + + if ($request->get('type') === 'fragment') + { + return new Response( + $app['Core']->getTwig()->render('prod/actions/Feedback/ResultTable.html.twig', $params) + ); + } + else + { + return new Response( + $app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $params) + ); + } + } + )->assert('list_id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php new file mode 100644 index 0000000000..c43e56f6ee --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -0,0 +1,234 @@ +match('/', function(Application $app, Request $request) + { + + $appbox = \appbox::get_instance($app['Core']); + $registry = $appbox->get_registry(); + + $user = $app['Core']->getAuthenticatedUser(); + + $query = (string) $request->get('qry'); + + $mod = $user->getPrefs('view'); + + $json = array(); + + $options = new \searchEngine_options(); + + $bas = is_array($request->get('bas')) ? $request->get('bas') : array(); + + $status = is_array($request->get('status')) ? $request->get('status') : array(); + $fields = is_array($request->get('fields')) ? $request->get('fields') : array(); + + $options->set_fields($fields); + $options->set_status($status); + $options->set_bases($bas, $user->ACL()); + + $options->set_search_type($request->get('search_type')); + $options->set_record_type($request->get('recordtype')); + $options->set_min_date($request->get('datemin')); + $options->set_max_date($request->get('datemax')); + $options->set_date_fields(explode('|', $request->get('datefield'))); + $options->set_sort($request->get('sort'), $request->get('ord', PHRASEA_ORDER_DESC)); + $options->set_use_stemming($request->get('stemme')); + + $form = serialize($options); + + $perPage = (int) $user->getPrefs('images_per_page'); + + $search_engine = new \searchEngine_adapter($registry); + $search_engine->set_options($options); + + $page = (int) $request->get('pag'); + + if ($page < 1) + { + $search_engine->set_is_first_page(true); + $search_engine->reset_cache(); + $page = 1; + } + + $result = $search_engine->query_per_page($query, $page, $perPage); + + $proposals = $search_engine->is_first_page() ? $result->get_propositions() : false; + + $npages = $result->get_total_pages(); + + $page = $result->get_current_page(); + + $string = ''; + + if ($npages > 1) + { + + $d2top = ($npages - $page); + $d2bottom = $page; + + if (min($d2top, $d2bottom) < 4) + { + if ($d2bottom < 4) + { + for ($i = 1; ($i <= 4 && (($i <= $npages) === true)); $i++) + { + if ($i == $page) + $string .= ''; + else + $string .= "" . $i . ""; + } + if ($npages > 4) + $string .= ">>"; + } + else + { + $start = $npages - 4; + if (($start) > 0) + $string .= "<<"; + else + $start = 1; + for ($i = ($start); $i <= $npages; $i++) + { + if ($i == $page) + $string .= ''; + else + $string .= "" . $i . ""; + } + } + } + else + { + $string .= "<<"; + + for ($i = ($page - 2); $i <= ($page + 2); $i++) + { + if ($i == $page) + $string .= ''; + else + $string .= "" . $i . ""; + } + + $string .= ">>"; + } + } + $string .= '
'; + + + $explain = "
"; + + $explain .= ""; + + if ($result->get_count_total_results() != $result->get_count_available_results()) + { + $explain .= sprintf(_('reponses:: %d Resultats rappatries sur un total de %d trouves'), $result->get_count_available_results(), $result->get_count_total_results()); + } + else + { + $explain .= sprintf(_('reponses:: %d Resultats'), $result->get_count_total_results()); + } + + $explain .= " "; + $explain .= '
' . $result->get_query_time() . ' s
dans index ' . $result->get_search_indexes(); + $explain .= "
"; + + + + $infoResult = '' . sprintf(_('reponses:: %d reponses'), $result->get_count_total_results()) . ' | ' . sprintf(_('reponses:: %s documents selectionnes'), ''); + + $json['infos'] = $infoResult; + $json['navigation'] = $string; + + $prop = null; + + if ($search_engine->is_first_page()) + { + $propals = $result->get_suggestions(); + if (count($propals) > 0) + { + foreach ($propals as $prop_array) + { + if ($prop_array['value'] !== $query && $prop_array['hits'] > $result->get_count_total_results()) + { + $prop = $prop_array['value']; + break; + } + } + } + } + + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); + + if ($result->get_count_total_results() === 0) + { + $template = 'prod/results/help.twig'; + } + else + { + if ($mod == 'thumbs') + { + $template = 'prod/results/answergrid.html'; + } + else + { + $template = 'prod/results/answerlist.html'; + } + } + + $json['results'] = $twig->render($template, array( + 'results' => $result, + 'GV_social_tools' => $registry->get('GV_social_tools'), + 'highlight' => $search_engine->get_query(), + 'searchEngine' => $search_engine, + 'suggestions' => $prop + ) + ); + + + $json['query'] = $query; + $json['phrasea_props'] = $proposals; + $json['total_answers'] = (int) $result->get_count_available_results(); + $json['next_page'] = ($page < $npages && $result->get_count_available_results() > 0) ? ($page + 1) : false; + $json['prev_page'] = ($page > 1 && $result->get_count_available_results() > 0) ? ($page - 1) : false; + $json['form'] = $form; + + + $datas = $app['Core']['Serializer']->serialize($json, 'json'); + + return new Response($datas, 200, array('Content-Type' => 'application/json')); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Root.php b/lib/Alchemy/Phrasea/Controller/Prod/Root.php new file mode 100644 index 0000000000..8d7bd9b7a7 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Root.php @@ -0,0 +1,148 @@ +get('/', function(Application $app) + { + + \User_Adapter::updateClientInfos(1); + + $appbox = \appbox::get_instance($app['Core']); + $registry = $app['Core']->getRegistry(); + $user = $app['Core']->getAuthenticatedUser(); + $cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/'; + + $css = array(); + $cssfile = false; + + $finder = new Finder(); + + $iterator = $finder + ->directories() + ->depth(0) + ->filter(function(\SplFileInfo $fileinfo) + { + return ctype_xdigit($fileinfo->getBasename()); + }) + ->in($cssPath); + + foreach ($iterator as $dir) + { + $baseName = $dir->getBaseName(); + $css[$baseName] = $baseName; + } + + $cssfile = $user->getPrefs('css'); + + if (!$cssfile && isset($css['000000'])) + { + $cssfile = '000000'; + } + + + $user_feeds = \Feed_Collection::load_all($appbox, $user); + $feeds = array_merge(array($user_feeds->get_aggregate()), $user_feeds->get_feeds()); + + $thjslist = ""; + + $queries_topics = ''; + + if ($registry->get('GV_client_render_topics') == 'popups') + { + $queries_topics = \queries::dropdown_topics(); + } + elseif ($registry->get('GV_client_render_topics') == 'tree') + { + $queries_topics = \queries::tree_topics(); + } + + $sbas = $bas2sbas = array(); + + foreach ($appbox->get_databoxes() as $databox) + { + $sbas_id = $databox->get_sbas_id(); + + $sbas['s' + $sbas_id] = array( + 'sbid' => $sbas_id, + 'seeker' => null); + + foreach ($databox->get_collections() as $coll) + { + $bas2sbas['b' . $coll->get_base_id()] = array( + 'sbid' => $sbas_id, + 'ckobj' => array('checked' => false), + 'waschecked' => false + ); + } + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $Serializer = $app['Core']['Serializer']; + + $out = $twig->render('prod/index.html.twig', array( + 'module_name' => 'Production', + 'WorkZone' => new Helper\WorkZone($app['Core'], $app['request']), + 'module_prod' => new Helper\Prod($app['Core'], $app['request']), + 'cssfile' => $cssfile, + 'module' => 'prod', + 'events' => \eventsmanager_broker::getInstance($appbox, $app['Core']), + 'GV_defaultQuery_type' => $registry->get('GV_defaultQuery_type'), + 'GV_multiAndReport' => $registry->get('GV_multiAndReport'), + 'GV_thesaurus' => $registry->get('GV_thesaurus'), + 'cgus_agreement' => \databox_cgu::askAgreement(), + 'css' => $css, + 'feeds' => $feeds, + 'GV_google_api' => $registry->get('GV_google_api'), + 'queries_topics' => $queries_topics, + 'search_status' => \databox_status::getSearchStatus(), + 'queries_history' => \queries::history(), + 'thesau_js_list' => $thjslist, + 'thesau_json_sbas' => $Serializer->serialize($sbas, 'json'), + 'thesau_json_bas2sbas' => $Serializer->serialize($bas2sbas, 'json'), + 'thesau_languages' => \User_Adapter::avLanguages(), + 'GV_bitly_user' => $registry->get('GV_bitly_user'), + 'GV_bitly_key' => $registry->get('GV_bitly_key') + )); + + return new Response($out); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Story.php b/lib/Alchemy/Phrasea/Controller/Prod/Story.php new file mode 100644 index 0000000000..ae5d2c3ea3 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Story.php @@ -0,0 +1,351 @@ +get('/create/', function(Application $app) + { + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render('prod/Story/Create.html.twig', array())); + }); + + $controllers->post('/', function(Application $app, Request $request) + { + /* @var $request \Symfony\Component\HttpFoundation\Request */ + $em = $app['Core']->getEntityManager(); + + $user = $app['Core']->getAuthenticatedUser(); + + $collection = \collection::get_from_base_id($request->get('base_id')); + + + if (!$user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord')) + { + throw new \Exception_Forbidden('You can not create a story on this collection'); + } + + + $system_file = new \system_file( + $app['Core']->getRegistry() + ->get('GV_RootPath') . 'www/skins/icons/substitution/regroup_doc.png' + ); + + $Story = \record_adapter::create($collection, $system_file, false, true); + + foreach (explode(';', $request->get('lst')) as $sbas_rec) + { + $sbas_rec = explode('_', $sbas_rec); + + if (count($sbas_rec) !== 2) + { + continue; + } + + $record = new \record_adapter($sbas_rec[0], $sbas_rec[1]); + + if (!$user->ACL()->has_access_to_base($record->get_base_id()) + && !$user->ACL()->has_hd_grant($record) + && !$user->ACL()->has_preview_grant($record)) + { + continue; + } + + if ($Story->hasChild($record)) + continue; + + $Story->appendChild($record); + } + + $metadatas = array(); + + foreach ($collection->get_databox()->get_meta_structure() as $meta) + { + if ($meta->get_thumbtitle()) + { + $value = $request->get('name'); + } + else + { + continue; + } + + $metadatas[] = array( + 'meta_struct_id' => $meta->get_id() + , 'meta_id' => null + , 'value' => $value + ); + + break; + } + + $Story->set_metadatas($metadatas)->rebuild_subdefs(); + + $StoryWZ = new \Entities\StoryWZ(); + $StoryWZ->setUser($user); + $StoryWZ->setRecord($Story); + + $em->persist($StoryWZ); + + $em->flush(); + + if ($request->getRequestFormat() == 'json') + { + $data = array( + 'success' => true + , 'message' => _('Story created') + , 'WorkZone' => $StoryWZ->getId() + , 'story' => array( + 'sbas_id' => $Story->get_sbas_id(), + 'record_id' => $Story->get_record_id(), + ) + ); + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse(sprintf('/%d/', $StoryWZ->getId())); + } + }); + + + + $controllers->get('/{sbas_id}/{record_id}/', function(Application $app, $sbas_id, $record_id) + { + $Story = new \record_adapter($sbas_id, $record_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $html = $twig->render('prod/WorkZone/Story.html.twig', array('Story' => $Story)); + + return new Response($html); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $controllers->post( + '/{sbas_id}/{record_id}/addElements/' + , function(Application $app, Request $request, $sbas_id, $record_id) + { + $Story = new \record_adapter($sbas_id, $record_id); + + $user = $app['Core']->getAuthenticatedUser(); + + if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord')) + throw new \Exception_Forbidden('You can not add document to this Story'); + + /* @var $user \User_Adapter */ + + $n = 0; + + foreach (explode(';', $request->get('lst')) as $sbas_rec) + { + $sbas_rec = explode('_', $sbas_rec); + + if (count($sbas_rec) !== 2) + continue; + + $record = new \record_adapter($sbas_rec[0], $sbas_rec[1]); + + if (!$user->ACL()->has_access_to_base($record->get_base_id()) + && !$user->ACL()->has_hd_grant($record) + && !$user->ACL()->has_preview_grant($record)) + { + continue; + } + + if ($Story->hasChild($record)) + continue; + + $Story->appendChild($record); + + $n++; + } + + $data = array( + 'success' => true + , 'message' => sprintf(_('%d records added'), $n) + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + $controllers->post( + '/{sbas_id}/{record_id}/delete/{child_sbas_id}/{child_record_id}/' + , function(Application $app, Request $request, $sbas_id, $record_id, $child_sbas_id, $child_record_id) + { + $Story = new \record_adapter($sbas_id, $record_id); + + $record = new \record_adapter($child_sbas_id, $child_record_id); + + $user = $app['Core']->getAuthenticatedUser(); + + if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord')) + throw new \Exception_Forbidden('You can not add document to this Story'); + + /* @var $user \User_Adapter */ + + $Story->removeChild($record); + + $data = array( + 'success' => true + , 'message' => _('Record removed from story') + ); + + if ($request->getRequestFormat() == 'json') + { + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + }) + ->assert('sbas_id', '\d+') + ->assert('record_id', '\d+') + ->assert('child_sbas_id', '\d+') + ->assert('child_record_id', '\d+'); + + + /** + * Get the Basket reorder form + */ + $controllers->get( + '/{sbas_id}/{record_id}/reorder/' + , function(Application $app, $sbas_id, $record_id) + { + /* @var $em \Doctrine\ORM\EntityManager */ + $em = $app['Core']->getEntityManager(); + + $story = new \record_adapter($sbas_id, $record_id); + + if (!$story->is_grouping()) + { + throw new \Exception('This is not a story'); + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'prod/Story/Reorder.html.twig' + , array('story' => $story) + ) + ); + }) + ->assert('sbas_id', '\d+') + ->assert('record_id', '\d+'); + + + $controllers->post( + '/{sbas_id}/{record_id}/reorder/' + , function(Application $app, $sbas_id, $record_id) + { + $ret = array('success' => false, 'message' => _('An error occured')); + try + { + $user = $app['Core']->getAuthenticatedUser(); + /* @var $user \User_Adapter */ + + $story = new \record_adapter($sbas_id, $record_id); + + if (!$story->is_grouping()) + { + throw new \Exception('This is not a story'); + } + + if (!$user->ACL()->has_right_on_base($story->get_base_id(), 'canmodifrecord')) + { + throw new ControllerException(_('You can not edit this story')); + } + + $sql = 'UPDATE regroup SET ord = :ord + WHERE rid_parent = :parent_id AND rid_child = :children_id'; + $stmt = $story->get_databox()->get_connection()->prepare($sql); + + foreach ($app['request']->get('element') as $record_id => $ord) + { + $params = array( + ':ord' => $ord, + ':parent_id' => $story->get_record_id(), + ':children_id' => $record_id + ); + $stmt->execute($params); + } + + $stmt->closeCursor(); + + $ret = array('success' => true, 'message' => _('Story updated')); + } + catch (ControllerException $e) + { + $ret = array('success' => false, 'message' => $e->getMessage()); + } + catch (\Exception $e) + { + + } + + $Serializer = $app['Core']['Serializer']; + + return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json')); + }) + ->assert('sbas_id', '\d+') + ->assert('record_id', '\d+'); + + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/TOU.php b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php new file mode 100644 index 0000000000..57a0fa1fb1 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php @@ -0,0 +1,70 @@ +post('/deny/{sbas_id}/', function(Application $app, Request $request, $sbas_id) + { + $ret = array('success' => false, 'message' => ''); + + try + { + $user = $app['Core']->getAuthenticatedUser(); + $session = \Session_Handler::getInstance(\appbox::get_instance($app['Core'])); + + $databox = \databox::get_instance((int) $sbas_id); + + $user->ACL()->revoke_access_from_bases( + $user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) + ); + $user->ACL()->revoke_unused_sbas_rights(); + + $session->logout(); + + $ret = array('success' => true, 'message' => ''); + } + catch (\Exception $e) + { + + } + + $Serializer = $app['Core']['Serializer']; + $datas = $Serializer->serialize($ret, 'json'); + + return new Response($datas, 200, array('Content-Type' => 'application/json')); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php new file mode 100644 index 0000000000..f33328fde4 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php @@ -0,0 +1,206 @@ +post('/basket/{basket_id}/' + , function(Application $app, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render('prod/Tooltip/Basket.html.twig', array('basket' => $basket)); + })->assert('basket_id', '\d+'); + + $controllers->post('/Story/{sbas_id}/{record_id}/' + , function(Application $app, $sbas_id, $record_id) + { + $Story = new \record_adapter($sbas_id, $record_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return $twig->render('prod/Tooltip/Story.html.twig', array('Story' => $Story)); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $controllers->post('/user/{usr_id}/' + , function(Application $app, $usr_id) + { + $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core'])); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render( + 'prod/Tooltip/User.html.twig' + , array('user' => $user) + ) + ); + })->assert('usr_id', '\d+'); + + + $controllers->post('/preview/{sbas_id}/{record_id}/' + , function(Application $app, $sbas_id, $record_id) + { + $record = new \record_adapter($sbas_id, $record_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response($twig->render( + 'common/preview.html' + , array( + 'record' => $record + , 'not_wrapped' => true + ) + ) + ); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $controllers->post('/caption/{sbas_id}/{record_id}/{view}/' + , function(Application $app, $sbas_id, $record_id, $view) + { + $number = (int) $app['request']->get('number'); + $record = new \record_adapter($sbas_id, $record_id, $number); + + $search_engine = null; + + if($view == 'answer') + { + if (($search_engine_options = unserialize($app['request']->get('options_serial'))) !== false) + { + $search_engine = new \searchEngine_adapter($app['appbox']->get_registry()); + $search_engine->set_options($search_engine_options); + } + } + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'common/caption.html' + , array( + 'record' => $record + , 'view' => $view + , 'highlight' => $app['request']->get('query') + , 'searchEngine' => $search_engine + ) + ) + ); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $controllers->post('/tc_datas/{sbas_id}/{record_id}/' + , function(Application $app, $sbas_id, $record_id) + { + $record = new \record_adapter($sbas_id, $record_id); + $document = $record->get_subdef('document'); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'common/technical_datas.twig' + , array('record' => $record, 'document' => $document) + ) + ); + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + $controllers->post('/metas/FieldInfos/{sbas_id}/{field_id}/' + , function(Application $app, $sbas_id, $field_id) + { + $databox = \databox::get_instance((int) $sbas_id); + $field = \databox_field::get_instance($databox, $field_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'common/databox_field.twig' + , array('field' => $field) + ) + ); + })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); + + + $controllers->post('/DCESInfos/{sbas_id}/{field_id}/' + , function(Application $app, $sbas_id, $field_id) + { + $databox = \databox::get_instance((int) $sbas_id); + $field = \databox_field::get_instance($databox, $field_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'common/databox_field_DCES.twig' + , array('field' => $field) + ) + ); + })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); + + + $controllers->post('/metas/restrictionsInfos/{sbas_id}/{field_id}/' + , function(Application $app, $sbas_id, $field_id) + { + $databox = \databox::get_instance((int) $sbas_id); + $field = \databox_field::get_instance($databox, $field_id); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + return new Response( + $twig->render( + 'common/databox_field_restrictions.twig' + , array('field' => $field) + ) + ); + })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php b/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php new file mode 100644 index 0000000000..d42a0c809c --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php @@ -0,0 +1,69 @@ +post('/save/', function(Application $app, Request $request) + { + $ret = array('success' => false, 'message' => _('Error while saving preference')); + + try + { + $user = $app['Core']->getAuthenticatedUser(); + + $ret = $user->setPrefs($request->get('prop'), $request->get('value')); + + if ($ret == $request->get('value')) + $output = "1"; + else + $output = "0"; + + $ret = array('success' => true, 'message' => _('Preference saved !')); + } + catch (\Exception $e) + { + + } + + $Serializer = $app['Core']['Serializer']; + $datas = $Serializer->serialize($ret, 'json'); + + return new Response($datas, 200, array('Content-Type' => 'application/json')); + }); + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php new file mode 100644 index 0000000000..18d9801fd0 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php @@ -0,0 +1,678 @@ +get('/all/', function(Application $app, Request $request) + { + + $datas = array( + 'success' => false + , 'message' => '' + , 'result' => null + ); + + $lists = new \Doctrine\Common\Collections\ArrayCollection(); + + try + { + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $lists = $repository->findUserLists($app['Core']->getAuthenticatedUser()); + + $result = array(); + + foreach ($lists as $list) + { + $owners = $entries = array(); + + foreach ($list->getOwners() as $owner) + { + $owners[] = array( + 'usr_id' => $owner->getUser()->get_id(), + 'display_name' => $owner->getUser()->get_display_name(), + 'position' => $owner->getUser()->get_position(), + 'job' => $owner->getUser()->get_job(), + 'company' => $owner->getUser()->get_company(), + 'email' => $owner->getUser()->get_email(), + 'role' => $owner->getRole() + ); + } + + foreach ($list->getEntries() as $entry) + { + $entries[] = array( + 'usr_id' => $owner->getUser()->get_id(), + 'display_name' => $owner->getUser()->get_display_name(), + 'position' => $owner->getUser()->get_position(), + 'job' => $owner->getUser()->get_job(), + 'company' => $owner->getUser()->get_company(), + 'email' => $owner->getUser()->get_email(), + ); + } + + + /* @var $list \Entities\UsrList */ + $result[] = array( + 'name' => $list->getName(), + 'created' => $list->getCreated()->format(DATE_ATOM), + 'updated' => $list->getUpdated()->format(DATE_ATOM), + 'owners' => $owners, + 'users' => $entries + ); + } + + $datas = array( + 'success' => true + , 'message' => '' + , 'result' => $result + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + } + + if ($request->getRequestFormat() == 'json') + { + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + else + { + + return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/lists-all.html.twig', array('lists' => $lists))); + } + } + ); + + /** + * Creates a list + */ + $controllers->post('/list/', function(Application $app) + { + $request = $app['request']; + + $list_name = $request->get('name'); + + $datas = array( + 'success' => false + , 'message' => sprintf(_('Unable to create list %s'), $list_name) + , 'list_id' => null + ); + + try + { + if (!$list_name) + { + throw new ControllerException(_('List name is required')); + } + + $em = $app['Core']->getEntityManager(); + + $List = new \Entities\UsrList(); + + $Owner = new \Entities\UsrListOwner(); + $Owner->setRole(\Entities\UsrListOwner::ROLE_ADMIN); + $Owner->setUser($app['Core']->getAuthenticatedUser()); + $Owner->setList($List); + + $List->setName($list_name); + $List->addUsrListOwner($Owner); + + $em->persist($Owner); + $em->persist($List); + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => sprintf(_('List %s has been created'), $list_name) + , 'list_id' => $List->getId() + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + ); + + /** + * Gets a list + */ + $controllers->get('/list/{list_id}/', function(Application $app, Request $request, $list_id) + { + + $result = array(); + + $user = $app['Core']->getAuthenticatedUser(); + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + + $entries = new \Doctrine\Common\Collections\ArrayCollection(); + $owners = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($list->getOwners() as $owner) + { + $owners[] = array( + 'usr_id' => $owner->getUser()->get_id(), + 'display_name' => $owner->getUser()->get_display_name(), + 'position' => $owner->getUser()->get_position(), + 'job' => $owner->getUser()->get_job(), + 'company' => $owner->getUser()->get_company(), + 'email' => $owner->getUser()->get_email(), + 'role' => $owner->getRole() + ); + } + + foreach ($list->getEntries() as $entry) + { + $entries[] = array( + 'usr_id' => $entry->getUser()->get_id(), + 'display_name' => $entry->getUser()->get_display_name(), + 'position' => $entry->getUser()->get_position(), + 'job' => $entry->getUser()->get_job(), + 'company' => $entry->getUser()->get_company(), + 'email' => $entry->getUser()->get_email(), + ); + } + + + /* @var $list \Entities\UsrList */ + $result = array( + 'id' => $list->getId(), + 'name' => $list->getName(), + 'created' => $list->getCreated()->format(DATE_ATOM), + 'updated' => $list->getUpdated()->format(DATE_ATOM), + 'owners' => $owners, + 'users' => $entries + ); + + + return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $result)); + } + ); + + /** + * Update a list + */ + $controllers->post('/list/{list_id}/update/', function(Application $app, $list_id) + { + $request = $app['request']; + + $datas = array( + 'success' => false + , 'message' => _('Unable to update list') + ); + + try + { + $list_name = $request->get('name'); + + if (!$list_name) + { + throw new ControllerException(_('List name is required')); + } + + $user = $app['Core']->getAuthenticatedUser(); + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + + if($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_EDITOR) + { + throw new ControllerException(_('You are not authorized to do this')); + } + + $list->setName($list_name); + + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => _('List has been updated') + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+'); + + /** + * Delete a list + */ + $controllers->post('/list/{list_id}/delete/', function(Application $app, $list_id) + { + $em = $app['Core']->getEntityManager(); + + try + { + $repository = $em->getRepository('\Entities\UsrList'); + + $user = $app['Core']->getAuthenticatedUser(); + + $list = $repository->findUserListByUserAndId($user, $list_id); + + if($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_ADMIN) + { + throw new ControllerException(_('You are not authorized to do this')); + } + + $em->remove($list); + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => sprintf(_('List has been deleted')) + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + $datas = array( + 'success' => false + , 'message' => sprintf(_('Unable to delete list')) + ); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+'); + + + /** + * Remove a usr_id from a list + */ + $controllers->post('/list/{list_id}/remove/{usr_id}/', function(Application $app, $list_id, $usr_id) + { + $em = $app['Core']->getEntityManager(); + + try + { + $repository = $em->getRepository('\Entities\UsrList'); + + $user = $app['Core']->getAuthenticatedUser(); + + $list = $repository->findUserListByUserAndId($user, $list_id); + /* @var $list \Entities\UsrList */ + + if($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_EDITOR) + { + throw new ControllerException(_('You are not authorized to do this')); + } + + $entry_repository = $em->getRepository('\Entities\UsrListEntry'); + + $user_entry = $entry_repository->findEntryByListAndUsrId($list, $usr_id); + + $em->remove($user_entry); + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => _('Entry removed from list') + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + $datas = array( + 'success' => false + , 'message' => _('Unable to remove entry from list ' . $e->getMessage()) + ); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+')->assert('entry_id', '\d+'); + + /** + * Adds a usr_id to a list + */ + $controllers->post('/list/{list_id}/add/', function(Application $app, Request $request, $list_id) + { + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + try + { + if (!is_array($request->get('usr_ids'))) + { + throw new Controller\Exception('Invalid or missing parameter usr_ids'); + } + + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + /* @var $list \Entities\UsrList */ + + if($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_EDITOR) + { + throw new ControllerException(_('You are not authorized to do this')); + } + + $inserted_usr_ids = array(); + + foreach ($request->get('usr_ids') as $usr_id) + { + $user_entry = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core'])); + + if ($list->has($user_entry)) + continue; + + $entry = new \Entities\UsrListEntry(); + $entry->setUser($user_entry); + $entry->setList($list); + + $list->addUsrListEntry($entry); + + $em->persist($entry); + + $inserted_usr_ids[] = $user_entry->get_id(); + } + + $em->flush(); + + if (count($inserted_usr_ids) > 1) + { + $datas = array( + 'success' => true + , 'message' => sprintf(_('%d Users added to list'), count($inserted_usr_ids)) + , 'result' => $inserted_usr_ids + ); + } + else + { + $datas = array( + 'success' => true + , 'message' => sprintf(_('%d User added to list'), count($inserted_usr_ids)) + , 'result' => $inserted_usr_ids + ); + } + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + $datas = array( + 'success' => false + , 'message' => _('Unable to add usr to list') + ); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+')->assert('usr_id', '\d+'); + + $controllers->get('/list/{list_id}/share/', function(Application $app, Request $request, $list_id) + { + + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + $list = null; + + try + { + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + /* @var $list \Entities\UsrList */ + + if ($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_ADMIN) + { + $list = null; + throw new \Exception(_('You are not authorized to do this')); + } + + } + catch (\Exception $e) + { + + } + + return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/List-Share.html.twig', array('list' => $list))); + })->assert('list_id', '\d+'); + + /** + * Share a list to a user with an optionnal role + */ + $controllers->post('/list/{list_id}/share/{usr_id}/', function(Application $app, $list_id, $usr_id) + { + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + $availableRoles = array( + \Entities\UsrListOwner::ROLE_USER, + \Entities\UsrListOwner::ROLE_EDITOR, + \Entities\UsrListOwner::ROLE_ADMIN, + ); + + if (!$app['request']->get('role')) + throw new \Exception_BadRequest('Missing role parameter'); + elseif (!in_array($app['request']->get('role'), $availableRoles)) + throw new \Exception_BadRequest('Role is invalid'); + + try + { + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + /* @var $list \Entities\UsrList */ + + if ($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_EDITOR) + { + throw new ControllerException(_('You are not authorized to do this')); + } + + $new_owner = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core'])); + + if ($list->hasAccess($new_owner)) + { + if($new_owner->get_id() == $user->get_id()) + { + throw new ControllerException('You can not downgrade your Admin right'); + } + + $owner = $list->getOwner($new_owner); + } + else + { + $owner = new \Entities\UsrListOwner(); + $owner->setList($list); + $owner->setUser($new_owner); + + $list->addUsrListOwner($owner); + + $em->persist($owner); + } + + $role = $app['request']->get('role'); + + $owner->setRole($role); + + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => _('List shared to user') + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + + $datas = array( + 'success' => false + , 'message' => _('Unable to share the list with the usr') + ); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+')->assert('usr_id', '\d+'); + /** + * UnShare a list to a user + */ + $controllers->post('/list/{list_id}/unshare/{usr_id}/', function(Application $app, $list_id, $usr_id) + { + $em = $app['Core']->getEntityManager(); + $user = $app['Core']->getAuthenticatedUser(); + + try + { + $repository = $em->getRepository('\Entities\UsrList'); + + $list = $repository->findUserListByUserAndId($user, $list_id); + /* @var $list \Entities\UsrList */ + + if ($list->getOwner($user)->getRole() < \Entities\UsrListOwner::ROLE_ADMIN) + { + throw new \Exception(_('You are not authorized to do this')); + } + + $owners_repository = $em->getRepository('\Entities\UsrListOwner'); + + $owner = $owners_repository->findByListAndUsrId($list, $usr_id); + + $em->remove($owner); + $em->flush(); + + $datas = array( + 'success' => true + , 'message' => _('Owner removed from list') + ); + } + catch (ControllerException $e) + { + $datas = array( + 'success' => false + , 'message' => $e->getMessage() + ); + } + catch (\Exception $e) + { + $datas = array( + 'success' => false + , 'message' => _('Unable to remove usr from list') + ); + } + + $Json = $app['Core']['Serializer']->serialize($datas, 'json'); + + return new Response($Json, 200, array('Content-Type' => 'application/json')); + } + )->assert('list_id', '\d+')->assert('usr_id', '\d+'); + + + return $controllers; + } + +} diff --git a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php new file mode 100644 index 0000000000..78f2d6364c --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php @@ -0,0 +1,272 @@ +get('/', function(Application $app) + { + $params = array( + 'WorkZone' => new Helper\WorkZone($app['Core'], $app['request']) + , 'selected_type' => $app['request']->get('type') + , 'selected_id' => $app['request']->get('id') + , 'srt' => $app['request']->get('sort') + ); + + + return new Response($app['Core']->getTwig()->render('prod/WorkZone/WorkZone.html.twig', $params)); + }); + + $controllers->get('/Browse/', function(Application $app) + { + $date_obj = new \DateTime(); + + $params = array( + 'CurrentYear' => $date_obj->format('Y') + ); + + return new Response( + $app['Core']->getTwig()->render('prod/WorkZone/Browser/Browser.html.twig' + , $params + ) + ); + }); + + $controllers->get('/Browse/Search/', function(Application $app) + { + + $user = $app['Core']->getAuthenticatedUser(); + + $request = $app['request']; + + $em = $app['Core']->getEntityManager(); + /* @var $em \Doctrine\ORM\EntityManager */ + + $BasketRepo = $em->getRepository('\Entities\Basket'); + + $Page = (int) $request->get('Page', 0); + + $PerPage = 10; + $offsetStart = max(($Page - 1) * $PerPage, 0); + + + $Baskets = $BasketRepo->findWorkzoneBasket( + $user + , $request->get('Query') + , $request->get('Year') + , $request->get('Type') + , $offsetStart + , $PerPage + ); + + $page = floor($offsetStart / $PerPage) + 1; + $maxPage = floor($Baskets['count'] / $PerPage) + 1; + + + $params = array( + 'Baskets' => $Baskets['result'] + , 'Page' => $page + , 'MaxPage' => $maxPage + , 'Total' => $Baskets['count'] + , 'Query' => $request->get('Query') + , 'Year' => $request->get('Year') + , 'Type' => $request->get('Type') + ); + + return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Results.html.twig', $params)); + }); + + $controllers->get('/Browse/Basket/{basket_id}/', function(Application $app, Request $request, $basket_id) + { + + $em = $app['Core']->getEntityManager(); + + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false); + + $params = array( + 'Basket' => $basket + ); + + return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Basket.html.twig', $params)); + })->assert('basket_id', '\d+'); + + + $controllers->post( + '/attachStories/' + , function(Application $app, Request $request) + { + if (!$request->get('stories')) + throw new \Exception_BadRequest(); + + $user = $app['Core']->getAuthenticatedUser(); + + $em = $app['Core']->getEntityManager(); + /* @var $em \Doctrine\ORM\EntityManager */ + + $StoryWZRepo = $em->getRepository('\Entities\StoryWZ'); + + $alreadyFixed = $done = 0; + + $stories = $request->get('stories', array()); + + foreach ($stories as $element) + { + $element = explode('_', $element); + $Story = new \record_adapter($element[0], $element[1]); + + if (!$Story->is_grouping()) + throw new \Exception('You can only attach stories'); + + if (!$user->ACL()->has_access_to_base($Story->get_base_id())) + throw new \Exception_Forbidden('You do not have access to this Story'); + + + if ($StoryWZRepo->findUserStory($user, $Story)) + { + $alreadyFixed++; + continue; + } + + $StoryWZ = new \Entities\StoryWZ(); + $StoryWZ->setUser($user); + $StoryWZ->setRecord($Story); + + $em->persist($StoryWZ); + $done++; + } + + $em->flush(); + + if ($alreadyFixed === 0) + { + if ($done <= 1) + { + $message = sprintf( + _('%d Story attached to the WorkZone') + , $done + ); + } + else + { + $message = sprintf( + _('%d Stories attached to the WorkZone') + , $done + ); + } + } + else + { + if ($done <= 1) + { + $message = sprintf( + _('%1$d Story attached to the WorkZone, %2$d already attached') + , $done + , $alreadyFixed + ); + } + else + { + $message = sprintf( + _('%1$d Stories attached to the WorkZone, %2$d already attached') + , $done + , $alreadyFixed + ); + } + } + + $data = array( + 'success' => true + , 'message' => $message + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/{sbas_id}/{record_id}/'); + } + }); + + + $controllers->post( + '/detachStory/{sbas_id}/{record_id}/' + , function(Application $app, Request $request, $sbas_id, $record_id) + { + $Story = new \record_adapter($sbas_id, $record_id); + + $user = $app['Core']->getAuthenticatedUser(); + + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\StoryWZ'); + + /* @var $repository \Repositories\StoryWZRepository */ + $StoryWZ = $repository->findUserStory($user, $Story); + + if (!$StoryWZ) + { + throw new \Exception_NotFound('Story not found'); + } + $em->remove($StoryWZ); + + $em->flush(); + + $data = array( + 'success' => true + , 'message' => _('Story detached from the WorkZone') + ); + + if ($request->getRequestFormat() == 'json') + { + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); + + + return $controllers; + } + +} diff --git a/lib/classes/Controller/RSSFeeds.class.php b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php similarity index 79% rename from lib/classes/Controller/RSSFeeds.class.php rename to lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php index 7efe918ed0..ac89652ca8 100644 --- a/lib/classes/Controller/RSSFeeds.class.php +++ b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Root; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,12 +19,20 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -class Controller_RSSFeeds implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ + + +class RSSFeeds implements ControllerProviderInterface { public function connect(Application $app) { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($app['Core']); $controllers = new ControllerCollection(); @@ -38,35 +42,35 @@ class Controller_RSSFeeds implements ControllerProviderInterface $perPage = 5; $entries = $feed->get_entries((($page - 1) * $perPage), $perPage); - $registry = registry::get_instance(); + $registry = \registry::get_instance(); - if ($format == Feed_Adapter::FORMAT_RSS) + if ($format == \Feed_Adapter::FORMAT_RSS) { - $content = new Feed_XML_RSS(); + $content = new \Feed_XML_RSS(); } - if ($format == Feed_Adapter::FORMAT_ATOM) + if ($format == \Feed_Adapter::FORMAT_ATOM) { - $content = new Feed_XML_Atom(); + $content = new \Feed_XML_Atom(); } - if($format == Feed_Adapter::FORMAT_COOLIRIS) + if($format == \Feed_Adapter::FORMAT_COOLIRIS) { - $content = new Feed_XML_Cooliris(); + $content = new \Feed_XML_Cooliris(); } - if ($user instanceof User_Adapter) + if ($user instanceof \User_Adapter) $link = $feed->get_user_link($registry, $user, $format, $page); else $link = $feed->get_homepage_link($registry, $format, $page); - $content->set_updated_on(new DateTime()); + $content->set_updated_on(new \DateTime()); $content->set_title($feed->get_title()); $content->set_subtitle($feed->get_subtitle()); $content->set_generator('Phraseanet'); $content->set_link($link); - if ($user instanceof User_Adapter) + if ($user instanceof \User_Adapter) { if ($page > 1) $content->set_previous_page($feed->get_user_link($registry, $user, $format, ($page - 1))); @@ -94,7 +98,7 @@ class Controller_RSSFeeds implements ControllerProviderInterface $controllers->get('/feed/{id}/{format}/', function($id, $format) use ($app, $appbox, $display_feed) { - $feed = new Feed_Adapter($appbox, $id); + $feed = new \Feed_Adapter($appbox, $id); if (!$feed->is_public()) { @@ -115,10 +119,10 @@ class Controller_RSSFeeds implements ControllerProviderInterface { try { - $token = new Feed_Token($appbox, $token, $id); + $token = new \Feed_Token($appbox, $token, $id); $feed = $token->get_feed(); } - catch (Exception_FeedNotFound $e) + catch (\Exception_FeedNotFound $e) { return new Response('Not Found', 404); } @@ -136,10 +140,10 @@ class Controller_RSSFeeds implements ControllerProviderInterface { try { - $token = new Feed_TokenAggregate($appbox, $token); + $token = new \Feed_TokenAggregate($appbox, $token); $feed = $token->get_feed(); } - catch (Exception_FeedNotFound $e) + catch (\Exception_FeedNotFound $e) { return new Response('', 404); } @@ -150,13 +154,13 @@ class Controller_RSSFeeds implements ControllerProviderInterface $page = $page < 1 ? 1 : $page; return $display_feed($feed, $format, $page, $token->get_user()); - })->assert('id', '\d+')->assert('format', '(rss|atom)'); + })->assert('format', '(rss|atom)'); $controllers->get('/aggregated/{format}/', function($format) use ($app, $appbox, $display_feed) { - $feeds = Feed_Collection::load_public_feeds($appbox); + $feeds = \Feed_Collection::load_public_feeds($appbox); $feed = $feeds->get_aggregate(); $request = $app['request']; @@ -167,14 +171,14 @@ class Controller_RSSFeeds implements ControllerProviderInterface })->assert('format', '(rss|atom)'); $controllers->get('/cooliris/', function() use ($app, $appbox, $display_feed) { - $feeds = Feed_Collection::load_public_feeds($appbox); + $feeds = \Feed_Collection::load_public_feeds($appbox); $feed = $feeds->get_aggregate(); $request = $app['request']; $page = (int) $request->get('page'); $page = $page < 1 ? 1 : $page; - return $display_feed($feed, Feed_Adapter::FORMAT_COOLIRIS , $page); + return $display_feed($feed, \Feed_Adapter::FORMAT_COOLIRIS , $page); }); return $controllers; diff --git a/lib/classes/Controller/Setup/Installer.class.php b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php similarity index 53% rename from lib/classes/Controller/Setup/Installer.class.php rename to lib/Alchemy/Phrasea/Controller/Setup/Installer.php index 078adea9d1..3348e4819d 100644 --- a/lib/classes/Controller/Setup/Installer.class.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Setup; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,42 +19,29 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -date_default_timezone_set('Europe/Berlin'); -require_once dirname(__FILE__) . '/../../../version.inc'; -require_once dirname(__FILE__) . '/../../phrasea.class.php'; -require_once dirname(__FILE__) . '/../../bootstrap.class.php'; -require_once dirname(__FILE__) . '/../../cache/cacheableInterface.class.php'; -require_once dirname(__FILE__) . '/../../cache/interface.class.php'; -require_once dirname(__FILE__) . '/../../cache/nocache.class.php'; -require_once dirname(__FILE__) . '/../../cache/adapter.class.php'; -require_once dirname(__FILE__) . '/../../User/Interface.class.php'; -require_once dirname(__FILE__) . '/../../User/Adapter.class.php'; - -bootstrap::register_autoloads(); -bootstrap::set_php_configuration(); - -class Controller_Setup_Installer implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class Installer implements ControllerProviderInterface { public function connect(Application $app) { $controllers = new ControllerCollection(); - $app['available_languages'] = User_Adapter::detectLanguage(new Setup_Registry()); - $controllers->get('/', function() use ($app) { $request = $app['request']; - $servername = $request->getScheme() . '://' . $request->getHttpHost() . '/'; - setup::write_config($servername); - - $php_constraint = setup::check_php_version(); - $writability_constraints = setup::check_writability(new Setup_Registry()); - $extension_constraints = setup::check_php_extension(); - $opcode_constraints = setup::check_cache_opcode(); - $php_conf_constraints = setup::check_php_configuration(); - $locales_constraints = setup::check_system_locales(); + $php_constraint = \setup::check_php_version(); + $writability_constraints = \setup::check_writability(new \Setup_Registry()); + $extension_constraints = \setup::check_php_extension(); + $opcode_constraints = \setup::check_cache_opcode(); + $php_conf_constraints = \setup::check_php_configuration(); + $locales_constraints = \setup::check_system_locales(); $constraints_coll = array( 'php_constraint' => $php_constraint @@ -90,17 +73,17 @@ class Controller_Setup_Installer implements ControllerProviderInterface } - $ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); - $loader = new Twig_Loader_Filesystem($ld_path); - $twig = new Twig_Environment($loader); + $ld_path = array(__DIR__ . '/../../../../../templates/web'); + $loader = new \Twig_Loader_Filesystem($ld_path); + $twig = new \Twig_Environment($loader); $html = $twig->render( - '/setup/index.twig' + '/setup/index.html.twig' , array_merge($constraints_coll, array( - 'locale' => Session_Handler::get_locale() - , 'available_locales' => $app['available_languages'] - , 'version_number' => GV_version - , 'version_name' => GV_version_name + 'locale' => \Session_Handler::get_locale() + , 'available_locales' => $app['Core']::getAvailableLanguages() + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() , 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/' )) ); @@ -110,34 +93,64 @@ class Controller_Setup_Installer implements ControllerProviderInterface $controllers->get('/step2/', function() use ($app) { - phrasea::use_i18n(Session_Handler::get_locale()); + \phrasea::use_i18n(\Session_Handler::get_locale()); - $ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); + $ld_path = array(__DIR__ . '/../../../../../templates/web'); + $loader = new \Twig_Loader_Filesystem($ld_path); - $loader = new Twig_Loader_Filesystem($ld_path); - $twig = new Twig_Environment($loader); - - $twig->addExtension(new Twig_Extensions_Extension_I18n()); + $twig = new \Twig_Environment($loader); + $twig->addExtension(new \Twig_Extensions_Extension_I18n()); $request = $app['request']; $warnings = array(); + + $php_constraint = \setup::check_php_version(); + $writability_constraints = \setup::check_writability(new \Setup_Registry()); + $extension_constraints = \setup::check_php_extension(); + $opcode_constraints = \setup::check_cache_opcode(); + $php_conf_constraints = \setup::check_php_configuration(); + $locales_constraints = \setup::check_system_locales(); + + $constraints_coll = array( + 'php_constraint' => $php_constraint + , 'writability_constraints' => $writability_constraints + , 'extension_constraints' => $extension_constraints + , 'opcode_constraints' => $opcode_constraints + , 'php_conf_constraints' => $php_conf_constraints + , 'locales_constraints' => $locales_constraints + ); + + foreach ($constraints_coll as $key => $constraints) + { + $unset = true; + foreach ($constraints as $constraint) + { + if (!$constraint->is_ok() && !$constraint->is_blocker()) + { + $warnings[] = $constraint->get_message(); + } + } + } + if ($request->getScheme() == 'http') { $warnings[] = _('It is not recommended to install Phraseanet without HTTPS support'); } + $html = $twig->render( - '/setup/step2.twig' + '/setup/step2.html.twig' , array( - 'locale' => Session_Handler::get_locale() - , 'available_locales' => $app['available_languages'] - , 'available_templates' => appbox::list_databox_templates() - , 'version_number' => GV_version - , 'version_name' => GV_version_name + 'locale' => \Session_Handler::get_locale() + , 'available_locales' => $app['Core']::getAvailableLanguages() + , 'available_templates' => \appbox::list_databox_templates() + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() , 'warnings' => $warnings + , 'error' => $request->get('error') , 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/' - , 'discovered_binaries' => setup::discover_binaries() - , 'rootpath' => dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/' + , 'discovered_binaries' => \setup::discover_binaries() + , 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/' ) ); @@ -147,9 +160,14 @@ class Controller_Setup_Installer implements ControllerProviderInterface $controllers->post('/install/', function() use ($app) { set_time_limit(360); - phrasea::use_i18n(Session_Handler::get_locale()); + \phrasea::use_i18n(\Session_Handler::get_locale()); $request = $app['request']; + $servername = $request->getScheme() . '://' . $request->getHttpHost() . '/'; + + $setupRegistry = new \Setup_Registry(); + $setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING); + $conn = $connbas = null; $hostname = $request->get('ab_hostname'); @@ -162,9 +180,9 @@ class Controller_Setup_Installer implements ControllerProviderInterface try { - $conn = new connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name); + $conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry); } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/setup/installer/step2/?error=' . _('Appbox is unreachable')); } @@ -173,51 +191,84 @@ class Controller_Setup_Installer implements ControllerProviderInterface { if ($databox_name) { - $connbas = new connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name); + $connbas = new \connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name, array(), $setupRegistry); } } - catch (Exception $e) + catch (\Exception $e) { return $app->redirect('/setup/installer/step2/?error=' . _('Databox is unreachable')); } - setup::rollback($conn, $connbas); + + \setup::rollback($conn, $connbas); try { - $appbox = appbox::create(new Setup_Registry(), $conn, $appbox_name, true); + $setupRegistry = new \Setup_Registry(); + $setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING); + $appbox = \appbox::create($app['Core'], $setupRegistry, $conn, $appbox_name, true); - $registry = registry::get_instance(); - setup::create_global_values($registry); + $configuration = \Alchemy\Phrasea\Core\Configuration::build(); + + if ($configuration->isInstalled()) + { + $serviceName = $configuration->getOrm(); + $confService = $configuration->getService($serviceName); + + $ormService = \Alchemy\Phrasea\Core\Service\Builder::create( + $app['Core'] + , $confService + ); + + if ($ormService->getType() === 'doctrine') + { + /* @var $em \Doctrine\ORM\EntityManager */ + + $em = $ormService->getDriver(); + + $metadatas = $em->getMetadataFactory()->getAllMetadata(); + + if (!empty($metadatas)) + { + // Create SchemaTool + $tool = new \Doctrine\ORM\Tools\SchemaTool($em); + // Create schema + $tool->dropSchema($metadatas); + $tool->createSchema($metadatas); + } + } + } + + $registry = \registry::get_instance(); + \setup::create_global_values($registry); $appbox->set_registry($registry); - $registry->set('GV_base_datapath_noweb', p4string::addEndSlash($request->get('datapath_noweb'))); - $registry->set('GV_base_datapath_web', p4string::addEndSlash($request->get('datapath_web'))); - $registry->set('GV_base_dataurl', p4string::addEndSlash($request->get('mount_point_web'))); + $registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')), \registry::TYPE_STRING); + $registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')), \registry::TYPE_STRING); + $registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')), \registry::TYPE_STRING); + $registry->set('GV_ServerName', $servername, \registry::TYPE_STRING); + $registry->set('GV_cli', $request->get('binary_php'), \registry::TYPE_STRING); + $registry->set('GV_imagick', $request->get('binary_convert'), \registry::TYPE_STRING); + $registry->set('GV_pathcomposite', $request->get('binary_composite'), \registry::TYPE_STRING); + $registry->set('GV_exiftool', $request->get('binary_exiftool'), \registry::TYPE_STRING); + $registry->set('GV_swf_extract', $request->get('binary_swfextract'), \registry::TYPE_STRING); + $registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'), \registry::TYPE_STRING); + $registry->set('GV_swf_render', $request->get('binary_swfrender'), \registry::TYPE_STRING); + $registry->set('GV_unoconv', $request->get('binary_unoconv'), \registry::TYPE_STRING); + $registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'), \registry::TYPE_STRING); + $registry->set('GV_mp4box', $request->get('binary_MP4Box'), \registry::TYPE_STRING); + $registry->set('GV_mplayer', $request->get('binary_mplayer'), \registry::TYPE_STRING); + $registry->set('GV_pdftotext', $request->get('binary_xpdf'), \registry::TYPE_STRING); - $registry->set('GV_cli', $request->get('binary_php')); - $registry->set('GV_imagick', $request->get('binary_convert')); - $registry->set('GV_pathcomposite', $request->get('binary_composite')); - $registry->set('GV_exiftool', $request->get('binary_exiftool')); - $registry->set('GV_swf_extract', $request->get('binary_swfextract')); - $registry->set('GV_pdf2swf', $request->get('binary_pdf2swf')); - $registry->set('GV_swf_render', $request->get('binary_swfrender')); - $registry->set('GV_unoconv', $request->get('binary_unoconv')); - $registry->set('GV_ffmpeg', $request->get('binary_ffmpeg')); - $registry->set('GV_mp4box', $request->get('binary_MP4Box')); - $registry->set('GV_mplayer', $request->get('binary_mplayer')); - $registry->set('GV_pdftotext', $request->get('binary_xpdf')); + $user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true); - $user = User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true); - - if (!p4string::hasAccent($databox_name)) + if (!\p4string::hasAccent($databox_name)) { if ($databox_name) { - - $template = new system_file(dirname(__FILE__) . '/../../../conf.d/data_templates/' . $request->get('db_template') . '.xml'); - $databox = databox::create($appbox, $connbas, $template, $registry); + $template = new \system_file(__DIR__ . '/../../../../conf.d/data_templates/' . $request->get('db_template') . '.xml'); + $databox = \databox::create($appbox, $connbas, $template, $registry); $user->ACL() ->give_access_to_sbas(array($databox->get_sbas_id())) ->update_rights_to_sbas( @@ -227,7 +278,7 @@ class Controller_Setup_Installer implements ControllerProviderInterface ) ); - $a = collection::create($databox, $appbox, 'test', $user); + $a = \collection::create($databox, $appbox, 'test', $user); $user->ACL()->give_access_to_base(array($a->get_base_id())); $user->ACL()->update_rights_to_base($a->get_base_id(), array( @@ -272,7 +323,7 @@ class Controller_Setup_Installer implements ControllerProviderInterface $settings = null; } - task_abstract::create($appbox, $class_name, $settings); + \task_abstract::create($appbox, $class_name, $settings); break; default: break; @@ -281,20 +332,19 @@ class Controller_Setup_Installer implements ControllerProviderInterface } } - phrasea::start(); + \phrasea::start($app['Core']); - $auth = new Session_Authentication_None($user); + $auth = new \Session_Authentication_None($user); $appbox->get_session()->authenticate($auth); - $redirection = '/admin/index.php?section=taskmanager¬ice=install_success'; + $redirection = '/admin/?section=taskmanager¬ice=install_success'; return $app->redirect($redirection); } - catch (Exception $e) + catch (\Exception $e) { - setup::rollback($conn, $connbas); - exit($e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine()); + \setup::rollback($conn, $connbas); } return $app->redirect('/setup/installer/step2/?error=' . sprintf(_('an error occured : %s'), $e->getMessage())); diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php new file mode 100644 index 0000000000..2f019de2c5 --- /dev/null +++ b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php @@ -0,0 +1,91 @@ +get('/', function() use ($app) + { + require_once __DIR__ . '/../../../../bootstrap.php'; + $upgrade_status = \Setup_Upgrade::get_status(); + + /* @var $twig \Twig_Environment */ + $twig = $app['Core']->getTwig(); + + $html = $twig->render( + '/setup/upgrader.html.twig' + , array( + 'locale' => \Session_Handler::get_locale() + , 'upgrade_status' => $upgrade_status + , 'available_locales' => $app['Core']::getAvailableLanguages() + , 'bad_users' => \User_Adapter::get_wrong_email_users(\appbox::get_instance($app['Core'])) + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() + ) + ); + ini_set('display_errors', 'on'); + + return new Response($html); + }); + + $controllers->get('/status/', function() use ($app) + { + require_once __DIR__ . '/../../../../bootstrap.php'; + + $datas = \Setup_Upgrade::get_status(); + + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('Content-Type: application/json') + ); + }); + + $controllers->post('/execute/', function() use ($app) + { + require_once __DIR__ . '/../../../../bootstrap.php'; + set_time_limit(0); + session_write_close(); + ignore_user_abort(true); + + $appbox = \appbox::get_instance($app['Core']); + $upgrader = new \Setup_Upgrade($appbox); + $appbox->forceUpgrade($upgrader); + + return new \Symfony\Component\HttpFoundation\RedirectResponse('/'); + }); + + return $controllers; + } + +} diff --git a/lib/classes/Controller/Utils/ConnectionTest.class.php b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php similarity index 66% rename from lib/classes/Controller/Utils/ConnectionTest.class.php rename to lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php index 9707a09a70..27e52e3d40 100644 --- a/lib/classes/Controller/Utils/ConnectionTest.class.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Utils; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,7 +19,13 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -class Controller_Utils_ConnectionTest implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class ConnectionTest implements ControllerProviderInterface { public function connect(Application $app) @@ -32,7 +34,7 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface $controllers->get('/mysql/', function() use ($app) { - require_once dirname(__FILE__) . '/../../connection/pdo.class.php'; + require_once __DIR__ . '/../../../../classes/connection/pdo.class.php'; $request = $app['request']; $hostname = $request->get('hostname', '127.0.0.1'); @@ -45,10 +47,10 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface try { - $conn = new connection_pdo('test', $hostname, $port, $user, $password); + $conn = new \connection_pdo('test', $hostname, $port, $user, $password); $connection_ok = true; } - catch (Exception $e) + catch (\Exception $e) { } @@ -57,7 +59,7 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface { try { - $conn = new connection_pdo('test', $hostname, $port, $user, $password, $dbname); + $conn = new \connection_pdo('test', $hostname, $port, $user, $password, $dbname); $db_ok = true; $sql = "SHOW TABLE STATUS"; @@ -66,7 +68,7 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface $empty = $stmt->rowCount() === 0; - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -81,19 +83,27 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface } } } - catch (Exception $e) + catch (\Exception $e) { } } - return new Response(p4string::jsonencode(array( - 'connection' => $connection_ok - , 'database' => $db_ok - , 'is_empty' => $empty - , 'is_appbox' => $is_appbox - , 'is_databox' => $is_databox - )), 200, array('application/json')); + $Serializer = $app['Core']['Serializer']; + + $datas = array( + 'connection' => $connection_ok + , 'database' => $db_ok + , 'is_empty' => $empty + , 'is_appbox' => $is_appbox + , 'is_databox' => $is_databox + ); + + return new Response( + $Serializer->serialize($datas, 'json') + , 200 + , array('content-type' => 'application/json') + ); }); return $controllers; diff --git a/lib/classes/Controller/Utils/PathFileTest.class.php b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php similarity index 57% rename from lib/classes/Controller/Utils/PathFileTest.class.php rename to lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php index a36c345ce5..f0a5fd6896 100644 --- a/lib/classes/Controller/Utils/PathFileTest.class.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php @@ -9,12 +9,8 @@ * file that was distributed with this source code. */ -/** - * - * @package - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ +namespace Alchemy\Phrasea\Controller\Utils; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -23,7 +19,13 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; -class Controller_Utils_PathFileTest implements ControllerProviderInterface +/** + * + * @package + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link www.phraseanet.com + */ +class PathFileTest implements ControllerProviderInterface { public function connect(Application $app) @@ -34,23 +36,41 @@ class Controller_Utils_PathFileTest implements ControllerProviderInterface { $path = $app['request']->get('path'); - return new Response(p4string::jsonencode(array( + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize( + array( 'exists' => file_exists($path) , 'file' => is_file($path) , 'dir' => is_dir($path) , 'readable' => is_readable($path) , 'writeable' => is_writable($path) , 'executable' => is_executable($path) - )), 200, array('application/json')); + ) + , 'json' + ) + , 200 + , array('content-type' => 'application/json') + ); }); $controllers->get('/url/', function() use ($app) { $url = $app['request']->get('url'); - return new Response(p4string::jsonencode(array( - 'code' => http_query::getHttpCodeFromUrl($url) - )), 200, array('application/json')); + $Serializer = $app['Core']['Serializer']; + + return new Response( + $Serializer->serialize( + array( + 'code' => \http_query::getHttpCodeFromUrl($url) + ) + , 'json' + ) + , 200 + , array('content-type' => 'application/json') + ); }); diff --git a/lib/Alchemy/Phrasea/Core.php b/lib/Alchemy/Phrasea/Core.php new file mode 100644 index 0000000000..b0c0fe1372 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core.php @@ -0,0 +1,492 @@ + 'العربية' + , 'de_DE' => 'Deutsch' + , 'en_GB' => 'English' + , 'es_ES' => 'Español' + , 'fr_FR' => 'Français' + ); + + /** + * + * @var Core\Configuration + */ + private $configuration; + + public function __construct($environement = null) + { + $this->configuration = Core\Configuration::build(null, $environement); + + $core = $this; + + /** + * Cache Autoload if it's not debug mode + */ + static::initAutoloads($this->configuration->isInstalled() && !$this->configuration->isDebug()); + + $this->init(); + + /** + * Set version + */ + $this['Version'] = $this->share(function() + { + return new Core\Version(); + }); + + if ($this->configuration->isInstalled()) + { + $this['Registry'] = $this->share(function() use ($core) + { + return \registry::get_instance($core); + }); + + \phrasea::start($this); + } + else + { + + $this['Registry'] = $this->share(function() + { + return new \Setup_Registry(); + }); + } + + + $this['CacheService'] = $this->share(function() use ($core) + { + if (!file_exists(__DIR__ . '/../../../tmp/cache_registry.yml')) + { + touch(__DIR__ . '/../../../tmp/cache_registry.yml'); + } + + $file = new \SplFileObject(__DIR__ . '/../../../tmp/cache_registry.yml'); + + return new \Alchemy\Phrasea\Cache\Manager($core, $file); + }); + /** + * Set Entity Manager using configuration + */ + $this['EM'] = $this->share(function() use ($core) + { + $serviceName = $core->getConfiguration()->getOrm(); + $configuration = $core->getConfiguration()->getService($serviceName); + + $Service = Core\Service\Builder::create($core, $configuration); + + return $Service->getDriver(); + }); + + + $this['Cache'] = $this->share(function() use ($core) + { + $serviceName = $core->getConfiguration()->getCache(); + + return $core['CacheService']->get('MainCache', $serviceName)->getDriver(); + }); + + $this['OpcodeCache'] = $this->share(function() use ($core) + { + $serviceName = $core->getConfiguration()->getOpcodeCache(); + + return $core['CacheService']->get('OpcodeCache', $serviceName)->getDriver(); + }); + + + + $this["Twig"] = $this->share(function() use ($core) + { + $serviceName = $core->getConfiguration()->getTemplating(); + $configuration = $core->getConfiguration()->getService($serviceName); + + $Service = Core\Service\Builder::create($core, $configuration); + + return $Service->getDriver(); + }); + + + $this['Serializer'] = $this->share(function() + { + $encoders = array( + 'json' => new Serializer\Encoder\JsonEncoder() + ); + + return new Serializer\Serializer(array(), $encoders); + }); + + self::initPHPConf(); + + $this->initLoggers(); + + $this->verifyTimeZone(); + + $this->detectLanguage(); + + $this->enableLocales(); + + !defined('JETON_MAKE_SUBDEF') ? define('JETON_MAKE_SUBDEF', 0x01) : ''; + !defined('JETON_WRITE_META_DOC') ? define('JETON_WRITE_META_DOC', 0x02) : ''; + !defined('JETON_WRITE_META_SUBDEF') ? define('JETON_WRITE_META_SUBDEF', 0x04) : ''; + !defined('JETON_WRITE_META') ? define('JETON_WRITE_META', 0x06) : ''; + + return; + } + + /** + * Load Configuration + * + * @param type $environnement + */ + private function init() + { + if ($this->configuration->isInstalled()) + { + if ($this->configuration->isDisplayingErrors()) + { + ini_set('display_errors', 'on'); + error_reporting(E_ALL); + } + else + { + ini_set('display_errors', 'off'); + } + } + } + + /** + * Getter + * + * @return \Registry + */ + public function getRegistry() + { + return $this['Registry']; + } + + public function getCache() + { + return $this['Cache']; + } + + public function getOpcodeCache() + { + return $this['OpcodeCache']; + } + + /** + * Getter + * + * @return \Doctrine\ORM\EntityManager + */ + public function getEntityManager() + { + return $this['EM']; + } + + /** + * Getter + * + * @return \Twig_Environment + */ + public function getTwig() + { + return $this['Twig']; + } + + /** + * Getter + * + * @return Alchemy\Phrasea\Core\Version + */ + public function getVersion() + { + return $this['Version']; + } + + /** + * Getter + * + * @return \Symfony\Component\Serializer\Serializer + */ + public function getSerializer() + { + return $this['Serializer']; + } + + /** + * Tell if current seession is authenticated + * + * @return boolean + */ + public function isAuthenticated() + { + $session = \Session_Handler::getInstance(\appbox::get_instance($this)); + + return $session->is_authenticated(); + } + + /** + * Return the current authenticated phraseanet user + * + * @return \User_adapter + */ + public function getAuthenticatedUser() + { + $appbox = \appbox::get_instance($this); + $session = \Session_Handler::getInstance($appbox); + + if($session->get_usr_id()) + { + return \User_Adapter::getInstance($session->get_usr_id(), $appbox); + } + + return null; + } + + /** + * Getter + * + * @return \Alchemy\Phrasea\Core\Configuration + */ + public function getConfiguration() + { + return $this->configuration; + } + + /** + * Set Default application Timezone + */ + protected function verifyTimezone() + { + if ($this->getRegistry()->is_set('GV_timezone')) + date_default_timezone_set($this->getRegistry()->get('GV_timezone')); + else + date_default_timezone_set('Europe/Berlin'); + + return; + } + + protected $request; + + protected function getRequest() + { + if (!$this->request) + $this->request = Request::createFromGlobals(); + + return $this->request; + } + + protected function enableLocales() + { + mb_internal_encoding("UTF-8"); + \phrasea::use_i18n($this->getRequest()->getLocale()); + + return; + } + + public function getLocale() + { + return $this->getRequest()->getLocale(); + } + + public function enableEvents() + { + $events = \eventsmanager_broker::getInstance(\appbox::get_instance($this), $this); + $events->start(); + + return; + } + + /** + * Initialiaze phraseanet log process + * + * @return Core + */ + protected function initLoggers() + { + $php_log = $this->getRegistry()->get('GV_RootPath') . 'logs/php_error.log'; + + ini_set('error_log', $php_log); + + if ($this->getRegistry()->get('GV_log_errors')) + { + ini_set('log_errors', 'on'); + } + else + { + ini_set('log_errors', 'off'); + } + + return $this; + } + + /** + * Return available language for phraseanet + * + * @return Array + */ + public static function getAvailableLanguages() + { + return static::$availableLanguages; + } + + /** + * Set Language + * + */ + protected function detectLanguage() + { + $this->getRequest()->setDefaultLocale( + $this->getRegistry()->get('GV_default_lng', 'en_GB') + ); + + $cookies = $this->getRequest()->cookies; + + if (isset(static::$availableLanguages[$cookies->get('locale')])) + { + $this->getRequest()->setLocale($cookies->get('locale')); + } + + \Session_Handler::set_locale($this->getRequest()->getLocale()); + + return; + } + + /** + * Register directory and namespaces for autoloading app classes + * + */ + public static function initAutoloads($cacheAutoload = false) + { + require_once __DIR__ . '/Loader/Autoloader.php'; + + if ($cacheAutoload === true) + { + try + { + require_once __DIR__ . '/Loader/CacheAutoloader.php'; + + $prefix = 'class_'; + $namespace = md5(__DIR__); + + $loader = new Loader\CacheAutoloader($prefix, $namespace); + } + catch (\Exception $e) + { + //no op code cache available + $loader = new Loader\Autoloader(); + } + } + else + { + $loader = new Loader\Autoloader(); + } + + //Register prefixes + $loader->registerPrefixes(array( + 'Twig' => realpath(__DIR__ . '/../../vendor/Twig/lib')) + ); + + $loader->registerPrefixes(array( + 'Twig_Extensions' => realpath(__DIR__ . '/../../vendor/Twig-extensions/lib')) + ); + //Register namespaces + $loader->registerNamespaces(array( + 'Alchemy' => realpath(__DIR__ . '/../..'), + 'Symfony' => realpath(__DIR__ . '/../../vendor/symfony/src'), + 'Doctrine\\ORM' => realpath(__DIR__ . '/../../vendor/doctrine2-orm/lib'), + 'Doctrine\\DBAL' => realpath(__DIR__ . '/../../vendor/doctrine2-orm/lib/vendor/doctrine-dbal/lib'), + 'Doctrine\\Common' => realpath(__DIR__ . '/../../vendor/doctrine2-orm/lib/vendor/doctrine-common/lib'), + 'Doctrine\\Common\\DataFixtures' => realpath(__DIR__ . '/../../vendor/data-fixtures/lib'), + 'Entities' => realpath(__DIR__ . '/../../Doctrine/'), + 'Repositories' => realpath(__DIR__ . '/../../Doctrine/'), + 'Proxies' => realpath(__DIR__ . '/../../Doctrine/'), + 'Doctrine\\Logger' => realpath(__DIR__ . '/../../'), + 'Monolog' => realpath(__DIR__ . '/../../vendor/Silex/vendor/monolog/src'), + 'Gedmo' => realpath(__DIR__ . '/../../vendor/doctrine2-gedmo/lib'), + 'Events' => realpath(__DIR__ . '/../../Doctrine'), + 'DoctrineExtensions' => realpath(__DIR__ . "/../../vendor/doctrine2-beberlei/lib"), + 'Types' => realpath(__DIR__ . "/../../Doctrine"), + 'PhraseaFixture' => realpath(__DIR__ . "/../../conf.d"), + )); + + $loader->register(); + + require_once __DIR__ . '/../../vendor/Silex/autoload.php'; + + return; + } + + /** + * Initialize some PHP configuration variables + * + */ + public static function initPHPConf() + { + ini_set('output_buffering', '4096'); + if ((int) ini_get('memory_limit') < 2048) + { + ini_set('memory_limit', '2048M'); + } + ini_set('error_reporting', '6143'); + ini_set('default_charset', 'UTF-8'); + ini_set('session.use_cookies', '1'); + ini_set('session.use_only_cookies', '1'); + ini_set('session.auto_start', '0'); + ini_set('session.hash_function', '1'); + ini_set('session.hash_bits_per_character', '6'); + ini_set('allow_url_fopen', 'on'); + + return; + } + + /** + * Return the current working environnement (test, dev, prod etc ...) + * + * @return string + */ + public function getEnv() + { + return $this->configuration->getEnvironnement(); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration.php new file mode 100644 index 0000000000..a618ac80fc --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Configuration.php @@ -0,0 +1,403 @@ +specifications = $specifications; + + if ($specifications->isSetup()) + { + $configurations = $this->specifications->getConfigurations(); + $environment = $environment ? : $configurations[self::KEYWORD_ENV]; + } + else + { + $environment = null; + } + + $this->setEnvironnement($environment); + + return $this; + } + + public function upgradeFromOldConf(\SplFileObject $configInc, \SplFileObject $connexionInc) + { + $this->initialize(); + + $cacheService = "array_cache"; + + $retrieve_old_credentials = function(\SplFileObject $connexionInc) + { + require $connexionInc->getPathname(); + + return array( + 'hostname' => $hostname, + 'port' => $port, + 'user' => $user, + 'password' => $password, + 'dbname' => $dbname, + ); + }; + + $credentials = $retrieve_old_credentials($connexionInc); + + $connexions = $this->getConnexions(); + + foreach ($credentials as $key => $value) + { + $key = $key == 'hostname' ? 'host' : $key; + $connexions['main_connexion'][$key] = (string) $value; + } + + $this->setConnexions($connexions); + + + $configs = $this->getConfigurations(); + + $retrieve_old_parameters = function(\SplFileObject $configInc) + { + require $configInc->getPathname(); + + return array( + 'servername' => $servername + ); + }; + + $old_parameters = $retrieve_old_parameters($configInc); + + foreach ($configs as $env => $conf) + { + if (!is_array($configs[$env]) || !array_key_exists('phraseanet', $configs[$env])) + { + continue; + } + + $configs[$env]['phraseanet']['servername'] = $old_parameters['servername']; + + if ($env === 'prod' && isset($configs[$env]['cache'])) + { + $configs[$env]["cache"] = $cacheService; + } + if ($env === 'prod' && isset($configs[$env]['opcodecache'])) + { + $configs[$env]["opcodecache"] = $cacheService; + } + } + $this->setConfigurations($configs); + + $services = $this->getServices(); + + if (isset($services['Orm']["doctrine_prod"]["options"]["cache"])) + { + $services['Orm']["doctrine_prod"]["options"]["cache"]['query']['service'] = $cacheService; + $services['Orm']["doctrine_prod"]["options"]["cache"]['result']['service'] = $cacheService; + $services['Orm']["doctrine_prod"]["options"]["cache"]['metadata']['service'] = $cacheService; + } + + $this->setServices($services); + + $this->setEnvironnement('prod'); + + return $this; + } + + /** + * Return the current used environnement + * + * @return string + */ + public function getEnvironnement() + { + + return $this->environment; + } + + /** + * Return the current used environnement + * + * @return string + */ + public function setEnvironnement($environment) + { + $this->environment = $environment; + + if ($this->specifications->isSetup()) + { + $configurations = $this->specifications->getConfigurations(); + + if (!isset($configurations[$this->environment])) + { + throw new \Exception('Requested environnment is not available'); + } + + $this->configuration = new ParameterBag($configurations[$this->environment]); + } + else + { + $this->configuration = new ParameterBag(array()); + } + + return $this; + } + + /** + * Check if current environnement is on debug mode + * Default to false + * @return boolean + */ + public function isDebug() + { + $phraseanet = $this->getPhraseanet(); + + try + { + $debug = !!$phraseanet->get('debug'); + } + catch (\Exception $e) + { + $debug = false; + } + + return $debug; + } + + /** + * Check if phrasea is currently maintained + * Default to false + * @return boolean + */ + public function isMaintained() + { + $phraseanet = $this->getPhraseanet(); + + try + { + $maintained = !!$phraseanet->get('maintenance'); + } + catch (\Exception $e) + { + $maintained = false; + } + + return $maintained; + } + + /** + * Check if current environnement should display errors + * Default to false + * @return boolean + */ + public function isDisplayingErrors() + { + $phraseanet = $this->getPhraseanet(); + + try + { + $displayErrors = !!$phraseanet->get('display_errors'); + } + catch (\Exception $e) + { + $displayErrors = false; + } + + return $displayErrors; + } + + /** + * Return the phraseanet scope configurations values + * + * @return ParameterBag + */ + public function getPhraseanet() + { + $phraseanetConf = $this->configuration->get('phraseanet'); + + return new ParameterBag($phraseanetConf); + } + + /** + * Tell if the application is installed + * + * @return boolean + */ + public function isInstalled() + { + return $this->specifications->isSetup(); + } + + public function initialize() + { + return $this->specifications->initialize(); + } + + public function setConfigurations($configurations) + { + return $this->specifications->setConfigurations($configurations); + } + + public function setServices($services) + { + return $this->specifications->setServices($services); + } + + public function setConnexions($connexions) + { + return $this->specifications->setConnexions($connexions); + } + + public function getConfigurations() + { + return $this->specifications->getConfigurations(); + } + + public function getServices() + { + return $this->specifications->getServices(); + } + + public function getConnexions() + { + return $this->specifications->getConnexions(); + } + + const KEYWORD_ENV = 'environment'; + + public function getSelectedEnvironnment() + { + return $this->selectedEnvironnment; + } + + /** + * Return the connexion parameters as configuration parameter object + * + * @return ParameterBag + */ + public function getConnexion($name = 'main_connexion') + { + $connexions = $this->getConnexions(); + + if (!isset($connexions[$name])) + { + throw new \Exception(sprintf('Unknown connexion name %s', $name)); + } + + return new Parameterbag($connexions[$name]); + } + + /** + * Return configuration service for template_engine + * @return string + */ + public function getTemplating() + { + return 'TemplateEngine\\' . $this->configuration->get('template_engine'); + } + + public function getCache() + { + return 'Cache\\' . $this->configuration->get('cache'); + } + + public function getOpcodeCache() + { + return 'Cache\\' . $this->configuration->get('opcodecache'); + } + + /** + * Return configuration service for orm + * @return string + */ + public function getOrm() + { + return 'Orm\\' . $this->configuration->get('orm'); + } + + /** + * Return the selected service configuration + * + * @param type $name + * @return ParameterBag + */ + public function getService($name) + { + $scopes = explode('\\', $name); + $services = new ParameterBag($this->getServices()); + $service = null; + + while ($scopes) + { + $scope = array_shift($scopes); + + try + { + $service = new ParameterBag($services->get($scope)); + $services = $service; + } + catch (\Exception $e) + { + throw new \Exception(sprintf('Unknow service name %s', $name)); + } + } + + return $service; + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Configuration/ApplicationSpecification.php b/lib/Alchemy/Phrasea/Core/Configuration/ApplicationSpecification.php new file mode 100644 index 0000000000..61ca31c428 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Configuration/ApplicationSpecification.php @@ -0,0 +1,168 @@ +parser = new \Symfony\Component\Yaml\Yaml(); + } + + public function setConfigurations($configurations) + { + return file_put_contents( + $this->getConfigurationsPathFile(), $this->parser->dump($configurations, 7) + ); + } + + public function setConnexions($connexions) + { + return file_put_contents( + $this->getConnexionsPathFile(), $this->parser->dump($connexions, 7) + ); + } + + public function setServices($services) + { + return file_put_contents( + $this->getServicesPathFile(), $this->parser->dump($services, 7) + ); + } + + public function getConfigurations() + { + return $this->parser->parse( + file_get_contents($this->getConfigurationsPathFile()) + ); + } + + public function getConnexions() + { + return $this->parser->parse( + file_get_contents($this->getConnexionsPathFile()) + ); + } + + public function getServices() + { + return $this->parser->parse( + file_get_contents($this->getServicesPathFile()) + ); + } + + protected function getConfigurationsFile() + { + return new \SplFileObject($this->getConfigurationsPathFile()); + } + + protected function getConnexionsFile() + { + return new \SplFileObject($this->getConnexionsPathFile()); + } + + protected function getServicesFile() + { + return new \SplFileObject($this->getServicesPathFile()); + } + + public function delete() + { + $files = array( + $this->getConnexionsPathFile(), + $this->getConfigurationsPathFile(), + $this->getServicesPathFile() + ); + + foreach ($files as $file) + { + if (file_exists($file)) + unlink($file); + } + } + + public function initialize() + { + $this->delete(); + + copy( + $this->getRealRootPath() . "/config/connexions.sample.yml" + , $this->getConnexionsPathFile() + ); + + copy( + $this->getRealRootPath() . "/config/services.sample.yml" + , $this->getServicesPathFile() + ); + + copy( + $this->getRealRootPath() . "/config/config.sample.yml" + , $this->getConfigurationsPathFile() + ); + + if (function_exists('chmod')) + { + chmod($this->getConnexionsPathFile(), 0700); + chmod($this->getConfigurationsPathFile(), 0700); + chmod($this->getServicesPathFile(), 0700); + } + } + + public function isSetup() + { + try + { + $this->getConfigurationsFile(); + $this->getConnexionsFile(); + $this->getServicesFile(); + + return true; + } + catch (\Exception $e) + { + + } + + return false; + } + + protected function getConfigurationsPathFile() + { + return $this->getRealRootPath() . '/config/config.yml'; + } + + protected function getConnexionsPathFile() + { + return $this->getRealRootPath() . '/config/connexions.yml'; + } + + protected function getServicesPathFile() + { + return $this->getRealRootPath() . '/config/services.yml'; + } + + protected function getRealRootPath() + { + return realpath(__DIR__ . '/../../../../../'); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Configuration/Specification.php b/lib/Alchemy/Phrasea/Core/Configuration/Specification.php new file mode 100644 index 0000000000..31abc9de5d --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Configuration/Specification.php @@ -0,0 +1,42 @@ +get("type"); + + if (!class_exists($classname)) + { + throw new Exception\ServiceNotFound(sprintf('Service %s not found', $classname)); + } + + try + { + $options = $configuration->get("options"); + } + catch (\Exception $e) + { + $options = array(); + } + + return new $classname($core, $options); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php new file mode 100644 index 0000000000..26207697da --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php @@ -0,0 +1,55 @@ +cache) + { + $this->cache = new CacheDriver\ApcCache(); + + $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); + } + + return $this->cache; + } + + public function getType() + { + return 'apc'; + } + + +} + diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php new file mode 100644 index 0000000000..cae2c51c80 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php @@ -0,0 +1,50 @@ +cache) + { + $this->cache = new CacheDriver\ArrayCache(); + + $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); + } + + return $this->cache; + } + + public function getType() + { + return 'array'; + } + +} + diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php new file mode 100644 index 0000000000..1eab95aaea --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php @@ -0,0 +1,94 @@ +getOptions(); + + $this->host = isset($options["host"]) ? $options["host"] : self::DEFAULT_HOST; + + $this->port = isset($options["port"]) ? $options["port"] : self::DEFAULT_PORT; + } + + public function getDriver() + { + if (!extension_loaded('memcache')) + { + throw new \Exception('The Memcache cache requires the Memcache extension.'); + } + + if (!$this->cache) + { + $memcache = new \Memcache(); + + $memcache->addServer($this->host, $this->port); + + $key = sprintf("%s:%s", $this->host, $this->port); + + $stats = @$memcache->getExtendedStats(); + + if (isset($stats[$key])) + { + $this->cache = new CacheDriver\MemcacheCache(); + $this->cache->setMemcache($memcache); + + $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); + } + else + { + throw new \Exception(sprintf("Memcache instance with host '%s' and port '%s' is not reachable", $this->host, $this->port)); + } + } + + return $this->cache; + } + + public function getType() + { + return 'memcache'; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + +} + diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php new file mode 100644 index 0000000000..934efd25e9 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php @@ -0,0 +1,98 @@ +getOptions(); + + $this->host = isset($options["host"]) ? $options["host"] : self::DEFAULT_HOST; + + $this->port = isset($options["port"]) ? $options["port"] : self::DEFAULT_PORT; + } + + /** + * + * @return Cache\ApcCache + */ + public function getDriver() + { + if (!extension_loaded('redis')) + { + throw new \Exception('The Redis cache requires the Redis extension.'); + } + + + if (!$this->cache) + { + $redis = new \Redis(); + + if (!$redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_IGBINARY)) + { + $redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP); + } + + if ($redis->connect($this->host, $this->port)) + { + $this->cache = new CacheDriver\RedisCache(); + $this->cache->setRedis($redis); + $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); + } + else + { + throw new \Exception(sprintf("Redis instance with host '%s' and port '%s' is not reachable", $this->host, $this->port)); + } + + } + + return $this->cache; + } + + public function getType() + { + return 'redis'; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + +} + diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php new file mode 100644 index 0000000000..72e5ef85e1 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php @@ -0,0 +1,53 @@ +cache) + { + $this->cache = new CacheDriver\XcacheCache(); + + $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); + } + + return $this->cache; + } + + public function getType() + { + return 'xcache'; + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/Exception/MissingParameters.php b/lib/Alchemy/Phrasea/Core/Service/Exception/MissingParameters.php new file mode 100644 index 0000000000..7e90407162 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Exception/MissingParameters.php @@ -0,0 +1,22 @@ +options["output"]) ? $this->options["output"] : self::JSON_OUTPUT; + + $outputs = array( + self::JSON_OUTPUT, self::YAML_OUTPUT, self::VAR_DUMP_OUTPUT + ); + + if (!in_array($output, $outputs)) + { + throw new \Exception(sprintf( + "The output type '%s' declared in %s service is not valid. + Available types are %s." + , $output + , __CLASS__ + , implode(", ", $outputs) + ) + ); + } + + return new MonologSQLLogger($this->monolog, $output); + } + + public function getType() + { + return 'doctrine_monolog'; + } + + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/Doctrine/Phpecho.php b/lib/Alchemy/Phrasea/Core/Service/Log/Doctrine/Phpecho.php new file mode 100644 index 0000000000..4432bbe51c --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Log/Doctrine/Phpecho.php @@ -0,0 +1,39 @@ +logger) + { + $this->logger = new Logger('FirePHP'); + + $this->logger->pushHandler(new FirePHPHandler()); + } + + return $this->logger; + } + + public function getType() + { + return 'FirePHP Monolog'; + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php new file mode 100644 index 0000000000..db47305387 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php @@ -0,0 +1,136 @@ + 'RotatingFile' + , 'stream' => 'Stream' + ); + + /** + * + * @var \Monolog\Logger + */ + protected $monolog; + + protected function init() + { + $options = $this->getOptions(); + + if (empty($options)) + { + throw new \Exception(sprintf("'%s' service options can not be empty", $this->name)); + } + + //defaut to main handler + $handler = isset($options["handler"]) ? $options["handler"] : false; + + if (!$handler) + { + throw new \Exception(sprintf( + "You must specify at least one handler for '%s' service" + , __CLASS__ + ) + ); + } + + if (!array_key_exists($handler, $this->handlers)) + { + throw new \Exception(sprintf( + "The handler type '%s' declared in %s %s service is not valid. + Available types are %s." + , $handler + , __CLASS__ + , implode(", ", $this->handlers) + ) + ); + } + + $handlerName = $this->handlers[$handler]; + + $handlerClassName = sprintf('\Monolog\Handler\%sHandler', $handlerName); + + if (!class_exists($handlerClassName)) + { + throw new \Exception(sprintf( + 'Unable to log monolog handler ùs looked for class %s' + , $handlerName + , $handlerClassName) + ); + } + + if (!isset($options["filename"])) + { + throw new \Exception(sprintf( + "Missing filename option in '%s' service" + , __CLASS__ + ) + ); + } + + $logPath = __DIR__ . '/../../../../../../logs'; + + $file = sprintf('%s/%s', $logPath, $options["filename"]); + + if ($handler == 'rotate') + { + $maxDay = isset($options["max_day"]) ? + (int) $options["max_day"] : + self::DEFAULT_MAX_DAY; + + $handlerInstance = new $handlerClassName($file, $maxDay); + } + else + { + $handlerInstance = new $handlerClassName($file); + } + + $channel = isset($options["channel"]) ? $options["channel"] : "monolog"; + + $monologLogger = new \Monolog\Logger($channel); + + $monologLogger->pushHandler($handlerInstance); + + $this->monolog = $monologLogger; + } + + public function getDriver() + { + return $this->monolog; + } + + public function getType() + { + return 'monolog'; + } + + public function getMandatoryOptions() + { + return array('channel', 'handler', 'filename'); + } +} + diff --git a/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php new file mode 100644 index 0000000000..f4aafbdc73 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php @@ -0,0 +1,234 @@ +getOptions(); + + $config = new \Doctrine\ORM\Configuration(); + + $this->debug = !!$options["debug"]; + + $logServiceName = isset($options["log"]['service']) ? $options["log"]['service'] : false; + + if ($logServiceName) + { + $config->setSQLLogger($this->getLog($logServiceName)); + } + + $cache = isset($options["cache"]) ? $options["cache"] : false; + + if (!$cache || $this->debug) + { + $metaCache = $this->core['CacheService']->get('ORMmetadata', 'Cache\\ArrayCache'); + $queryCache = $this->core['CacheService']->get('ORMquery', 'Cache\\ArrayCache'); + } + else + { + $query = isset($cache["query"]['service']) ? $cache["query"]['service'] : 'Cache\\ArrayCache'; + $meta = isset($cache["metadata"]['service']) ? $cache["metadata"]['service'] : 'Cache\\ArrayCache'; + + $queryCache = $this->core['CacheService']->get('ORMquery', $query); + $metaCache = $this->core['CacheService']->get('ORMmetadata', $meta); + } + + $resultCache = $this->core['CacheService']->get('ORMresult', 'Cache\\ArrayCache'); + + $config->setMetadataCacheImpl($metaCache->getDriver()); + + $config->setQueryCacheImpl($queryCache->getDriver()); + + $config->setResultCacheImpl($resultCache->getDriver()); + + //define autoregeneration of proxies base on debug mode + $config->setAutoGenerateProxyClasses($this->debug); + + $chainDriverImpl = new \Doctrine\ORM\Mapping\Driver\DriverChain(); + + $driverYaml = new \Doctrine\ORM\Mapping\Driver\YamlDriver( + array(__DIR__ . '/../../../../../conf.d/Doctrine') + ); + + $chainDriverImpl->addDriver($driverYaml, 'Entities'); + + $chainDriverImpl->addDriver($driverYaml, 'Gedmo\Timestampable'); + + $config->setMetadataDriverImpl($chainDriverImpl); + + $config->setProxyDir(realpath(__DIR__ . '/../../../../../Doctrine/Proxies')); + + $config->setProxyNamespace('Proxies'); + + $connexion = isset($options["dbal"]) ? $options["dbal"] : false; + + if (!$connexion) + { + throw new \Exception(sprintf( + "Missing dbal configuration for '%s' service" + , __CLASS__ + ) + ); + } + + try + { + $dbalConf = $this->core->getConfiguration()->getConnexion($connexion)->all(); + } + catch (\Exception $e) + { + throw new \Exception("Connexion '%s' is not declared"); + } + + $evm = new \Doctrine\Common\EventManager(); + + $evm->addEventSubscriber(new \Gedmo\Timestampable\TimestampableListener()); + + try + { + $this->entityManager = \Doctrine\ORM\EntityManager::create($dbalConf, $config, $evm); + } + catch (\Exception $e) + { + throw new \Exception(sprintf( + "Failed to create doctrine service for the following reason '%s'" + , $e->getMessage() + ) + ); + } + + $this->addTypes(); + + return $this; + } + + protected function addTypes() + { + + $platform = $this->entityManager->getConnection()->getDatabasePlatform(); + + if (!Type::hasType('blob')) + { + Type::addType('blob', 'Types\Blob'); + } + + if (!Type::hasType('enum')) + { + Type::addType('enum', 'Types\Enum'); + } + + if (!Type::hasType('longblob')) + { + Type::addType('longblob', 'Types\LongBlob'); + } + + if (!Type::hasType('varbinary')) + { + Type::addType('varbinary', 'Types\VarBinary'); + } + + if (!Type::hasType('binary')) + { + Type::addType('binary', 'Types\Binary'); + } + + $platform->registerDoctrineTypeMapping('enum', 'enum'); + $platform->registerDoctrineTypeMapping('blob', 'blob'); + $platform->registerDoctrineTypeMapping('longblob', 'longblob'); + $platform->registerDoctrineTypeMapping('varbinary', 'varbinary'); + $platform->registerDoctrineTypeMapping('binary', 'binary'); + + return; + } + + private function getLog($serviceName) + { + try + { + $configuration = $this->core->getConfiguration()->getService($serviceName); + } + catch (\Exception $e) + { + $message = sprintf( + "%s from %s service" + , $e->getMessage() + , __CLASS__ + ); + + $e = new \Exception($message); + + throw $e; + } + + $type = $configuration->get("type"); + + if (!in_array($type, $this->loggers)) + { + throw new \Exception(sprintf( + "The logger type '%s' declared in %s service is not valid. + Available types are %s." + , $type + , __CLASS__ + , implode(", ", $this->loggers) + ) + ); + } + + $service = Core\Service\Builder::create($this->core, $configuration); + + return $service->getDriver(); + } + + public function getDriver() + { + return $this->entityManager; + } + + public function getType() + { + return 'doctrine'; + } + + public function isDebug() + { + return $this->debug; + } + + public function getMandatoryOptions() + { + return array('debug', 'dbal'); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/ServiceAbstract.php b/lib/Alchemy/Phrasea/Core/Service/ServiceAbstract.php new file mode 100644 index 0000000000..954dc4cc17 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/ServiceAbstract.php @@ -0,0 +1,77 @@ +core = $core; + $this->options = $options; + + $mandatory = $this->getMandatoryOptions(); + + if ($mandatory !== array_intersect($mandatory, array_keys($options))) + { + throw new Exception\MissingParameters( + sprintf( + 'Missing parameters %s' + , implode(', ', array_diff($mandatory, array_keys($options))) + ) + ); + } + + $this->init(); + } + + protected function init() + { + return; + } + + protected function getCore() + { + return $this->core; + } + + /** + * + * @return Array + */ + public function getOptions() + { + return $this->options; + } + + /** + * + * @return Array + */ + public function getMandatoryOptions() + { + return array(); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php b/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php new file mode 100644 index 0000000000..50ac477436 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php @@ -0,0 +1,31 @@ +templatesPath = $this->resolvePaths(); + + try + { + if (!$this->options['debug']) + { + $this->options['cache'] = realpath(__DIR__ . '/../../../../../../tmp/cache_twig/'); + } + + $loader = new \Twig_Loader_Filesystem($this->templatesPath); + $this->twig = new \Twig_Environment($loader, $this->options); + $this->loadGlobals(); + $this->loadExtensions(); + $this->loadTests(); + $this->loadFilters(); + } + catch (\Exception $e) + { + throw new \Exception(sprintf( + "Unable to create '%s' service for the following reason %s" + , __CLASS__ + , $e->getMessage() + ) + ); + } + } + + /** + * Load phraseanet global variable + * it' s like any other template variable, + * except that it’s available in all templates and macros + * @return void + */ + private function loadGlobals() + { + $appbox = \appbox::get_instance($this->core); + $session = $appbox->get_session(); + $browser = \Browser::getInstance(); + $registry = $appbox->get_registry(); + $request = new \http_request(); + + $user = false; + if ($session->is_authenticated()) + { + $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + } + + $core = \bootstrap::execute(); + $eventsmanager = \eventsmanager_broker::getInstance($appbox, $core); + + $this->twig->addGlobal('session', $session); + $this->twig->addGlobal('version_number', $core->getVersion()->getNumber()); + $this->twig->addGlobal('version_name', $core->getVersion()->getName()); + $this->twig->addGlobal('core', $core); + $this->twig->addGlobal('browser', $browser); + $this->twig->addGlobal('request', $request); + $this->twig->addGlobal('events', $eventsmanager); + $this->twig->addGlobal('display_chrome_frame', $registry->is_set('GV_display_gcf') ? $registry->get('GV_display_gcf') : true); + $this->twig->addGlobal('user', $user); + $this->twig->addGlobal('current_date', new \DateTime()); + $this->twig->addGlobal('home_title', $registry->get('GV_homeTitle')); + $this->twig->addGlobal('meta_description', $registry->get('GV_metaDescription')); + $this->twig->addGlobal('meta_keywords', $registry->get('GV_metaKeywords')); + $this->twig->addGlobal('maintenance', $registry->get('GV_maintenance')); + $this->twig->addGlobal('registry', $registry); + } + + /** + * Load twig extensions + * @return void + */ + private function loadExtensions() + { + $this->twig->addExtension(new \Twig_Extension_Core()); + $this->twig->addExtension(new \Twig_Extension_Optimizer()); + $this->twig->addExtension(new \Twig_Extension_Escaper()); + $this->twig->addExtension(new \Twig_Extensions_Extension_Debug()); + // add filter trans + $this->twig->addExtension(new \Twig_Extensions_Extension_I18n()); + // add filter localizeddate + $this->twig->addExtension(new \Twig_Extensions_Extension_Intl()); + // add filters truncate, wordwrap, nl2br + $this->twig->addExtension(new \Twig_Extensions_Extension_Text()); + } + + private function loadTests() + { + $this->twig->addTest('null', new \Twig_Test_Function('is_null')); + } + + /** + * Load twig filters + * return void + */ + private function loadFilters() + { + $this->twig->addFilter('serialize', new \Twig_Filter_Function('serialize')); + $this->twig->addFilter('sbas_names', new \Twig_Filter_Function('phrasea::sbas_names')); + $this->twig->addFilter('sbas_name', new \Twig_Filter_Function('phrasea::sbas_names')); + $this->twig->addFilter('unite', new \Twig_Filter_Function('p4string::format_octets')); + $this->twig->addFilter('stristr', new \Twig_Filter_Function('stristr')); + $this->twig->addFilter('implode', new \Twig_Filter_Function('implode')); + $this->twig->addFilter('get_class', new \Twig_Filter_Function('get_class')); + $this->twig->addFilter('stripdoublequotes', new \Twig_Filter_Function('stripdoublequotes')); + $this->twig->addFilter('phraseadate', new \Twig_Filter_Function('phraseadate::getPrettyString')); + $this->twig->addFilter('format_octets', new \Twig_Filter_Function('p4string::format_octets')); + $this->twig->addFilter('geoname_display', new \Twig_Filter_Function('geonames::name_from_id')); + $this->twig->addFilter('get_collection_logo', new \Twig_Filter_Function('collection::getLogo')); + $this->twig->addFilter('nl2br', new \Twig_Filter_Function('nl2br')); + $this->twig->addFilter('floor', new \Twig_Filter_Function('floor')); + $this->twig->addFilter('bas_name', new \Twig_Filter_Function('phrasea::bas_names')); + $this->twig->addFilter('bas_names', new \Twig_Filter_Function('phrasea::bas_names')); + $this->twig->addFilter('basnames', new \Twig_Filter_Function('phrasea::bas_names')); + $this->twig->addFilter('urlencode', new \Twig_Filter_Function('urlencode')); + $this->twig->addFilter('sbasFromBas', new \Twig_Filter_Function('phrasea::sbasFromBas')); + $this->twig->addFilter('str_replace', new \Twig_Filter_Function('str_replace')); + $this->twig->addFilter('strval', new \Twig_Filter_Function('strval')); + $this->twig->addFilter('key_exists', new \Twig_Filter_Function('array_key_exists')); + $this->twig->addFilter('array_keys', new \Twig_Filter_Function('array_keys')); + $this->twig->addFilter('round', new \Twig_Filter_Function('round')); + $this->twig->addFilter('dump', new \Twig_Filter_Function('var_dump')); + $this->twig->addFilter('formatdate', new \Twig_Filter_Function('phraseadate::getDate')); + $this->twig->addFilter('getPrettyDate', new \Twig_Filter_Function('phraseadate::getPrettyString')); + $this->twig->addFilter('prettyDate', new \Twig_Filter_Function('phraseadate::getPrettyString')); + $this->twig->addFilter('prettyString', new \Twig_Filter_Function('phraseadate::getPrettyString')); + $this->twig->addFilter('formatoctet', new \Twig_Filter_Function('p4string::format_octets')); + $this->twig->addFilter('getDate', new \Twig_Filter_Function('phraseadate::getDate')); + $this->twig->addFilter('geoname_name_from_id', new \Twig_Filter_Function('geonames::name_from_id')); + } + + private function getDefaultTemplatePath() + { + return array( + 'mobile' => array( + __DIR__ . '/../../../../../../config/templates/mobile', + __DIR__ . '/../../../../../../templates/mobile' + ), + 'web' => array( + __DIR__ . '/../../../../../../config/templates/web', + __DIR__ . '/../../../../../../templates/web' + ) + ); + } + + /** + * Set default templates Path + * According to the client device + * @return void + */ + private function resolvePaths() + { + $browser = \Browser::getInstance(); + + $templatePath = $this->getDefaultTemplatePath(); + + if ($browser->isTablet() || $browser->isMobile()) + { + $paths = $templatePath['mobile']; + } + else + { + $paths = $templatePath['web']; + } + + return $paths; + } + + public function getDriver() + { + return $this->twig; + } + + public function getType() + { + return 'twig'; + } + + public function getMandatoryOptions() + { + return array('debug', 'charset', 'strict_variables', 'autoescape', 'optimizer'); + } + +} diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php new file mode 100644 index 0000000000..3b3c86a887 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -0,0 +1,36 @@ +core = $core; + $this->request = $Request; + + return $this; + } + + /** + * + * @return \Alchemy\Phrasea\Core + */ + public function getCore() + { + return $this->core; + } + + /** + * + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request; + } + +} diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php new file mode 100644 index 0000000000..be3cf5fce3 --- /dev/null +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -0,0 +1,119 @@ + array(), + 'dates' => array(), + 'fields' => array() + ); + + $bases = $fields = $dates = array(); + $user = $this->getCore()->getAuthenticatedUser(); + + if(!$user instanceof \User_Adapter) + { + return $search_datas; + } + + $searchSet = $user->getPrefs('search'); + + foreach ($user->ACL()->get_granted_sbas() as $databox) + { + $sbas_id = $databox->get_sbas_id(); + + $bases[$sbas_id] = array( + 'thesaurus' => (trim($databox->get_thesaurus()) != ""), + 'cterms' => false, + 'collections' => array(), + 'sbas_id' => $sbas_id + ); + + foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) + { + $selected = ($searchSet && + isset($searchSet->bases) && + isset($searchSet->bases->$sbas_id)) ? (in_array($coll->get_base_id(), $searchSet->bases->$sbas_id)) : true; + $bases[$sbas_id]['collections'][] = + array( + 'selected' => $selected, + 'base_id' => $coll->get_base_id() + ); + } + + $meta_struct = $databox->get_meta_structure(); + foreach ($meta_struct as $meta) + { + if (!$meta->is_indexable()) + continue; + $id = $meta->get_id(); + $name = $meta->get_name(); + if ($meta->get_type() == 'date') + { + if (isset($dates[$id])) + $dates[$id]['sbas'][] = $sbas_id; + else + $dates[$id] = array('sbas' => array($sbas_id), 'fieldname' => $name); + } + + if (isset($fields[$name])) + { + $fields[$name]['sbas'][] = $sbas_id; + } + else + { + $fields[$name] = array( + 'sbas' => array($sbas_id) + , 'fieldname' => $name + , 'type' => $meta->get_type() + , 'id' => $id + ); + } + } + + if (!$bases[$sbas_id]['thesaurus']) + continue; + if (!$user->ACL()->has_right_on_sbas($sbas_id, 'bas_modif_th')) + continue; + + if (simplexml_load_string($databox->get_cterms())) + { + $bases[$sbas_id]['cterms'] = true; + } + } + + $search_datas['fields'] = $fields; + $search_datas['dates'] = $dates; + $search_datas['bases'] = $bases; + + return $search_datas; + } + + public function getRandom() + { + return md5(time() . mt_rand(100000, 999999)); + } +} diff --git a/lib/Alchemy/Phrasea/Helper/Record/Bridge.php b/lib/Alchemy/Phrasea/Helper/Record/Bridge.php new file mode 100644 index 0000000000..f44c6bc4d7 --- /dev/null +++ b/lib/Alchemy/Phrasea/Helper/Record/Bridge.php @@ -0,0 +1,29 @@ +is_single_grouping()) { @@ -108,7 +125,10 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract */ public function get_javascript_elements_ids() { - return p4string::jsonencode(array_keys($this->javascript_elements)); + return $this->core['Serializer']->serialize( + array_keys($this->javascript_elements) + , 'json' + ); } /** @@ -118,7 +138,10 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract */ public function get_javascript_elements() { - return p4string::jsonencode($this->javascript_elements); + return $this->core['Serializer']->serialize( + $this->javascript_elements + , 'json' + ); } /** @@ -128,7 +151,10 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract */ public function get_javascript_sugg_values() { - return p4string::jsonencode($this->javascript_sugg_values); + return $this->core['Serializer']->serialize( + $this->javascript_sugg_values + , 'json' + ); } /** @@ -138,7 +164,10 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract */ public function get_javascript_status() { - return p4string::jsonencode($this->javascript_status); + return $this->core['Serializer']->serialize( + $this->javascript_status + , 'json' + ); } /** @@ -148,7 +177,10 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract */ public function get_javascript_fields() { - return p4string::jsonencode(($this->javascript_fields)); + return $this->core['Serializer']->serialize( + $this->javascript_fields + , 'json' + ); } /** @@ -179,10 +211,22 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract protected function generate_javascript_elements() { $_lst = array(); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $twig = new supertwig(); + $user = $this->getCore()->getAuthenticatedUser(); + + $twig = $this->getCore()->getTwig(); + + + $databox = \databox::get_instance($this->get_sbas_id()); + + $databox_fields = array(); + foreach ($databox->get_meta_structure() as $field) + { + $databox_fields[$field->get_id()] = array( + 'dirty' => false, + 'meta_struct_id' => $field->get_id(), + 'values' => array() + ); + } foreach ($this->selection as $record) { @@ -191,7 +235,8 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract 'bid' => $record->get_base_id(), 'rid' => $record->get_record_id(), 'sselcont_id' => null, - '_selected' => false + '_selected' => false, + 'fields' => $databox_fields ); $_lst[$indice]['statbits'] = array(); @@ -204,8 +249,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $_lst[$indice]['statbits'][$n]['dirty'] = false; } } - $_lst[$indice]['fields'] = array(); - $_lst[$indice]['originalname'] = ''; + $_lst[$indice]['originalname'] = ''; $_lst[$indice]['originalname'] = $record->get_original_name(); @@ -217,19 +261,36 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract continue; } + $values = array(); + foreach ($field->get_values() as $value) + { + $type = $id = null; + + if ($value->getVocabularyType()) + { + $type = $value->getVocabularyType()->getType(); + $id = $value->getVocabularyId(); + } + + $values[$value->getId()] = array( + 'meta_id' => $value->getId(), + 'value' => $value->getValue(), + 'vocabularyId' => $id, + 'vocabularyType' => $type + ); + } + $_lst[$indice]['fields'][$meta_struct_id] = array( 'dirty' => false, - 'meta_id' => $field->get_meta_id(), 'meta_struct_id' => $meta_struct_id, - 'value' => $field->get_value() + 'values' => $values ); } - $_lst[$indice]['subdefs'] = array('thumbnail' => null, 'preview' => null); + $_lst[$indice]['subdefs'] = array(); $thumbnail = $record->get_thumbnail(); - $_lst[$indice]['subdefs']['thumbnail'] = array( 'url' => $thumbnail->get_url() , 'w' => $thumbnail->get_width() @@ -238,14 +299,6 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $_lst[$indice]['preview'] = $twig->render('common/preview.html', array('record' => $record)); - try - { - $_lst[$indice]['subdefs']['preview'] = $record->get_subdef('preview'); - } - catch (Exception $e) - { - - } $_lst[$indice]['type'] = $record->get_type(); } @@ -274,7 +327,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract continue; $T_sgval['b' . $base_id] = array(); - $collection = collection::get_from_base_id($base_id); + $collection = \collection::get_from_base_id($base_id); if ($sxe = simplexml_load_string($collection->get_prefs())) { @@ -316,13 +369,11 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract protected function generate_javascript_status() { $_tstatbits = array(); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); if ($user->ACL()->has_right('changestatus')) { - $status = databox_status::getDisplayStatus(); + $status = \databox_status::getDisplayStatus(); if (isset($status[$this->get_sbas_id()])) { foreach ($status[$this->get_sbas_id()] as $n => $statbit) @@ -353,7 +404,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $this->has_thesaurus = false; - $databox = databox::get_instance($this->get_sbas_id()); + $databox = \databox::get_instance($this->get_sbas_id()); $meta_struct = $databox->get_meta_structure(); foreach ($meta_struct as $meta) @@ -367,32 +418,11 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract return $this; } - protected function generate_field(databox_field $meta) + protected function generate_field(\databox_field $meta) { $i = count($this->javascript_fields); - switch ($meta->get_type()) - { - case 'datetime': - $format = _('phraseanet::technique::datetime-edit-format'); - $explain = _('phraseanet::technique::datetime-edit-explain'); - break; - case 'date': - $format = _('phraseanet::technique::date-edit-format'); - $explain = _('phraseanet::technique::date-edit-explain'); - break; - case 'time': - $format = _('phraseanet::technique::time-edit-format'); - $explain = _('phraseanet::technique::time-edit-explain'); - break; - default: - $format = $explain = ""; - break; - } - - $regfield = ($meta->is_regname() || $meta->is_regdesc() || $meta->is_regdate()); - - + $source = $meta->get_source(); $separator = $meta->get_separator(); $datas = array( @@ -401,17 +431,18 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract , '_status' => 0 , '_value' => '' , '_sgval' => array() - , 'required' => $meta->is_required() - , 'readonly' => $meta->is_readonly() - , 'type' => $meta->get_type() - , 'format' => $format - , 'explain' => $explain - , 'tbranch' => $meta->get_tbranch() - , 'maxLength' => $meta->get_source()->maxlength() - , 'minLength' => $meta->get_source()->minLength() - , 'regfield' => $regfield - , 'multi' => $meta->is_multi() - , 'separator' => $separator + , 'required' => $meta->is_required() + , 'readonly' => $meta->is_readonly() + , 'type' => $meta->get_type() + , 'format' => '' + , 'explain' => '' + , 'tbranch' => $meta->get_tbranch() + , 'maxLength' => $source ? $source->maxlength() : 0 + , 'minLength' => $source ? $source->minLength() : 0 + , 'multi' => $meta->is_multi() + , 'separator' => $separator + , 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null + , 'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false ); if (trim($meta->get_tbranch()) !== '') @@ -426,9 +457,9 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract * @param http_request $request * @return action_edit */ - public function execute(Symfony\Component\HttpFoundation\Request $request) + public function execute(Request $request) { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); if ($request->get('act_option') == 'SAVEGRP' && $request->get('newrepresent')) { try @@ -436,33 +467,34 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $reg_record = $this->get_grouping_head(); $reg_sbas_id = $reg_record->get_sbas_id(); - $newsubdef_reg = new record_adapter($reg_sbas_id, $request->get('newrepresent')); + $newsubdef_reg = new \record_adapter($reg_sbas_id, $request->get('newrepresent')); if ($newsubdef_reg->get_type() !== 'image') - throw new Exception('A reg image must come from image data'); + throw new \Exception('A reg image must come from image data'); foreach ($newsubdef_reg->get_subdefs() as $name => $value) { $pathfile = $value->get_pathfile(); - $system_file = new system_file($pathfile); + $system_file = new \system_file($pathfile); $reg_record->substitute_subdef($name, $system_file); } } - catch (Exception $e) + catch (\Exception $e) { } } if (!is_array($request->get('mds'))) - + { return $this; + } $sbas_id = (int) $request->get('sbid'); - $databox = databox::get_instance($sbas_id); + $databox = \databox::get_instance($sbas_id); $meta_struct = $databox->get_meta_structure(); $write_edit_el = false; - $date_obj = new DateTime(); + $date_obj = new \DateTime(); foreach ($meta_struct->get_elements() as $meta_struct_el) { if ($meta_struct_el->get_metadata_namespace() == "PHRASEANET" && $meta_struct_el->get_metadata_tagname() == 'tf-editdate') @@ -501,16 +533,26 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $record->set_metadatas($rec['metadatas']); } - if ($write_edit_el instanceof databox_field) + /** + * todo : this should not work + */ + if ($write_edit_el instanceof \databox_field) { $fields = $record->get_caption()->get_fields(array($write_edit_el->get_name())); $field = array_pop($fields); + $meta_id = null; + + if ($field && !$field->is_multi()) + { + $meta_id = array_pop($field->get_values())->getId(); + } + $metas = array( array( 'meta_struct_id' => $write_edit_el->get_id() - , 'meta_id' => ($field ? $field->get_meta_id() : null) - , 'value' => array($date_obj->format('Y-m-d h:i:s')) + , 'meta_id' => $meta_id + , 'value' => $date_obj->format('Y-m-d h:i:s') ) ); @@ -524,82 +566,36 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract $mask_and = ltrim(str_replace( array('x', '0', '1', 'z'), array('1', 'z', '0', '1'), $statbits), '0'); if ($mask_and != '') - $newstat = databox_status::operation_and_not($newstat, $mask_and); + $newstat = \databox_status::operation_and_not($newstat, $mask_and); $mask_or = ltrim(str_replace('x', '0', $statbits), '0'); if ($mask_or != '') - $newstat = databox_status::operation_or($newstat, $mask_or); + $newstat = \databox_status::operation_or($newstat, $mask_or); $record->set_binary_status($newstat); } + $collection = \collection::get_from_base_id($record->get_base_id()); + $collection->reset_stamp($record->get_record_id()); + $record->write_metas(); if ($statbits != '') { $appbox->get_session() ->get_logger($record->get_databox()) - ->log($record, Session_Logger::EVENT_STATUS, '', ''); + ->log($record, \Session_Logger::EVENT_STATUS, '', ''); } if ($editDirty) { $appbox->get_session() ->get_logger($record->get_databox()) - ->log($record, Session_Logger::EVENT_EDIT, '', ''); + ->log($record, \Session_Logger::EVENT_EDIT, '', ''); } } return $this; - -// foreach ($trecchanges as $fname => $fchange) -// { -// $bool = false; -// if ($regfields && $parm['act_option'] == 'SAVEGRP' -// && $fname == $regfields['regname']) -// { -// try -// { -// $basket = basket_adapter::getInstance($parm['ssel']); -// $basket->name = implode(' ', $fchange['values']); -// $basket->save(); -// $bool = true; -// } -// catch (Exception $e) -// { -// echo $e->getMessage(); -// } -// } -// if ($regfields && $parm['act_option'] == 'SAVEGRP' -// && $fname == $regfields['regdesc']) -// { -// try -// { -// $basket = basket_adapter::getInstance($parm['ssel']); -// $basket->desc = implode(' ', $fchange['values']); -// $basket->save(); -// $bool = true; -// } -// catch (Exception $e) -// { -// echo $e->getMessage(); -// } -// } -// if ($bool) -// { -// try -// { -// $basket = basket_adapter::getInstance($parm['ssel']); -// $basket->delete_cache(); -// } -// catch (Exception $e) -// { -// -// } -// } -// } -// -// return $this; } } diff --git a/lib/classes/module/prod/route/records/feed.class.php b/lib/Alchemy/Phrasea/Helper/Record/Feed.php similarity index 60% rename from lib/classes/module/prod/route/records/feed.class.php rename to lib/Alchemy/Phrasea/Helper/Record/Feed.php index 617dd331a1..36c0652528 100644 --- a/lib/classes/module/prod/route/records/feed.class.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Feed.php @@ -9,32 +9,47 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Helper\Record; + +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper, + Alchemy\Phrasea\Core; +use Symfony\Component\HttpFoundation\Request; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class module_prod_route_records_feed extends module_prod_route_records_abstract +class Feed extends RecordHelper { /** * * @var Array */ - protected $required_sbas_rights = array('cbas_chupub'); + protected $required_sbas_rights = array('bas_chupub'); + /** * * @var boolean */ protected $works_on_unique_sbas = true; + + /** + * + * @var boolean + */ protected $flatten_groupings = true; - public function __construct(Symfony\Component\HttpFoundation\Request $request) + /** + * + * @param \Alchemy\Phrasea\Core $core + * @return Feed + */ + public function __construct(Core $core, Request $Request) { - $appbox = appbox::get_instance(); - - parent::__construct($request); + parent::__construct($core, $Request); if ($this->is_single_grouping()) { diff --git a/lib/classes/module/prod/route/records/abstract.class.php b/lib/Alchemy/Phrasea/Helper/Record/Helper.php similarity index 75% rename from lib/classes/module/prod/route/records/abstract.class.php rename to lib/Alchemy/Phrasea/Helper/Record/Helper.php index b477f62b93..704b6de3aa 100644 --- a/lib/classes/module/prod/route/records/abstract.class.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Helper.php @@ -9,13 +9,18 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Helper\Record; + +use Alchemy\Phrasea\Core; +use Symfony\Component\HttpFoundation\Request; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class module_prod_route_records_abstract +class Helper extends \Alchemy\Phrasea\Helper\Helper { /** @@ -87,55 +92,57 @@ class module_prod_route_records_abstract /** * - * @var basket_adapter + * @var \Entities\Basket */ protected $original_basket; /** * - * @return action_move + * @param \Alchemy\Phrasea\Core $core + * @return Helper */ - public function __construct(Symfony\Component\HttpFoundation\Request $request) + public function __construct(Core $core, Request $Request) { -// $parm = $this->request->get_parms("lst", "ssel"); + parent::__construct($core, $Request); - $this->request = $request; - $this->selection = new set_selection(); - $appbox = appbox::get_instance(); + $this->selection = new \set_selection(); + + $appbox = \appbox::get_instance($core); $usr_id = $appbox->get_session()->get_usr_id(); - if (trim($request->get('ssel')) !== '') + if (trim($Request->get('ssel')) !== '') { - $basket = basket_adapter::getInstance($appbox, $request->get('ssel'), $usr_id); + $em = $this->getCore()->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); - if ($basket->is_grouping() && $this->flatten_groupings === true) - { - foreach ($basket->get_elements() as $basket_element) - { - /* @var $basket_element basket_element_adapter */ - $this->selection->add_element($basket_element->get_record()); - } - } - elseif($basket->is_grouping()) - { - $grouping = new record_adapter($basket->get_sbas_id(), $basket->get_record_id()); - $this->selection->add_element($grouping); - } - else - { - $this->selection->load_basket($basket); - $this->is_basket = true; - } - $this->original_basket = $basket; + /* @var $$repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($Request->get('ssel'), $this->getCore()->getAuthenticatedUser(), false); + + $this->selection->load_basket($Basket); + + $this->is_basket = true; + $this->original_basket = $Basket; + } + elseif (trim($Request->get('story')) !== '') + { + $em = $this->getCore()->getEntityManager(); + $repository = $em->getRepository('\Entities\StoryWZ'); + + $storyWZ = $repository->findByUserAndId( + $this->getCore()->getAuthenticatedUser() + , $Request->get('story') + ); + + $this->selection->load_list(array($storyWZ->getRecord()->get_serialize_key()), $this->flatten_groupings); } else { - $this->selection->load_list(explode(";", $request->get('lst')), $this->flatten_groupings); + $this->selection->load_list(explode(";", $Request->get('lst')), $this->flatten_groupings); } $this->elements_received = $this->selection->get_count(); $this->single_grouping = ($this->get_count_actionable() == 1 && - $this->get_count_actionable_groupings() == 1); + $this->get_count_actionable_groupings() == 1); $this->examinate_selection(); @@ -155,7 +162,7 @@ class module_prod_route_records_abstract /** * If the original selection was a basket, returns the basket object * - * @return basket_adapter + * @return \Entities\Basket */ public function get_original_basket() { @@ -200,8 +207,9 @@ class module_prod_route_records_abstract if (!$this->is_single_grouping()) throw new Exception('Cannot use ' . __METHOD__ . ' here'); foreach ($this->get_elements() as $record) - + { return $record; + } } /** @@ -293,24 +301,16 @@ class module_prod_route_records_abstract public function get_serialize_list() { if ($this->is_single_grouping()) - + { return $this->get_grouping_head()->get_serialize_key(); + } else - + { return $this->selection->serialize_list(); + } } - public function get_request() - { - return $this->request; - } - - public function set_request($request) - { - $this->request = $request; - } - - public function grep_records(Closure $closure) + public function grep_records(\Closure $closure) { foreach ($this->selection->get_elements() as $record) { diff --git a/lib/classes/module/prod/route/records/move.class.php b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php similarity index 62% rename from lib/classes/module/prod/route/records/move.class.php rename to lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php index cf9786f306..af558854f2 100644 --- a/lib/classes/module/prod/route/records/move.class.php +++ b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php @@ -9,41 +9,51 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Helper\Record; + +use Alchemy\Phrasea\Core; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; +use Symfony\Component\HttpFoundation\Request; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class module_prod_route_records_move extends module_prod_route_records_abstract +class MoveCollection extends RecordHelper { + /** * * @var Array */ protected $required_rights = array('candeleterecord'); + /** * * @var Array */ protected $available_destinations; + /** * */ protected $works_on_unique_sbas = true; /** - * Constructor * - * @return action_move + * @param \Alchemy\Phrasea\Core $core + * @return MoveCollection */ - public function __construct(Symfony\Component\HttpFoundation\Request $request) + public function __construct(Core $core, Request $Request) { - parent::__construct($request); + parent::__construct($core, $Request); $this->evaluate_destinations(); return $this; } + /** * Check which collections can receive the documents * @@ -57,11 +67,11 @@ class module_prod_route_records_move extends module_prod_route_records_abstract return $this; - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - - $this->available_destinations = array_keys($user->ACL()->get_granted_base(array('canaddrecord'), array($this->sbas_id))); + $this->available_destinations = array_keys( + $this->getCore()->getAuthenticatedUser()->ACL()->get_granted_base( + array('canaddrecord'), array($this->sbas_id) + ) + ); return $this; } @@ -86,16 +96,23 @@ class module_prod_route_records_move extends module_prod_route_records_abstract * @param http_request $request * @return action_move */ - public function execute(Symfony\Component\HttpFoundation\Request $request) + public function execute(Request $request) { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $appbox = \appbox::get_instance($this->core); + $user = $this->getCore()->getAuthenticatedUser(); + + $baseId = $request->get('base_id'); $base_dest = - $user->ACL()->has_right_on_base($request->get('base_id'), 'canaddrecord') ? + $user->ACL()->has_right_on_base($baseId, 'canaddrecord') ? $request->get('base_id') : false; + if(!$user->ACL()->has_right_on_base($baseId, 'canaddrecord')) + { + throw new \Exception_Unauthorized(sprintf("%s do not have the permission to move records to %s", $user->get_login())); + } + + if (!$this->is_possible()) throw new Exception('This action is not possible'); @@ -115,7 +132,8 @@ class module_prod_route_records_move extends module_prod_route_records_abstract } } - $collection = collection::get_from_base_id($base_dest); + + $collection = \collection::get_from_base_id($base_dest); foreach ($this->selection as $record) { @@ -124,4 +142,5 @@ class module_prod_route_records_move extends module_prod_route_records_abstract return $this; } + } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Printer.php b/lib/Alchemy/Phrasea/Helper/Record/Printer.php new file mode 100644 index 0000000000..8ae7118381 --- /dev/null +++ b/lib/Alchemy/Phrasea/Helper/Record/Printer.php @@ -0,0 +1,97 @@ +get_thumbnail()->get_type() == \media_subdef::TYPE_IMAGE || + $record->get_preview()->get_type() == \media_subdef::TYPE_IMAGE; + } + catch (\Exception $e) + { + return false; + } + }; + + $this->grep_records($grep); + } + + public function get_count_preview() + { + $n = 0; + foreach ($this->get_elements() as $element) + { + try + { + $element->get_preview()->get_type() == \media_subdef::TYPE_IMAGE; + $n++; + } + catch (\Exception $e) + { + + } + } + + return $n; + } + + public function get_count_thumbnail() + { + $n = 0; + foreach ($this->get_elements() as $element) + { + try + { + $element->get_thumbnail()->get_type() == \media_subdef::TYPE_IMAGE; + $n++; + } + catch (\Exception $e) + { + + } + } + + return $n; + } + +} diff --git a/lib/Alchemy/Phrasea/Helper/Record/Push.php b/lib/Alchemy/Phrasea/Helper/Record/Push.php new file mode 100644 index 0000000000..2afca8df86 --- /dev/null +++ b/lib/Alchemy/Phrasea/Helper/Record/Push.php @@ -0,0 +1,35 @@ +users = explode(';', $request->get('users')); + parent::__construct($core, $Request); - $this->request = $request; - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $this->users = explode(';', $Request->get('users')); $users = array(); foreach ($this->users as $usr_id) @@ -67,35 +63,38 @@ class module_admin_route_users_edit public function delete_users() { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); foreach ($this->users as $usr_id) { - $user = User_Adapter::getInstance($usr_id, $appbox); + $user = \User_Adapter::getInstance($usr_id, $appbox); $this->delete_user($user); } return $this; } - protected function delete_user(User_Adapter $user) + protected function delete_user(\User_Adapter $user) { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $master = $this->getCore()->getAuthenticatedUser(); - $list = array_keys(User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL()->get_granted_base(array('canadmin'))); + $list = array_keys($master->ACL()->get_granted_base(array('canadmin'))); $user->ACL()->revoke_access_from_bases($list); + if ($user->ACL()->is_phantom()) + { $user->delete(); + } return $this; } public function get_users_rights() { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $list = array_keys(User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL()->get_granted_base(array('canadmin'))); + $user = $this->getCore()->getAuthenticatedUser(); + $appbox = \appbox::get_instance($this->core); + + $list = array_keys($user->ACL()->get_granted_base(array('canadmin'))); $sql = "SELECT b.sbas_id, @@ -132,10 +131,7 @@ class module_admin_route_users_edit sum(remain_dwnld) as remain_dwnld, sum(month_dwnld_max) as month_dwnld_max, - mask_xor as maskxordec, - bin(mask_xor) as maskxorbin, - mask_and as maskanddec, - bin(mask_and) as maskandbin + sum(mask_and + mask_xor) as masks FROM (usr u, bas b, sbas s) LEFT JOIN (basusr bu) @@ -150,7 +146,7 @@ class module_admin_route_users_edit $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); $sql = 'SELECT base_id, sum(1) as access FROM basusr @@ -159,7 +155,7 @@ class module_admin_route_users_edit GROUP BY base_id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); - $access = $stmt->fetchAll(PDO::FETCH_ASSOC); + $access = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); $base_ids = array(); @@ -179,10 +175,10 @@ class module_admin_route_users_edit } } - $query = new User_Query($appbox); + $query = new \User_Query($appbox); $templates = $query - ->only_templates(true) - ->execute()->get_results(); + ->only_templates(true) + ->execute()->get_results(); $this->users_datas = $rs; $out = array( @@ -191,13 +187,13 @@ class module_admin_route_users_edit 'users_serial' => implode(';', $this->users), 'base_id' => $this->base_id, 'main_user' => null, - 'templates'=>$templates + 'templates' => $templates ); if (count($this->users) == 1) { $usr_id = array_pop($this->users); - $out['main_user'] = User_Adapter::getInstance($usr_id, $appbox); + $out['main_user'] = \User_Adapter::getInstance($usr_id, $appbox); } return $out; @@ -207,17 +203,15 @@ class module_admin_route_users_edit { $this->base_id = (int) $this->request->get('base_id'); -// $this->base_id = (int) $parm['base_id']; - $sql = "SELECT u.usr_id, restrict_dwnld, remain_dwnld, month_dwnld_max FROM (usr u INNER JOIN basusr bu ON u.usr_id = bu.usr_id) WHERE u.usr_id = " . implode(' OR u.usr_id = ', $this->users) . " AND bu.base_id = :base_id"; - $conn = connection::getPDOConnection(); + $conn = \connection::getPDOConnection(); $stmt = $conn->prepare($sql); $stmt->execute(array(':base_id' => $this->base_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); $this->users_datas = $rs; @@ -239,10 +233,10 @@ class module_admin_route_users_edit WHERE usr_id IN (" . implode(',', $this->users) . ") AND base_id = :base_id"; - $conn = connection::getPDOConnection(); + $conn = \connection::getPDOConnection(); $stmt = $conn->prepare($sql); $stmt->execute(array(':base_id' => $this->base_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -272,8 +266,8 @@ class module_admin_route_users_edit $tbits_left = array(); $tbits_right = array(); - $sbas_id = phrasea::sbasFromBas($this->base_id); - $databox = databox::get_instance($sbas_id); + $sbas_id = \phrasea::sbasFromBas($this->base_id); + $databox = \databox::get_instance($sbas_id); $status = $databox->get_statusbits(); foreach ($status as $bit => $datas) @@ -343,10 +337,10 @@ class module_admin_route_users_edit WHERE u.usr_id = " . implode(' OR u.usr_id = ', $this->users) . " AND bu.base_id = :base_id"; - $conn = connection::getPDOConnection(); + $conn = \connection::getPDOConnection(); $stmt = $conn->prepare($sql); $stmt->execute(array(':base_id' => $this->base_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); $time_limited = -1; @@ -371,12 +365,12 @@ class module_admin_route_users_edit if ($limited_from) { - $date_obj_from = new DateTime($limited_from); + $date_obj_from = new \DateTime($limited_from); $limited_from = $date_obj_from->format('Y-m-d'); } if ($limited_to) { - $date_obj_to = new DateTime($limited_to); + $date_obj_to = new \DateTime($limited_to); $limited_to = $date_obj_to->format('Y-m-d'); } @@ -394,10 +388,10 @@ class module_admin_route_users_edit public function apply_rights() { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); $session = $appbox->get_session(); - $request = http_request::getInstance(); - $ACL = User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL(); + $request = \http_request::getInstance(); + $ACL = \User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL(); $base_ids = array_keys($ACL->get_granted_base(array('canadmin'))); $update = $create = $delete = $create_sbas = $update_sbas = array(); @@ -449,7 +443,7 @@ class module_admin_route_users_edit { if ($v === '1') { - $create_sbas[phrasea::sbasFromBas($base_id)] = phrasea::sbasFromBas($base_id); + $create_sbas[\phrasea::sbasFromBas($base_id)] = \phrasea::sbasFromBas($base_id); $create[] = $base_id; } else @@ -457,7 +451,7 @@ class module_admin_route_users_edit } else { - $create_sbas[phrasea::sbasFromBas($base_id)] = phrasea::sbasFromBas($base_id); + $create_sbas[\phrasea::sbasFromBas($base_id)] = \phrasea::sbasFromBas($base_id); $update[$base_id][$p] = $v; } } @@ -505,7 +499,7 @@ class module_admin_route_users_edit { $appbox->get_connection()->beginTransaction(); - $user = User_Adapter::getInstance($usr_id, $appbox); + $user = \User_Adapter::getInstance($usr_id, $appbox); $user->ACL()->revoke_access_from_bases($delete) ->give_access_to_base($create) ->give_access_to_sbas($create_sbas); @@ -526,7 +520,7 @@ class module_admin_route_users_edit unset($user); } - catch (Exception $e) + catch (\Exception $e) { $appbox->get_connection()->rollBack(); } @@ -544,16 +538,16 @@ class module_admin_route_users_edit $users = $this->users; - $user = User_adapter::getInstance(array_pop($users), appbox::get_instance()); + $user = \User_adapter::getInstance(array_pop($users), \appbox::get_instance($this->core)); if ($user->is_template() || $user->is_special()) { return $this; } - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); $session = $appbox->get_session(); - $request = http_request::getInstance(); + $request = \http_request::getInstance(); $infos = array( 'gender' @@ -572,11 +566,12 @@ class module_admin_route_users_edit $parm = $request->get_parms_from_serialized_datas($infos, 'user_infos'); - if ($parm['email'] && !mail::validateEmail($parm['email'])) - throw new Exception_InvalidArgument(_('Email addess is not valid')); + if ($parm['email'] && !\mail::validateEmail($parm['email'])) + throw new \Exception_InvalidArgument(_('Email addess is not valid')); $user->set_firstname($parm['first_name']) ->set_lastname($parm['last_name']) + ->set_gender($parm['gender']) ->set_email($parm['email']) ->set_address($parm['address']) ->set_zip($parm['zip']) @@ -592,7 +587,7 @@ class module_admin_route_users_edit public function apply_template() { - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); $session = $appbox->get_session(); $template = \User_adapter::getInstance($this->request->get('template'), $appbox); @@ -603,13 +598,14 @@ class module_admin_route_users_edit } $current_user = \User_adapter::getInstance($session->get_usr_id(), $appbox); + $base_ids = array_keys($current_user->ACL()->get_granted_base(array('canadmin'))); foreach ($this->users as $usr_id) { $user = \User_adapter::getInstance($usr_id, $appbox); - if($user->is_template()) + if ($user->is_template()) { continue; } @@ -626,7 +622,7 @@ class module_admin_route_users_edit foreach ($this->users as $usr_id) { - $user = User_Adapter::getInstance($usr_id, appbox::get_instance()); + $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core)); if ($this->request->get('quota')) $user->ACL()->set_quotas_on_base($this->base_id, $this->request->get('droits'), $this->request->get('restes')); else @@ -649,7 +645,7 @@ class module_admin_route_users_edit { foreach ($this->users as $usr_id) { - $user = User_Adapter::getInstance($usr_id, appbox::get_instance()); + $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core)); $user->ACL()->set_masks_on_base($this->base_id, $vand_and, $vand_or, $vxor_and, $vxor_or); } @@ -660,20 +656,56 @@ class module_admin_route_users_edit public function apply_time() { - $this->base_id = (int) $this->request->get('base_id'); - $dmin = $this->request->get('dmin') ? new DateTime($this->request->get('dmin')) : null; - $dmax = $this->request->get('dmax') ? new DateTime($this->request->get('dmax')) : null; + $dmin = $this->request->get('dmin') ? new \DateTime($this->request->get('dmin')) : null; + $dmax = $this->request->get('dmax') ? new \DateTime($this->request->get('dmax')) : null; - $activate = $this->request->get('limit'); + $activate = !!$this->request->get('limit'); foreach ($this->users as $usr_id) { - $user = User_Adapter::getInstance($usr_id, appbox::get_instance()); + $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core)); $user->ACL()->set_limits($this->base_id, $activate, $dmin, $dmax); } } + public function resetRights() + { + $authUser = $this->core->getAuthenticatedUser(); + $adminACL = $authUser->ACL(); + $base_ids = array_keys($adminACL->get_granted_base(array('canadmin'))); + + foreach ($this->users as $usr_id) + { + $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core)); + $ACL = $user->ACL(); + + if ($user->is_template()) + { + $template = $user; + + if ($template->get_template_owner()->get_id() !== $authUser->get_id()) + { + continue; + } + } + + foreach ($base_ids as $base_id) + { + if (!$ACL->has_access_to_base($base_id)) + { + continue; + } + + $ACL->set_limits($base_id, false); + $ACL->set_masks_on_base($base_id, 0, 0, 0, 0); + $ACL->remove_quotas_on_base($base_id); + } + $ACL->revoke_access_from_bases($base_ids); + $ACL->revoke_unused_sbas_rights(); + } + } + } diff --git a/lib/classes/module/admin/route/users.class.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php similarity index 60% rename from lib/classes/module/admin/route/users.class.php rename to lib/Alchemy/Phrasea/Helper/User/Manage.php index 7485d45023..35479a42d4 100644 --- a/lib/classes/module/admin/route/users.class.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -9,16 +9,20 @@ * file that was distributed with this source code. */ +namespace Alchemy\Phrasea\Helper\User; + +use Alchemy\Phrasea\Core; +use Symfony\Component\HttpFoundation\Request; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class module_admin_route_users +class Manage extends \Alchemy\Phrasea\Helper\Helper { - protected $request; /** * * @var array @@ -35,17 +39,10 @@ class module_admin_route_users */ protected $usr_id; - public function __construct(Symfony\Component\HttpFoundation\Request $request) + public function export() { - $this->request = $request; - - - return $this; - } - - public function export(Symfony\Component\HttpFoundation\Request $request) - { - $appbox = appbox::get_instance(); + $request = $this->request; + $appbox = \appbox::get_instance($this->core); $session = $appbox->get_session(); $offset_start = (int) $request->get('offset_start'); @@ -57,13 +54,13 @@ class module_admin_route_users , 'like_value' => $request->get('like_value') , 'sbas_id' => $request->get('sbas_id') , 'base_id' => $request->get('base_id') - , 'srt' => $request->get("srt", User_Query::SORT_CREATIONDATE) - , 'ord' => $request->get("ord", User_Query::ORD_DESC) + , 'srt' => $request->get("srt", \User_Query::SORT_CREATIONDATE) + , 'ord' => $request->get("ord", \User_Query::ORD_DESC) , 'offset_start' => 0 ); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $query = new User_Query($appbox); + $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + $query = new \User_Query($appbox); if (is_array($this->query_parms['base_id'])) $query->on_base_ids($this->query_parms['base_id']); @@ -80,30 +77,30 @@ class module_admin_route_users return $this->results->get_results(); } - public function search(Symfony\Component\HttpFoundation\Request $request) + public function search() { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $request = $this->request; + $appbox = \appbox::get_instance($this->core); - $offset_start = (int) $request->get('offset_start'); + $offset_start = (int) $this->request->get('offset_start'); $offset_start = $offset_start < 0 ? 0 : $offset_start; - $results_quantity = (int) $request->get('per_page'); + $results_quantity = (int) $this->request->get('per_page'); $results_quantity = ($results_quantity < 10 || $results_quantity > 50) ? 20 : $results_quantity; $this->query_parms = array( - 'inactives' => $request->get('inactives') - , 'like_field' => $request->get('like_field') - , 'like_value' => $request->get('like_value') - , 'sbas_id' => $request->get('sbas_id') - , 'base_id' => $request->get('base_id') - , 'srt' => $request->get("srt", User_Query::SORT_CREATIONDATE) - , 'ord' => $request->get("ord", User_Query::ORD_DESC) + 'inactives' => $this->request->get('inactives') + , 'like_field' => $this->request->get('like_field') + , 'like_value' => $this->request->get('like_value') + , 'sbas_id' => $this->request->get('sbas_id') + , 'base_id' => $this->request->get('base_id') + , 'srt' => $this->request->get("srt", \User_Query::SORT_CREATIONDATE) + , 'ord' => $this->request->get("ord", \User_Query::ORD_DESC) , 'per_page' => $results_quantity , 'offset_start' => $offset_start ); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $query = new User_Query($appbox); + $user = $this->getCore()->getAuthenticatedUser(); + $query = new \User_Query($appbox); if (is_array($this->query_parms['base_id'])) $query->on_base_ids($this->query_parms['base_id']); @@ -120,22 +117,22 @@ class module_admin_route_users try { - $invite_id = User_Adapter::get_usr_id_from_login('invite'); - $invite = User_Adapter::getInstance($invite_id, $appbox); + $invite_id = \User_Adapter::get_usr_id_from_login('invite'); + $invite = \User_Adapter::getInstance($invite_id, $appbox); } - catch (Exception $e) + catch (\Exception $e) { - $invite = User_Adapter::create($appbox, 'invite', 'invite', '', false); + $invite = \User_Adapter::create($appbox, 'invite', 'invite', '', false); } try { - $autoregister_id = User_Adapter::get_usr_id_from_login('autoregister'); - $autoregister = User_Adapter::getInstance($autoregister_id, $appbox); + $autoregister_id = \User_Adapter::get_usr_id_from_login('autoregister'); + $autoregister = \User_Adapter::getInstance($autoregister_id, $appbox); } catch (Exception $e) { - $autoregister = User_Adapter::create($appbox, 'autoregister', 'autoregister', '', false); + $autoregister = \User_Adapter::create($appbox, 'autoregister', 'autoregister', '', false); } foreach ($this->query_parms as $k => $v) @@ -145,7 +142,7 @@ class module_admin_route_users } - $query = new User_Query($appbox); + $query = new \User_Query($appbox); $templates = $query ->only_templates(true) ->execute()->get_results(); @@ -163,29 +160,29 @@ class module_admin_route_users { $email = $this->request->get('value'); - if(!mail::validateEmail($email)) + if(!\mail::validateEmail($email)) { - throw new Exception_InvalidArgument(_('Invalid mail address')); + throw new \Exception_InvalidArgument(_('Invalid mail address')); } - $appbox = appbox::get_instance(); + $appbox = \appbox::get_instance($this->core); $conn = $appbox->get_connection(); $sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email'; $stmt = $conn->prepare($sql); $stmt->execute(array(':email' => $email)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(\PDO::FETCH_ASSOC); $count = count($row); if (!is_array($row) || $count == 0) { - $created_user = User_Adapter::create($appbox, $email, random::generatePassword(16), $email, false, false); + $created_user = \User_Adapter::create($appbox, $email, \random::generatePassword(16), $email, false, false); $this->usr_id = $created_user->get_id(); } else { $this->usr_id = $row['usr_id']; - $created_user = User_Adapter::getInstance($this->usr_id, $appbox); + $created_user = \User_Adapter::getInstance($this->usr_id, $appbox); } return $created_user; @@ -197,13 +194,13 @@ class module_admin_route_users if(trim($name) === '') { - throw new Exception_InvalidArgument(_('Invalid template name')); + throw new \Exception_InvalidArgument(_('Invalid template name')); } - $appbox = appbox::get_instance(); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $appbox = \appbox::get_instance($this->core); + $user = $this->getCore()->getAuthenticatedUser(); - $created_user = User_Adapter::create($appbox, $name, random::generatePassword(16), null, false, false); + $created_user = \User_Adapter::create($appbox, $name, \random::generatePassword(16), null, false, false); $created_user->set_template($user); $this->usr_id = $user->get_id(); diff --git a/lib/Alchemy/Phrasea/Helper/WorkZone.php b/lib/Alchemy/Phrasea/Helper/WorkZone.php new file mode 100644 index 0000000000..7274ba674d --- /dev/null +++ b/lib/Alchemy/Phrasea/Helper/WorkZone.php @@ -0,0 +1,81 @@ +getCore()->getEntityManager(); + $current_user = $this->getCore()->getAuthenticatedUser(); + + /* @var $repo_baskets \Doctrine\Repositories\BasketRepository */ + $repo_baskets = $em->getRepository('Entities\Basket'); + + $sort = in_array($sort, array('date', 'name')) ? $sort : 'name'; + + $ret = new \Doctrine\Common\Collections\ArrayCollection(); + + $baskets = $repo_baskets->findActiveByUser($current_user, $sort); + $validations = $repo_baskets->findActiveValidationByUser($current_user, $sort); + + /* @var $repo_stories \Doctrine\Repositories\StoryWZRepository */ + $repo_stories = $em->getRepository('Entities\StoryWZ'); + + $stories = $repo_stories->findByUser($current_user, $sort); + + $ret->set(self::BASKETS, $baskets); + $ret->set(self::VALIDATIONS, $validations); + $ret->set(self::STORIES, $stories); + + return $ret; + } + + protected function sortBaskets(array $baskets) + { + $tmp_baskets = array(); + + + + + } + +} + diff --git a/lib/Alchemy/Phrasea/Loader/ApcAutoloader.php b/lib/Alchemy/Phrasea/Loader/ApcAutoloader.php new file mode 100644 index 0000000000..07d46c3119 --- /dev/null +++ b/lib/Alchemy/Phrasea/Loader/ApcAutoloader.php @@ -0,0 +1,38 @@ +paths['config'] = __DIR__ . '/../../../../config/classes/'; + $this->paths['library'] = __DIR__ . '/../../../classes/'; + } + + /** + * {@inheritdoc} + */ + public function findFile($class) + { + if (!$file = $this->checkFile($class)) + { + $file = parent::findFile($class); + } + + return $file; + } + + /** + * Add a path to look for autoloading phraseanet classes + * @param string $name + * @param string $path + */ + public function addPath($name, $path) + { + $this->paths[$name] = \p4string::addEndSlash($path); + } + + /** + * Check whether a class with $class name exists + * foreach declared paths + * @param string $class + * @return mixed string|null + */ + private function checkFile($class) + { + foreach($this->paths as $path) + { + $file = $path. str_replace('_', '/', $class) . '.class.php'; + + if(file_exists($file)) + { + return $file; + } + } + } + + /** + * Get Paths where classes are checked for autoloading + * @return Array + */ + public function getPaths() + { + return $this->paths; + } +} diff --git a/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php b/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php new file mode 100644 index 0000000000..458cc603e9 --- /dev/null +++ b/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php @@ -0,0 +1,139 @@ +prefix = $prefix; + + foreach ($this->cacheAdapters as $className) + { + $file = sprintf("%s/%sAutoloader.php", __DIR__, $className); + + if (!file_exists($file)) + { + continue; + } + + require_once $file; + + $className = sprintf("\Alchemy\Phrasea\Loader\%sAutoloader", $className); + + if (!class_exists($className)) + { + continue; + } + + $method = new $className(); + + if($namespace) + { + $method->setNamespace($namespace); + } + + if ($method instanceof LoaderStrategy && $method->isAvailable()) + { + $this->cacheAdapter = $method; + break; + } + } + + if (null === $this->cacheAdapter) + { + throw new \Exception('No Cache available'); + } + } + + /** + * {@inheritdoc} + */ + public function findFile($class) + { + $file = $this->cacheAdapter->fetch($this->prefix . $class); + + if (false === $file) + { + $this->cacheAdapter->save($this->prefix . $class, $file = parent::findFile($class)); + } + + return $file; + } + + /** + * {@inheritdoc} + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Get the current cache Adapter + * @return LoaderStrategy + */ + public function getAdapter() + { + return $this->cacheAdapter; + } + + /** + * Get the identifier cache key prefix + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + +} diff --git a/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php b/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php new file mode 100644 index 0000000000..5741278321 --- /dev/null +++ b/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php @@ -0,0 +1,29 @@ +get_subdef('preview'); + if (!$subdef->is_physically_present()) + { + continue; + } + if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) + continue; + + $subdef = $record->get_subdef('thumbnail'); + if (!$subdef->is_physically_present()) + continue; + + if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) + continue; + } + catch (\Exception $e) + { + continue; + } + break; + case self::LAYOUT_THUMBNAILLIST: + case self::LAYOUT_THUMBNAILGRID: + try + { + $subdef = $record->get_subdef('thumbnail'); + if (!$subdef->is_physically_present()) + continue; + + if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) + throw new \Exception('Not suitable'); + } + catch (\Exception $e) + { + continue; + } + break; + } + + $record->set_number(count($list) + 1); + + $list[] = $record; + } + + $this->records = $list; + + $pdf = new PhraseaPDF("P", "mm", "A4", true, 'UTF-8', false); + + $pdf->SetAuthor("Phraseanet"); + $pdf->SetTitle("Phraseanet Print"); + $pdf->SetDisplayMode("fullpage", "single"); + + $this->pdf = $pdf; + + switch ($layout) + { + case "preview": + $this->print_preview(false); + break; + case "previewCaption": + $this->print_preview(false); + break; + case "previewCaptionTdm": + $this->print_preview(true); + break; + case "thumbnailList": + $this->print_thumbnailList(); + break; + case "thumbnailGrid": + $this->print_thumbnailGrid(); + break; + } + + return $this; + } + + public function render() + { + $this->pdf->Close(); + + return $this->pdf->Output('', 'S'); + } + + protected function print_thumbnailGrid($links=false) + { + $core = \bootstrap::getCore(); + $appbox = \appbox::get_instance($core); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + + $NDiapoW = 3; + $NDiapoH = 4; + + $this->pdf->AddPage(); + + $oldMargins = $this->pdf->getMargins(); + $tmargin = $oldMargins['top']; + $lmargin = $oldMargins['left']; + $bmargin = $oldMargins['bottom']; + $rmargin = $oldMargins['right']; + + $this->pdf->SetLeftMargin($lmargin + 55); + + $clientW = $this->pdf->getPageWidth() - $lmargin - $rmargin; + $clientH = $this->pdf->getPageHeight() - $tmargin - $bmargin; + + $DiapoW = floor($clientW / $NDiapoW); + $DiapoH = floor($clientH / $NDiapoH); + $TitleH = 5; + $ImgSize = min($DiapoW, ($DiapoH - $TitleH)) - 5; + + $npages = ceil(count($this->records) / ($NDiapoW * $NDiapoH)); + + $irow = $ipage = 0; + $icol = -1; + foreach ($this->records as $rec) + { + /* @var $rec record_adapter */ + if (++$icol >= $NDiapoW) + { + $icol = 0; + if (++$irow >= $NDiapoH) + { + $irow = 0; + $ipage++; + $this->pdf->AddPage(); + } + } + $fimg = null; + $himg = 0; + + $subdef = $rec->get_subdef('preview'); + + $fimg = $subdef->get_pathfile(); + + if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark") + && $subdef->get_type() == \media_subdef::TYPE_IMAGE) + { + $fimg = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); + } + + $wimg = $himg = $ImgSize; + if ($subdef->get_height() > 0 && $subdef->get_width() > 0) + { + if ($subdef->get_width() > $subdef->get_height()) + $himg = $wimg * $subdef->get_height() / $subdef->get_width(); + else + $wimg = $himg * $subdef->get_width() / $subdef->get_height(); + } + + if ($fimg) + { + $x = $lmargin + ($icol * $DiapoW); + $y = $tmargin + ($irow * $DiapoH); + $this->pdf->SetDrawColor(0); + $this->pdf->Rect($x, $y, $DiapoW, $DiapoH, "D"); + + $this->pdf->SetXY($x, $y + 1); + $this->pdf->SetFont(PhraseaPDF::FONT, '', 10); + $t = $irow . '-' . $x; + $t = $rec->get_title(); + + $this->pdf->MultiCell($DiapoW, $TitleH, $t, '0', 'C', false); + + if ($links) + { + $lk = $this->pdf->AddLink(); + $this->pdf->SetLink($lk, 0, $npages + $rec->get_number()); + $this->pdf->Image( + $fimg + , $x + (($DiapoW - $wimg) / 2) + , $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2) + , $wimg, $himg + , null, $lk + ); + } + else + { + $this->pdf->Image($fimg + , $x + (($DiapoW - $wimg) / 2) + , $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2) + , $wimg, $himg + ); + } + } + } + $this->pdf->SetLeftMargin($oldMargins['left']); + } + + protected function print_thumbnailList() + { + $this->pdf->AddPage(); + $oldMargins = $this->pdf->getMargins(); + + $tmargin = $oldMargins['top']; + $lmargin = $oldMargins['left']; + $bmargin = $oldMargins['bottom']; + $rmargin = $oldMargins['right']; + + $this->pdf->SetLeftMargin($lmargin + 55); + + $ndoc = 0; + $lastpage = $this->pdf->PageNo(); + foreach ($this->records as $rec) + { + /* @var $rec record_adapter */ + $subdef = $rec->get_subdef('thumbnail'); + + $fimg = $subdef->get_pathfile(); + $wimg = $himg = 50; + + if ($subdef->get_width() > $subdef->get_height()) + $himg = round($wimg * $subdef->get_height() / $subdef->get_width()); + else + $wimg = round($himg * $subdef->get_width() / $subdef->get_height()); + + $himg = 0; + + if ($this->pdf->GetY() > $this->pdf->getPageHeight() - (6 + $himg + 20)) + $this->pdf->AddPage(); + + $title = "record : " . $rec->get_title(); + + $y = $this->pdf->GetY(); + + $t = \phrasea::bas_names($rec->get_base_id()); + $this->pdf->SetFont(PhraseaPDF::FONT, '', 10); + $this->pdf->SetFillColor(220, 220, 220); + $this->pdf->SetLeftMargin($lmargin); + $this->pdf->SetRightMargin($rmargin); + $this->pdf->SetX($lmargin); + $this->pdf->SetY($y); + + $this->pdf->out = false; + $this->pdf->MultiCell(140, 4, $title, "LTR", "L", 1); + $y2 = $this->pdf->GetY(); + $h = $y2 - $y; + $this->pdf->out = true; + $this->pdf->SetX($lmargin); + $this->pdf->SetY($y); + $this->pdf->Cell(0, $h, "", "LTR", 1, "R", 1); + $this->pdf->SetX($lmargin); + $this->pdf->SetY($y); + $this->pdf->Cell(0, 4, $t, "", 1, "R"); + $this->pdf->SetX($lmargin); + $this->pdf->SetY($y); + $this->pdf->MultiCell(140, 4, $title, "", "L"); + $this->pdf->SetX($lmargin); + $this->pdf->SetY($y = $y2); + + $this->pdf->SetLeftMargin($lmargin + 55); + $this->pdf->SetY($y + 2); + + if ($fimg) + { + $y = $this->pdf->GetY(); + $this->pdf->Image($fimg, $lmargin, $y, $wimg, $himg); + $this->pdf->SetY($y); + } + + $nf = 0; + $this->pdf->SetX($lmargin + 55); + $p0 = $this->pdf->PageNo(); + $y0 = $this->pdf->GetY(); + foreach ($rec->get_caption()->get_fields() as $field) + { + /* @var $field caption_field */ + + $this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12); + $this->pdf->Write(5, $field->get_name() . " : "); + + $this->pdf->SetFont(PhraseaPDF::FONT, '', 12); + $this->pdf->Write(5, $field->get_serialized_values()); + + $this->pdf->Write(6, "\n"); + $nf++; + } + if ($this->pdf->PageNo() == $p0 && ($this->pdf->GetY() - $y0) < $himg) + $this->pdf->SetY($y0 + $himg); + $ndoc++; + } + $this->pdf->SetLeftMargin($lmargin); + } + + protected function print_preview($withtdm) + { + $core = \bootstrap::getCore(); + $appbox = \appbox::get_instance($core); + $registry = \registry::get_instance(); + $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + + if ($withtdm === true) + { + $this->print_thumbnailGrid($this->pdf, $this->records, true); + } + + foreach ($this->records as $krec => $rec) + { + /* @var $rec record_adapter */ + + $this->pdf->AddPage(); + + if ($withtdm === "CALCPAGES") + { + if ($presentationpage) + $rec->set_number($this->pdf->PageNo() + 1); + else + $rec->set_number($this->pdf->PageNo()); + } + $lmargin = $this->pdf->GetX(); + $tmargin = $this->pdf->GetY(); + $himg = 0; + $y = 0; + $miniConv = NULL; + + $LEFT__TEXT = ""; + $LEFT__IMG = NULL; + $RIGHT_TEXT = ""; + $RIGHT_IMG = NULL; + + $LEFT__IMG = $registry->get('GV_RootPath') . "config/minilogos/logopdf_" + . $rec->get_sbas_id() . ".jpg"; + + if (!is_file($LEFT__IMG)) + { + $databox = $rec->get_databox(); + $str = $databox->get_sxml_structure(); + $vn = (string) ($str->pdfPrintLogo); + if (($vn * 1) == 1) + { + $LEFT__TEXT = $databox->get_viewname(); + } + } + + $collection = \collection::get_from_base_id($rec->get_base_id()); + + $vn = ""; + if ($str = simplexml_load_string($collection->get_prefs())) + $vn = (string) ($str->pdfPrintappear); + + if ($vn == "" || $vn == "1") + { + $RIGHT_TEXT = \phrasea::bas_names($rec->get_base_id()); + } + elseif ($vn == "2") + { + $RIGHT_IMG = $registry->get('GV_RootPath') . "config/minilogos/" . $rec->get_base_id(); + } + + $xtmp = $this->pdf->GetX(); + $ytmp = $this->pdf->GetY(); + + $this->pdf->SetFont(PhraseaPDF::FONT, '', 12); + $this->pdf->SetFillColor(220, 220, 220); + $y = $this->pdf->GetY(); + $this->pdf->MultiCell(95, 7, $LEFT__TEXT, "LTB", "L", 1); + $y2 = $this->pdf->GetY(); + $h = $y2 - $y; + $this->pdf->SetY($y); + $this->pdf->SetX(105); + $this->pdf->Cell(95, $h, $RIGHT_TEXT, "TBR", 1, "R", 1); + + if ($LEFT__TEXT == "" && is_file($LEFT__IMG)) + { + if ($size = @getimagesize($LEFT__IMG)) + { + $wmm = (int) $size[0] * 25.4 / 72; + $hmm = (int) $size[1] * 25.4 / 72; + if ($hmm > 6) + { + $coeff = $hmm / 6; + $wmm = (int) $wmm / $coeff; + $hmm = (int) $hmm / $coeff; + } + $this->pdf->Image($LEFT__IMG, $xtmp + 0.5, $ytmp + 0.5, $wmm, $hmm); + } + } + + if ($RIGHT_IMG != NULL && is_file($RIGHT_IMG)) + { + if ($size = @getimagesize($RIGHT_IMG)) + { + + if ($size[2] == '1') + { + if (!isset($miniConv[$RIGHT_IMG])) + { + $tmp_filename = tempnam('minilogos/', 'gif4fpdf'); + $img = imagecreatefromgif($RIGHT_IMG); + imageinterlace($img, 0); + imagepng($img, $tmp_filename); + rename($tmp_filename, $tmp_filename . '.png'); + $miniConv[$RIGHT_IMG] = $tmp_filename . '.png'; + $RIGHT_IMG = $tmp_filename . '.png'; + } + else + $RIGHT_IMG = $miniConv[$RIGHT_IMG]; + + $wmm = (int) $size[0] * 25.4 / 72; + $hmm = (int) $size[1] * 25.4 / 72; + if ($hmm > 6) + { + $coeff = $hmm / 6; + $wmm = (int) $wmm / $coeff; + $hmm = (int) $hmm / $coeff; + } + $tt = 0; + if ($hmm < 6) + $tt = (6 - $hmm) / 2; + $this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5 + $tt); + } + else + { + $wmm = (int) $size[0] * 25.4 / 72; + $hmm = (int) $size[1] * 25.4 / 72; + if ($hmm > 6) + { + $coeff = $hmm / 6; + $wmm = (int) $wmm / $coeff; + $hmm = (int) $hmm / $coeff; + } + $this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5); + } + } + } + + $y = $this->pdf->GetY() + 3; + + $subdef = $rec->get_subdef('preview'); + + $f = $subdef->get_pathfile(); + + if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark") + && $subdef->get_type() == \media_subdef::TYPE_IMAGE) + $f = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); + + $wimg = $himg = 150; // preview dans un carre de 150 mm + if ($subdef->get_width() > 0 && $subdef->get_height() > 0) + { + if ($subdef->get_width() > $subdef->get_height()) + $himg = $wimg * $subdef->get_height() / $subdef->get_width(); + else + $wimg = $himg * $subdef->get_width() / $subdef->get_height(); + } + $this->pdf->Image($f, $lmargin, $y, $wimg, $himg); + + if ($miniConv != NULL) + { + foreach ($miniConv as $oneF) + unlink($oneF); + } + $this->pdf->SetXY($lmargin, $y += ( $himg + 5)); + + $nf = 0; + foreach ($rec->get_caption()->get_fields() as $field) + { + /* @var $field caption_field */ + if ($nf > 0) + $this->pdf->Write(6, "\n"); + + $this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12); + $this->pdf->Write(5, $field->get_name() . " : "); + + $this->pdf->SetFont(PhraseaPDF::FONT, '', 12); + + $t = str_replace( + array("<", ">", "&") + , array("<", ">", "&") + , $field->get_serialized_values() + ); + + $this->pdf->Write(5, $t); + + $nf++; + } + } + + return; + } + +} diff --git a/lib/Alchemy/Phrasea/Out/Tool/PhraseaPDF.php b/lib/Alchemy/Phrasea/Out/Tool/PhraseaPDF.php new file mode 100644 index 0000000000..d681d42450 --- /dev/null +++ b/lib/Alchemy/Phrasea/Out/Tool/PhraseaPDF.php @@ -0,0 +1,54 @@ +SetLeftMargin(0); + $mr = $this->SetRightMargin(0); + + $this->SetY(-15); + + $this->SetFont(self::FONT, 'I', 8); + $this->Cell(0, 10, 'Page ' . $this->PageNo(), 0, 0, 'C'); + + $this->SetFont(self::FONT, '', 8); + $w = $this->GetStringWidth('Printed by'); + + $this->SetFont(self::FONT, 'B', 8); + $w += $this->GetStringWidth(' Phraseanet'); + + $this->SetXY(-$w - $mr - 5, -15); + + $this->SetFont(self::FONT, '', 8); + $this->Write(8, 'Printed by'); + + $this->SetFont(self::FONT, 'B', 8); + $this->Write(8, ' Phraseanet'); + } + +} diff --git a/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/ControlProviderInterface.php b/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/ControlProviderInterface.php new file mode 100644 index 0000000000..4afd32cf25 --- /dev/null +++ b/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/ControlProviderInterface.php @@ -0,0 +1,66 @@ +like(\User_Query::LIKE_EMAIL, $query) + ->like(\User_Query::LIKE_NAME, $query) + ->like(\User_Query::LIKE_LOGIN, $query) + ->like_match(\User_Query::LIKE_MATCH_OR) + ->include_phantoms(true) + ->on_bases_where_i_am($for_user->ACL(), array('canadmin')) + ->limit(0, 50) + ->execute()->get_results(); + + $results = new ArrayCollection(); + + foreach ($users as $user) + { + $results->add( + new Term($user->get_display_name(), '', $this, $user->get_id()) + ); + } + + return $results; + } + + /** + * + * @param mixed $id + * @return boolean + */ + public function validate($id) + { + $Core = \bootstrap::getCore(); + + try + { + \User_Adapter::getInstance($id, \appbox::get_instance($Core)); + + return true; + } + catch (\Exception $e) + { + + } + + return false; + } + + /** + * + * @param mixed $id + * @return string + */ + public function getValue($id) + { + $Core = \bootstrap::getCore(); + + $user = \User_Adapter::getInstance($id, \appbox::get_instance($Core)); + + return $user->get_display_name(); + } + + /** + * + * @param mixed $id + * @return string + */ + public function getRessource($id) + { + $Core = \bootstrap::getCore(); + + return \User_Adapter::getInstance($id, \appbox::get_instance($Core)); + } + +} diff --git a/lib/Alchemy/Phrasea/Vocabulary/Controller.php b/lib/Alchemy/Phrasea/Vocabulary/Controller.php new file mode 100644 index 0000000000..3c52f7fec3 --- /dev/null +++ b/lib/Alchemy/Phrasea/Vocabulary/Controller.php @@ -0,0 +1,56 @@ +value = $value; + $this->context = $context; + $this->type = $type; + $this->id = $id; + + return $this; + } + + /** + * Get the scalar value of a term + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Get the content of a term + * + * @return string + */ + public function getContext() + { + return $this->context; + } + + /** + * + * @return ControlProviderInterface + */ + public function getType() + { + return $this->type; + } + + /** + * + * @return mixed + */ + public function getId() + { + return $this->id; + } + +} diff --git a/lib/Doctrine/Entities/Basket.php b/lib/Doctrine/Entities/Basket.php new file mode 100644 index 0000000000..2b4d5a033b --- /dev/null +++ b/lib/Doctrine/Entities/Basket.php @@ -0,0 +1,453 @@ +elements = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description + * + * @param text $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * Get description + * + * @return text + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set pusher_id + * + * @param integer $pusherId + */ + public function setPusherId($pusherId) + { + $this->pusher_id = $pusherId; + } + + /** + * Get pusher_id + * + * @return integer + */ + public function getPusherId() + { + return $this->pusher_id; + } + + /** + * Set archived + * + * @param boolean $archived + */ + public function setArchived($archived) + { + $this->archived = $archived; + } + + /** + * Get archived + * + * @return boolean + */ + public function getArchived() + { + return $this->archived; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Add elements + * + * @param Entities\BasketElement $elements + */ + public function addBasketElement(\Entities\BasketElement $elements) + { + $this->elements[] = $elements; + } + + /** + * Get elements + * + * @return Doctrine\Common\Collections\Collection + */ + public function getElements() + { + return $this->elements; + } + + public function getElementsByOrder($ordre) + { + if($ordre === self::ELEMENTSORDER_DESC) + { + $ret = new \Doctrine\Common\Collections\ArrayCollection(); + $elements = $this->elements->toArray(); + + uasort($elements, 'self::setBEOrderDESC'); + + foreach($elements as $elem) + { + $ret->add($elem); + } + + return $ret; + } + elseif($ordre === self::ELEMENTSORDER_ASC) + { + $ret = new \Doctrine\Common\Collections\ArrayCollection(); + $elements = $this->elements->toArray(); + + uasort($elements, 'self::setBEOrderASC'); + + foreach($elements as $elem) + { + $ret->add($elem); + } + + return $ret; + } + + return $this->elements; + } + + private static function setBEOrderDESC($element1, $element2) + { + $total_el1 = 0; + $total_el2 = 0; + + foreach($element1->getValidationDatas() as $datas) + { + if($datas->getAgreement() !== null) + { + $total_el1 += $datas->getAgreement() ? 1 : 0; + } + } + foreach($element2->getValidationDatas() as $datas) + { + if($datas->getAgreement() !== null) + { + $total_el2 += $datas->getAgreement() ? 1 : 0; + } + } + + if($total_el1 === $total_el2) + + return 0; + + return $total_el1 < $total_el2 ? 1 : -1; + } + + private static function setBEOrderASC($element1, $element2) + { + $total_el1 = 0; + $total_el2 = 0; + + foreach($element1->getValidationDatas() as $datas) + { + if($datas->getAgreement() !== null) + { + $total_el1 += $datas->getAgreement() ? 0 : 1; + } + } + foreach($element2->getValidationDatas() as $datas) + { + if($datas->getAgreement() !== null) + { + $total_el2 += $datas->getAgreement() ? 0 : 1; + } + } + + if($total_el1 === $total_el2) + + return 0; + + return $total_el1 < $total_el2 ? 1 : -1; + } + + public function setPusher(\User_Adapter $user) + { + $this->setPusherId($user->get_id()); + } + + public function getPusher() + { + if ($this->getPusherId()) + { + return new \User_Adapter($this->getPusherId(), \appbox::get_instance(\bootstrap::getCore())); + } + } + + public function setOwner(\User_Adapter $user) + { + $this->setUsrId($user->get_id()); + } + + public function getOwner() + { + if ($this->getUsrId()) + { + return new \User_Adapter($this->getUsrId(), \appbox::get_instance(\bootstrap::getCore())); + } + } + + /** + * @var Entities\ValidationSession + */ + protected $validation; + + /** + * Set validation + * + * @param Entities\ValidationSession $validation + */ + public function setValidation(\Entities\ValidationSession $validation) + { + $this->validation = $validation; + } + + /** + * Get validation + * + * @return Entities\ValidationSession + */ + public function getValidation() + { + return $this->validation; + } + + /** + * @var boolean $is_read + */ + protected $is_read = true; + + /** + * Set is_read + * + * @param boolean $isRead + */ + public function setIsRead($isRead) + { + $this->is_read = $isRead; + } + + /** + * Get is_read + * + * @return boolean + */ + public function getIsRead() + { + return $this->is_read; + } + + public function hasRecord(\record_adapter $record) + { + foreach ($this->getElements() as $basket_element) + { + $bask_record = $basket_element->getRecord(); + + if ($bask_record->get_record_id() == $record->get_record_id() + && $bask_record->get_sbas_id() == $record->get_sbas_id()) + { + return true; + } + } + + return false; + } + + public function getSize() + { + $totSize = 0; + + foreach ($this->getElements() as $basket_element) + { + try + { + $totSize += $basket_element->getRecord() + ->get_subdef('document') + ->get_size(); + } + catch (Exception $e) + { + + } + } + + $totSize = round($totSize / (1024 * 1024), 2); + + return $totSize; + } + +} diff --git a/lib/Doctrine/Entities/BasketElement.php b/lib/Doctrine/Entities/BasketElement.php new file mode 100644 index 0000000000..4700d3b837 --- /dev/null +++ b/lib/Doctrine/Entities/BasketElement.php @@ -0,0 +1,255 @@ +id; + } + + /** + * Set record_id + * + * @param integer $recordId + */ + public function setRecordId($recordId) + { + $this->record_id = $recordId; + } + + /** + * Get record_id + * + * @return integer + */ + public function getRecordId() + { + return $this->record_id; + } + + /** + * Set sbas_id + * + * @param integer $sbasId + */ + public function setSbasId($sbasId) + { + $this->sbas_id = $sbasId; + } + + /** + * Get sbas_id + * + * @return integer + */ + public function getSbasId() + { + return $this->sbas_id; + } + + /** + * Set ord + * + * @param integer $ord + */ + public function setOrd($ord) + { + $this->ord = $ord; + } + + /** + * Get ord + * + * @return integer + */ + public function getOrd() + { + return $this->ord; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set basket + * + * @param Entities\Basket $basket + */ + public function setBasket(\Entities\Basket $basket) + { + $this->basket = $basket; + } + + /** + * Get basket + * + * @return Entities\Basket + */ + public function getBasket() + { + return $this->basket; + } + + public function getRecord() + { + return new \record_adapter($this->getSbasId(), $this->getRecordId(), $this->getOrd()); + } + + public function setRecord(\record_adapter $record) + { + $this->setRecordId($record->get_record_id()); + $this->setSbasId($record->get_sbas_id()); + } + + public function setLastInBasket() + { + $this->setOrd($this->getBasket()->getElements()->count() + 1); + } + + /** + * @var Entities\ValidationData + */ + protected $validation_datas; + + public function __construct() + { + $this->validation_datas = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add validation_datas + * + * @param Entities\ValidationData $validationDatas + */ + public function addValidationData(\Entities\ValidationData $validationDatas) + { + $this->validation_datas[] = $validationDatas; + } + + /** + * Get validation_datas + * + * @return Doctrine\Common\Collections\Collection + */ + public function getValidationDatas() + { + return $this->validation_datas; + } + + /** + * + * @param \User_Adapter $user + * @return \Entities\ValidationData + */ + public function getUserValidationDatas(\User_Adapter $user) + { + foreach ($this->validation_datas as $validationData) + { + if ($validationData->getParticipant()->getUser()->get_id() == $user->get_id()) + { + return $validationData; + } + } + + throw new \Exception('There is no such participant '. $user->get_email()); + } + +} diff --git a/lib/Doctrine/Entities/StoryWZ.php b/lib/Doctrine/Entities/StoryWZ.php new file mode 100644 index 0000000000..7331f1d396 --- /dev/null +++ b/lib/Doctrine/Entities/StoryWZ.php @@ -0,0 +1,167 @@ +id; + } + + /** + * Set sbas_id + * + * @param integer $sbasId + */ + public function setSbasId($sbasId) + { + $this->sbas_id = $sbasId; + } + + /** + * Get sbas_id + * + * @return integer + */ + public function getSbasId() + { + return $this->sbas_id; + } + + /** + * Set record_id + * + * @param integer $recordId + */ + public function setRecordId($recordId) + { + $this->record_id = $recordId; + } + + /** + * Get record_id + * + * @return integer + */ + public function getRecordId() + { + return $this->record_id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + public function setUser(\User_Adapter $user) + { + $this->setUsrId($user->get_id()); + } + + public function getUser() + { + if ($this->getUsrId()) + { + return new \User_Adapter($this->getUsrId(), \appbox::get_instance(\bootstrap::getCore())); + } + } + + public function getRecord() + { + return new \record_adapter($this->getSbasId(), $this->getRecordId()); + } + + public function setRecord(\record_adapter $record) + { + $this->setRecordId($record->get_record_id()); + $this->setSbasId($record->get_sbas_id()); + } + +} diff --git a/lib/Doctrine/Entities/UsrList.php b/lib/Doctrine/Entities/UsrList.php new file mode 100644 index 0000000000..9c34627834 --- /dev/null +++ b/lib/Doctrine/Entities/UsrList.php @@ -0,0 +1,215 @@ +owners = new \Doctrine\Common\Collections\ArrayCollection(); + $this->entries = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Add owners + * + * @param Entities\UsrListOwner $owners + */ + public function addUsrListOwner(\Entities\UsrListOwner $owners) + { + $this->owners[] = $owners; + } + + /** + * Get owners + * + * @return Doctrine\Common\Collections\Collection + */ + public function getOwners() + { + return $this->owners; + } + + public function hasAccess(\User_Adapter $user) + { + foreach ($this->getOwners() as $owner) + { + if ($owner->getUser()->get_id() == $user->get_id()) + { + return true; + } + } + + return false; + } + + /** + * + * @param \User_Adapter $user + * @return \Entities\UsrListOwner + */ + public function getOwner(\User_Adapter $user) + { + foreach ($this->getOwners() as $owner) + { + if ($owner->getUser()->get_id() == $user->get_id()) + { + return $owner; + } + } + + throw new \Exception('This user is not an owner of the list'); + } + + /** + * Add entry + * + * @param Entities\UsrListEntry $entry + */ + public function addUsrListEntry(\Entities\UsrListEntry $entry) + { + $this->entries[] = $entry; + } + + /** + * Get entries + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getEntries() + { + return $this->entries; + } + + /** + * Return true if one of the entry is related to the given user + * + * @param \User_Adapter $user + * @return boolean + */ + public function has(\User_Adapter $user) + { + return $this->entries->exists( + function($key, $entry) use ($user) + { + return $entry->getUser()->get_id() === $user->get_id(); + } + ); + } + +} diff --git a/lib/Doctrine/Entities/UsrListEntry.php b/lib/Doctrine/Entities/UsrListEntry.php new file mode 100644 index 0000000000..1b1f66c636 --- /dev/null +++ b/lib/Doctrine/Entities/UsrListEntry.php @@ -0,0 +1,146 @@ +id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set list + * + * @param Entities\UsrList $list + */ + public function setList(\Entities\UsrList $list) + { + $this->list = $list; + } + + /** + * Get list + * + * @return Entities\UsrList + */ + public function getList() + { + return $this->list; + } + + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), \appbox::get_instance(\bootstrap::getCore())); + } + public function setUser(\User_Adapter $user) + { + return $this->setUsrId($user->get_id()); + } + +} diff --git a/lib/Doctrine/Entities/UsrListOwner.php b/lib/Doctrine/Entities/UsrListOwner.php new file mode 100644 index 0000000000..9abc4f5b8b --- /dev/null +++ b/lib/Doctrine/Entities/UsrListOwner.php @@ -0,0 +1,178 @@ +id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set role + * + * @param string $role + */ + public function setRole($role) + { + if (!in_array($role, array(self::ROLE_ADMIN, self::ROLE_EDITOR, self::ROLE_USER))) + throw new \Exception('Unknown role `' . $role . '`'); + + $this->role = $role; + } + + /** + * Get role + * + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set list + * + * @param Entities\UsrList $list + */ + public function setList(\Entities\UsrList $list) + { + $this->list = $list; + } + + /** + * Get list + * + * @return Entities\UsrList + */ + public function getList() + { + return $this->list; + } + + public function setUser(\User_Adapter $user) + { + return $this->setUsrId($user->get_id()); + } + + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), \appbox::get_instance(\bootstrap::getCore())); + } + +} diff --git a/lib/Doctrine/Entities/ValidationData.php b/lib/Doctrine/Entities/ValidationData.php new file mode 100644 index 0000000000..c787f71b6a --- /dev/null +++ b/lib/Doctrine/Entities/ValidationData.php @@ -0,0 +1,160 @@ +id; + } + + /** + * Set agreement + * + * @param boolean $agreement + */ + public function setAgreement($agreement) + { + $this->agreement = $agreement; + } + + /** + * Get agreement + * + * @return boolean + */ + public function getAgreement() + { + return $this->agreement; + } + + /** + * Set note + * + * @param text $note + */ + public function setNote($note) + { + $this->note = $note; + } + + /** + * Get note + * + * @return text + */ + public function getNote() + { + return $this->note; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set participant + * + * @param Entities\ValidationParticipant $participant + */ + public function setParticipant(\Entities\ValidationParticipant $participant) + { + $this->participant = $participant; + } + + /** + * Get participant + * + * @return Entities\ValidationParticipant + */ + public function getParticipant() + { + return $this->participant; + } + + /** + * Set basket_element + * + * @param Entities\BasketElement $basketElement + */ + public function setBasketElement(\Entities\BasketElement $basketElement) + { + $this->basket_element = $basketElement; + } + + /** + * Get basket_element + * + * @return Entities\BasketElement + */ + public function getBasketElement() + { + return $this->basket_element; + } +} diff --git a/lib/Doctrine/Entities/ValidationParticipant.php b/lib/Doctrine/Entities/ValidationParticipant.php new file mode 100644 index 0000000000..3fc0c00963 --- /dev/null +++ b/lib/Doctrine/Entities/ValidationParticipant.php @@ -0,0 +1,280 @@ +datas = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Add datases + * + * @param Entities\ValidationData $datas + */ + public function addValidationData(\Entities\ValidationData $datas) + { + $this->datas[] = $datas; + } + + /** + * Set session + * + * @param Entities\ValidationSession $session + */ + public function setSession(\Entities\ValidationSession $session) + { + $this->session = $session; + } + + /** + * Get session + * + * @return Entities\ValidationSession + */ + public function getSession() + { + return $this->session; + } + + /** + * Set is_aware + * + * @param boolean $isAware + */ + public function setIsAware($isAware) + { + $this->is_aware = $isAware; + } + + /** + * Get is_aware + * + * @return boolean + */ + public function getIsAware() + { + return $this->is_aware; + } + + /** + * + * @param \User_Adapter $user + * @return ValidationParticipant + */ + public function setUser(\User_Adapter $user) + { + $this->usr_id = $user->get_id(); + + return $this; + } + + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), \appbox::get_instance(\bootstrap::getCore())); + } + + /** + * Set reminded + * + * @param datetime $reminded + */ + public function setReminded($reminded) + { + $this->reminded = $reminded; + } + + /** + * Get reminded + * + * @return datetime + */ + public function getReminded() + { + return $this->reminded; + } + + /** + * Get datas + * + * @return Doctrine\Common\Collections\Collection + */ + public function getDatas() + { + return $this->datas; + } + + /** + * Set is_confirmed + * + * @param boolean $isConfirmed + */ + public function setIsConfirmed($isConfirmed) + { + $this->is_confirmed = $isConfirmed; + } + + /** + * Get is_confirmed + * + * @return boolean + */ + public function getIsConfirmed() + { + return $this->is_confirmed; + } + + /** + * Set can_agree + * + * @param boolean $canAgree + */ + public function setCanAgree($canAgree) + { + $this->can_agree = $canAgree; + } + + /** + * Get can_agree + * + * @return boolean + */ + public function getCanAgree() + { + return $this->can_agree; + } + + /** + * Set can_see_others + * + * @param boolean $canSeeOthers + */ + public function setCanSeeOthers($canSeeOthers) + { + $this->can_see_others = $canSeeOthers; + } + + /** + * Get can_see_others + * + * @return boolean + */ + public function getCanSeeOthers() + { + return $this->can_see_others; + } + + public function isReleasable() + { + + if ($this->getIsConfirmed()) + { + return false; + } + + foreach ($this->getDatas() as $validation_data) + { + /* @var $validation_data \Entities\ValidationData */ + if ($validation_data->getAgreement() === null) + { + return false; + } + } + + return true; + } + +} diff --git a/lib/Doctrine/Entities/ValidationSession.php b/lib/Doctrine/Entities/ValidationSession.php new file mode 100644 index 0000000000..812ba9364f --- /dev/null +++ b/lib/Doctrine/Entities/ValidationSession.php @@ -0,0 +1,387 @@ +participants = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description + * + * @param text $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * Get description + * + * @return text + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set archived + * + * @param boolean $archived + */ + public function setArchived($archived) + { + $this->archived = $archived; + } + + /** + * Get archived + * + * @return boolean + */ + public function getArchived() + { + return $this->archived; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set expires + * + * @param datetime $expires + */ + public function setExpires($expires) + { + $this->expires = $expires; + } + + /** + * Get expires + * + * @return datetime + */ + public function getExpires() + { + return $this->expires; + } + + /** + * Set reminded + * + * @param datetime $reminded + */ + public function setReminded($reminded) + { + $this->reminded = $reminded; + } + + /** + * Get reminded + * + * @return datetime + */ + public function getReminded() + { + return $this->reminded; + } + + /** + * Set basket + * + * @param Entities\Basket $basket + */ + public function setBasket(\Entities\Basket $basket) + { + $this->basket = $basket; + } + + /** + * Get basket + * + * @return Entities\Basket + */ + public function getBasket() + { + return $this->basket; + } + + /** + * Add participants + * + * @param Entities\ValidationParticipant $participants + */ + public function addValidationParticipant(\Entities\ValidationParticipant $participants) + { + $this->participants[] = $participants; + } + + /** + * Get participants + * + * @return Doctrine\Common\Collections\Collection + */ + public function getParticipants() + { + return $this->participants; + } + + /** + * Get a participant + * + * @return Entities\ValidationParticipant + */ + public function getParticipant(\User_Adapter $user) + { + foreach ($this->getParticipants() as $participant) + { + if ($participant->getUser()->get_id() == $user->get_id()) + { + return $participant; + } + } + + throw new \Exception_NotFound('Particpant not found' . $user->get_email()); + } + + /** + * @var integer $initiator + */ + protected $initiator; + + /** + * @var integer $initiator_id + */ + protected $initiator_id; + + /** + * Set initiator_id + * + * @param integer $initiatorId + */ + public function setInitiatorId($initiatorId) + { + $this->initiator_id = $initiatorId; + } + + /** + * Get initiator_id + * + * @return integer + */ + public function getInitiatorId() + { + return $this->initiator_id; + } + + public function isInitiator(\User_Adapter $user) + { + return $this->getInitiatorId() == $user->get_id(); + } + + public function setInitiator(\User_Adapter $user) + { + $this->initiator_id = $user->get_id(); + + return; + } + + public function getInitiator() + { + if ($this->initiator_id) + { + return \User_Adapter::getInstance($this->initiator_id, \appbox::get_instance(\bootstrap::getCore())); + } + } + + public function isFinished() + { + if (is_null($this->getExpires())) + { + return null; + } + + $date_obj = new \DateTime(); + + return $date_obj > $this->getExpires(); + } + + public function getValidationString(\User_Adapter $user) + { + + if ($this->isInitiator($user)) + { + if ($this->isFinished()) + { + return sprintf( + _('Vous aviez envoye cette demande a %d utilisateurs') + , (count($this->getParticipants()) - 1) + ); + } + else + { + return sprintf( + _('Vous avez envoye cette demande a %d utilisateurs') + , (count($this->getParticipants()) - 1) + ); + } + } + else + { + if ($this->getParticipant($user)->getCanSeeOthers()) + { + return sprintf( + _('Processus de validation recu de %s et concernant %d utilisateurs') + , $this->getInitiator()->get_display_name() + , (count($this->getParticipants()) - 1)); + } + else + { + return sprintf( + _('Processus de validation recu de %s') + , $this->getInitiator()->get_display_name() + ); + } + } + } + +} diff --git a/lib/Doctrine/Logger/MonologSQLLogger.php b/lib/Doctrine/Logger/MonologSQLLogger.php new file mode 100644 index 0000000000..7026fd8558 --- /dev/null +++ b/lib/Doctrine/Logger/MonologSQLLogger.php @@ -0,0 +1,93 @@ +logger = $logger; + $this->outputType = $type; + } + + /** + * {@inheritdoc} + */ + public function startQuery($sql, array $params = null, array $types = null) + { + $this->start = microtime(true); + + $this->output["sql"] = $sql; + + if ($params) + { + $this->output["params"] = $params; + } + } + + /** + * {@inheritdoc} + */ + public function stopQuery() + { + $mstime = microtime(true) - $this->start; + + $this->output["times"] = $mstime . " seconds"; + if ($this->outputType == self::JSON) + { + $this->log(json_encode($this->output)); + } + elseif ($this->outputType == self::YAML) + { + $this->log(\Symfony\Component\Yaml\Yaml::dump($this->output)); + } + else + { + $this->log(var_export($this->output, true)); + } + } + + protected function log($message) + { + $this->logger->debug($message); + } + +} diff --git a/lib/Doctrine/Proxies/EntitiesBasketElementProxy.php b/lib/Doctrine/Proxies/EntitiesBasketElementProxy.php new file mode 100644 index 0000000000..4aef7e8e65 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesBasketElementProxy.php @@ -0,0 +1,175 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setRecordId($recordId) + { + $this->__load(); + return parent::setRecordId($recordId); + } + + public function getRecordId() + { + $this->__load(); + return parent::getRecordId(); + } + + public function setSbasId($sbasId) + { + $this->__load(); + return parent::setSbasId($sbasId); + } + + public function getSbasId() + { + $this->__load(); + return parent::getSbasId(); + } + + public function setOrd($ord) + { + $this->__load(); + return parent::setOrd($ord); + } + + public function getOrd() + { + $this->__load(); + return parent::getOrd(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setBasket(\Entities\Basket $basket) + { + $this->__load(); + return parent::setBasket($basket); + } + + public function getBasket() + { + $this->__load(); + return parent::getBasket(); + } + + public function getRecord() + { + $this->__load(); + return parent::getRecord(); + } + + public function setRecord(\record_adapter $record) + { + $this->__load(); + return parent::setRecord($record); + } + + public function setLastInBasket() + { + $this->__load(); + return parent::setLastInBasket(); + } + + public function addValidationData(\Entities\ValidationData $validationDatas) + { + $this->__load(); + return parent::addValidationData($validationDatas); + } + + public function getValidationDatas() + { + $this->__load(); + return parent::getValidationDatas(); + } + + public function getUserValidationDatas(\User_Adapter $user) + { + $this->__load(); + return parent::getUserValidationDatas($user); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'record_id', 'sbas_id', 'ord', 'created', 'updated', 'validation_datas', 'basket'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesBasketProxy.php b/lib/Doctrine/Proxies/EntitiesBasketProxy.php new file mode 100644 index 0000000000..1ed363229c --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesBasketProxy.php @@ -0,0 +1,223 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setName($name) + { + $this->__load(); + return parent::setName($name); + } + + public function getName() + { + $this->__load(); + return parent::getName(); + } + + public function setDescription($description) + { + $this->__load(); + return parent::setDescription($description); + } + + public function getDescription() + { + $this->__load(); + return parent::getDescription(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function setPusherId($pusherId) + { + $this->__load(); + return parent::setPusherId($pusherId); + } + + public function getPusherId() + { + $this->__load(); + return parent::getPusherId(); + } + + public function setArchived($archived) + { + $this->__load(); + return parent::setArchived($archived); + } + + public function getArchived() + { + $this->__load(); + return parent::getArchived(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function addBasketElement(\Entities\BasketElement $elements) + { + $this->__load(); + return parent::addBasketElement($elements); + } + + public function getElements() + { + $this->__load(); + return parent::getElements(); + } + + public function setPusher(\User_Adapter $user) + { + $this->__load(); + return parent::setPusher($user); + } + + public function getPusher() + { + $this->__load(); + return parent::getPusher(); + } + + public function setOwner(\User_Adapter $user) + { + $this->__load(); + return parent::setOwner($user); + } + + public function getOwner() + { + $this->__load(); + return parent::getOwner(); + } + + public function setValidation(\Entities\ValidationSession $validation) + { + $this->__load(); + return parent::setValidation($validation); + } + + public function getValidation() + { + $this->__load(); + return parent::getValidation(); + } + + public function setIsRead($isRead) + { + $this->__load(); + return parent::setIsRead($isRead); + } + + public function getIsRead() + { + $this->__load(); + return parent::getIsRead(); + } + + public function hasRecord(\record_adapter $record) + { + $this->__load(); + return parent::hasRecord($record); + } + + public function getSize() + { + $this->__load(); + return parent::getSize(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'name', 'description', 'usr_id', 'is_read', 'pusher_id', 'archived', 'created', 'updated', 'validation', 'elements'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesStoryWZProxy.php b/lib/Doctrine/Proxies/EntitiesStoryWZProxy.php new file mode 100644 index 0000000000..566c78675e --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesStoryWZProxy.php @@ -0,0 +1,139 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setSbasId($sbasId) + { + $this->__load(); + return parent::setSbasId($sbasId); + } + + public function getSbasId() + { + $this->__load(); + return parent::getSbasId(); + } + + public function setRecordId($recordId) + { + $this->__load(); + return parent::setRecordId($recordId); + } + + public function getRecordId() + { + $this->__load(); + return parent::getRecordId(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUser(\User_Adapter $user) + { + $this->__load(); + return parent::setUser($user); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + public function getRecord() + { + $this->__load(); + return parent::getRecord(); + } + + public function setRecord(\record_adapter $record) + { + $this->__load(); + return parent::setRecord($record); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'sbas_id', 'record_id', 'usr_id', 'created'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListEntryProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListEntryProxy.php new file mode 100644 index 0000000000..fdc40e6062 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListEntryProxy.php @@ -0,0 +1,127 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setList(\Entities\UsrList $list) + { + $this->__load(); + return parent::setList($list); + } + + public function getList() + { + $this->__load(); + return parent::getList(); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + public function setUser(\User_Adapter $user) + { + $this->__load(); + return parent::setUser($user); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'created', 'updated', 'list'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php new file mode 100644 index 0000000000..6765ac71e8 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php @@ -0,0 +1,139 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function setRole($role) + { + $this->__load(); + return parent::setRole($role); + } + + public function getRole() + { + $this->__load(); + return parent::getRole(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setList(\Entities\UsrList $list) + { + $this->__load(); + return parent::setList($list); + } + + public function getList() + { + $this->__load(); + return parent::getList(); + } + + public function setUser(\User_Adapter $user) + { + $this->__load(); + return parent::setUser($user); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'role', 'created', 'updated', 'list'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListProxy.php new file mode 100644 index 0000000000..60a2b07dbf --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListProxy.php @@ -0,0 +1,145 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setName($name) + { + $this->__load(); + return parent::setName($name); + } + + public function getName() + { + $this->__load(); + return parent::getName(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function addUsrListOwner(\Entities\UsrListOwner $owners) + { + $this->__load(); + return parent::addUsrListOwner($owners); + } + + public function getOwners() + { + $this->__load(); + return parent::getOwners(); + } + + public function hasAccess(\User_Adapter $user) + { + $this->__load(); + return parent::hasAccess($user); + } + + public function getOwner(\User_Adapter $user) + { + $this->__load(); + return parent::getOwner($user); + } + + public function addUsrListEntry(\Entities\UsrListEntry $entry) + { + $this->__load(); + return parent::addUsrListEntry($entry); + } + + public function getEntries() + { + $this->__load(); + return parent::getEntries(); + } + + public function has(\User_Adapter $user) + { + $this->__load(); + return parent::has($user); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'name', 'created', 'updated', 'owners', 'entries'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesValidationDataProxy.php b/lib/Doctrine/Proxies/EntitiesValidationDataProxy.php new file mode 100644 index 0000000000..16ce6c81b8 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesValidationDataProxy.php @@ -0,0 +1,127 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setAgreement($agreement) + { + $this->__load(); + return parent::setAgreement($agreement); + } + + public function getAgreement() + { + $this->__load(); + return parent::getAgreement(); + } + + public function setNote($note) + { + $this->__load(); + return parent::setNote($note); + } + + public function getNote() + { + $this->__load(); + return parent::getNote(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setParticipant(\Entities\ValidationParticipant $participant) + { + $this->__load(); + return parent::setParticipant($participant); + } + + public function getParticipant() + { + $this->__load(); + return parent::getParticipant(); + } + + public function setBasketElement(\Entities\BasketElement $basketElement) + { + $this->__load(); + return parent::setBasketElement($basketElement); + } + + public function getBasketElement() + { + $this->__load(); + return parent::getBasketElement(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'agreement', 'note', 'updated', 'participant', 'basket_element'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesValidationParticipantProxy.php b/lib/Doctrine/Proxies/EntitiesValidationParticipantProxy.php new file mode 100644 index 0000000000..a30a98d72e --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesValidationParticipantProxy.php @@ -0,0 +1,181 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function addValidationData(\Entities\ValidationData $datas) + { + $this->__load(); + return parent::addValidationData($datas); + } + + public function setSession(\Entities\ValidationSession $session) + { + $this->__load(); + return parent::setSession($session); + } + + public function getSession() + { + $this->__load(); + return parent::getSession(); + } + + public function setIsAware($isAware) + { + $this->__load(); + return parent::setIsAware($isAware); + } + + public function getIsAware() + { + $this->__load(); + return parent::getIsAware(); + } + + public function setUser(\User_Adapter $user) + { + $this->__load(); + return parent::setUser($user); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + public function setReminded($reminded) + { + $this->__load(); + return parent::setReminded($reminded); + } + + public function getReminded() + { + $this->__load(); + return parent::getReminded(); + } + + public function getDatas() + { + $this->__load(); + return parent::getDatas(); + } + + public function setIsConfirmed($isConfirmed) + { + $this->__load(); + return parent::setIsConfirmed($isConfirmed); + } + + public function getIsConfirmed() + { + $this->__load(); + return parent::getIsConfirmed(); + } + + public function setCanAgree($canAgree) + { + $this->__load(); + return parent::setCanAgree($canAgree); + } + + public function getCanAgree() + { + $this->__load(); + return parent::getCanAgree(); + } + + public function setCanSeeOthers($canSeeOthers) + { + $this->__load(); + return parent::setCanSeeOthers($canSeeOthers); + } + + public function getCanSeeOthers() + { + $this->__load(); + return parent::getCanSeeOthers(); + } + + public function isReleasable() + { + $this->__load(); + return parent::isReleasable(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'is_aware', 'is_confirmed', 'can_agree', 'can_see_others', 'reminded', 'datas', 'session'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesValidationSessionProxy.php b/lib/Doctrine/Proxies/EntitiesValidationSessionProxy.php new file mode 100644 index 0000000000..0c6dd668c4 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesValidationSessionProxy.php @@ -0,0 +1,223 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setName($name) + { + $this->__load(); + return parent::setName($name); + } + + public function getName() + { + $this->__load(); + return parent::getName(); + } + + public function setDescription($description) + { + $this->__load(); + return parent::setDescription($description); + } + + public function getDescription() + { + $this->__load(); + return parent::getDescription(); + } + + public function setArchived($archived) + { + $this->__load(); + return parent::setArchived($archived); + } + + public function getArchived() + { + $this->__load(); + return parent::getArchived(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setExpires($expires) + { + $this->__load(); + return parent::setExpires($expires); + } + + public function getExpires() + { + $this->__load(); + return parent::getExpires(); + } + + public function setReminded($reminded) + { + $this->__load(); + return parent::setReminded($reminded); + } + + public function getReminded() + { + $this->__load(); + return parent::getReminded(); + } + + public function setBasket(\Entities\Basket $basket) + { + $this->__load(); + return parent::setBasket($basket); + } + + public function getBasket() + { + $this->__load(); + return parent::getBasket(); + } + + public function addValidationParticipant(\Entities\ValidationParticipant $participants) + { + $this->__load(); + return parent::addValidationParticipant($participants); + } + + public function getParticipants() + { + $this->__load(); + return parent::getParticipants(); + } + + public function getParticipant(\User_Adapter $user) + { + $this->__load(); + return parent::getParticipant($user); + } + + public function setInitiatorId($initiatorId) + { + $this->__load(); + return parent::setInitiatorId($initiatorId); + } + + public function getInitiatorId() + { + $this->__load(); + return parent::getInitiatorId(); + } + + public function isInitiator(\User_Adapter $user) + { + $this->__load(); + return parent::isInitiator($user); + } + + public function setInitiator(\User_Adapter $user) + { + $this->__load(); + return parent::setInitiator($user); + } + + public function getInitiator() + { + $this->__load(); + return parent::getInitiator(); + } + + public function isFinished() + { + $this->__load(); + return parent::isFinished(); + } + + public function getValidationString(\User_Adapter $user) + { + $this->__load(); + return parent::getValidationString($user); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'initiator_id', 'created', 'updated', 'expires', 'basket', 'participants'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Repositories/BasketElementRepository.php b/lib/Doctrine/Repositories/BasketElementRepository.php new file mode 100644 index 0000000000..14bc308191 --- /dev/null +++ b/lib/Doctrine/Repositories/BasketElementRepository.php @@ -0,0 +1,123 @@ + $user->get_id(), + 'same_usr_id' => $user->get_id(), + 'element_id' => $element_id + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + $element = $query->getOneOrNullResult(); + + /* @var $element \Entities\BasketElement */ + if (null === $element) + { + throw new \Exception_NotFound(_('Element is not found')); + } + + return $element; + } + + public function findElementsByRecord(\record_adapter $record) + { + $dql = 'SELECT e + FROM Entities\BasketElement e + JOIN e.basket b + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE e.record_id = :record_id + AND e.sbas_id = :sbas_id'; + + $params = array( + 'sbas_id' => $record->get_sbas_id(), + 'record_id' => $record->get_record_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + /** + * + * @param \record_adapter $record + * @param \User_Adapter $user + * @return \Doctrine\Common\Collections\ArrayCollection + */ + public function findReceivedElementsByRecord(\record_adapter $record, \User_Adapter $user) + { + $dql = 'SELECT e + FROM Entities\BasketElement e + JOIN e.basket b + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE b.usr_id = :usr_id + AND b.pusher_id IS NOT NULL + AND e.record_id = :record_id + AND e.sbas_id = :sbas_id'; + + $params = array( + 'sbas_id' => $record->get_sbas_id(), + 'record_id' => $record->get_record_id(), + 'usr_id' => $user->get_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + public function findReceivedValidationElementsByRecord(\record_adapter $record, \User_Adapter $user) + { + $dql = 'SELECT e + FROM Entities\BasketElement e + JOIN e.basket b + JOIN b.validation v + JOIN v.participants p + WHERE p.usr_id = :usr_id + AND e.record_id = :record_id + AND e.sbas_id = :sbas_id'; + + $params = array( + 'sbas_id' => $record->get_sbas_id(), + 'record_id' => $record->get_record_id(), + 'usr_id' => $user->get_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + +} diff --git a/lib/Doctrine/Repositories/BasketRepository.php b/lib/Doctrine/Repositories/BasketRepository.php new file mode 100644 index 0000000000..f6dc3b9f13 --- /dev/null +++ b/lib/Doctrine/Repositories/BasketRepository.php @@ -0,0 +1,328 @@ +_em->createQuery($dql); + $query->setParameters(array('usr_id' => $user->get_id())); + + return $query->getResult(); + } + + /** + * Returns all unread basket for a given user that are not marked as archived + * + * @param \User_Adapter $user + * @return \Doctrine\Common\Collections\ArrayCollection + */ + public function findUnreadActiveByUser(\User_Adapter $user) + { + $dql = 'SELECT b + FROM Entities\Basket b + JOIN b.elements e + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE b.archived = false + AND ( + (b.usr_id = :usr_id_owner AND b.is_read = false) + OR (b.usr_id != :usr_id_ownertwo + AND p.usr_id = :usr_id_participant + AND p.is_aware = false) + ) + AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP()) + ORDER BY e.ord ASC'; + + $params = array( + 'usr_id_owner' => $user->get_id(), + 'usr_id_ownertwo' => $user->get_id(), + 'usr_id_participant' => $user->get_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + /** + * Returns all baskets that are in validation session not expired and + * where a specified user is participant (not owner) + * + * @param \User_Adapter $user + * @return \Doctrine\Common\Collections\ArrayCollection + */ + public function findActiveValidationByUser(\User_Adapter $user, $sort = null) + { + $dql = 'SELECT b + FROM Entities\Basket b + JOIN b.elements e + JOIN e.validation_datas v + JOIN b.validation s + JOIN s.participants p + WHERE b.usr_id != ?1 AND p.usr_id = ?2 + AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP()) '; + + if ($sort == 'date') + { + $dql .= ' ORDER BY b.created DESC, e.ord ASC'; + } + elseif ($sort == 'name') + { + $dql .= ' ORDER BY b.name ASC, e.ord ASC'; + } + + $query = $this->_em->createQuery($dql); + $query->setParameters(array(1 => $user->get_id(), 2 => $user->get_id())); + + return $query->getResult(); + } + + /** + * Find a basket specified by his basket_id and his owner + * + * @throws \Exception_NotFound + * @throws \Exception_Forbidden + * @param type $basket_id + * @param \User_Adapter $user + * @return \Entities\Basket + */ + public function findUserBasket($basket_id, \User_Adapter $user, $requireOwner) + { + $dql = 'SELECT b, e + FROM Entities\Basket b + LEFT JOIN b.elements e + WHERE b.id = :basket_id + ORDER BY e.ord ASC'; + + $query = $this->_em->createQuery($dql); + $query->setParameters(array('basket_id' => $basket_id)); + + $basket = $query->getOneOrNullResult(); + + /* @var $basket \Entities\Basket */ + if (null === $basket) + { + throw new \Exception_NotFound(_('Basket is not found')); + } + + if ($basket->getOwner()->get_id() != $user->get_id()) + { + $participant = false; + + if ($basket->getValidation() && !$requireOwner) + { + try + { + $basket->getValidation()->getParticipant($user); + $participant = true; + } + catch (\Exception $e) + { + + } + } + if (!$participant) + { + throw new \Exception_Forbidden(_('You have not access to this basket')); + } + } + + return $basket; + } + + public function findContainingRecordForUser(\record_adapter $record, \User_Adapter $user) + { + + $dql = 'SELECT b, e + FROM Entities\Basket b + JOIN b.elements e + WHERE e.record_id = :record_id AND e.sbas_id = e.sbas_id + AND b.usr_id = :usr_id + ORDER BY e.ord ASC'; + + $params = array( + 'record_id' => $record->get_record_id(), + 'usr_id' => $user->get_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + public function findWorkzoneBasket(\User_Adapter $user, $query, $year, $type, $offset, $perPage) + { + $params = array(); + + switch ($type) + { + case self::RECEIVED: + $dql = 'SELECT b, e + FROM Entities\Basket b + JOIN b.elements e + WHERE b.usr_id = :usr_id AND b.pusher_id IS NOT NULL'; + $params = array( + 'usr_id' => $user->get_id() + ); + break; + case self::VALIDATION_DONE: + $dql = 'SELECT b, e + FROM Entities\Basket b + JOIN b.elements e + JOIN b.validation s + JOIN s.participants p + WHERE b.usr_id != ?1 AND p.usr_id = ?2'; + $params = array( + 1 => $user->get_id() + , 2 => $user->get_id() + ); + break; + case self::VALIDATION_SENT: + $dql = 'SELECT b, e + FROM Entities\Basket b + JOIN b.elements e + JOIN b.validation v + WHERE b.usr_id = :usr_id'; + $params = array( + 'usr_id' => $user->get_id() + ); + break; + default: + $dql = 'SELECT b, e + FROM Entities\Basket b + LEFT JOIN b.elements e + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE (b.usr_id = :usr_id OR p.usr_id = :validating_usr_id)'; + $params = array( + 'usr_id' => $user->get_id(), + 'validating_usr_id' => $user->get_id() + ); + break; + case self::MYBASKETS: + $dql = 'SELECT b, e + FROM Entities\Basket b + LEFT JOIN b.elements e + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE (b.usr_id = :usr_id)'; + $params = array( + 'usr_id' => $user->get_id() + ); + break; + } + + if (ctype_digit($year) && strlen($year) == 4) + { + $dql .= ' AND b.created >= :min_date AND b.created <= :max_date '; + + $params['min_date'] = sprintf('%d-01-01 00:00:00', $year); + $params['max_date'] = sprintf('%d-12-31 23:59:59', $year); + } + + if (trim($query) !== '') + { + $dql .= ' AND (b.name LIKE :name OR b.description LIKE :description) '; + + $params['name'] = '%' . $query . '%'; + $params['description'] = '%' . $query . '%'; + } + + $dql .= ' ORDER BY b.id DESC, e.ord ASC'; + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + $count = Paginate::getTotalQueryResults($query); + $paginateQuery = Paginate::getPaginateQuery($query, $offset, $perPage); + + $result = $paginateQuery->getResult(); + + return array('count' => $count, 'result' => $result); + } + + /** + * Return all actives validation where current user is involved and user basket + * + * @param \User_Adapter $user + * @param type $sort + * @return Array + */ + public function findActiveValidationAndBasketByUser(\User_Adapter $user, $sort = null) + { + $dql = 'SELECT b, e + FROM Entities\Basket b + LEFT JOIN b.elements e + LEFT JOIN b.validation s + LEFT JOIN s.participants p + WHERE (b.usr_id = :usr_id AND b.archived = false) + OR (b.usr_id != :usr_id AND p.usr_id = :usr_id + AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP()) + )'; + + if ($sort == 'date') + { + $dql .= ' ORDER BY b.created DESC, e.ord ASC'; + } + elseif ($sort == 'name') + { + $dql .= ' ORDER BY b.name ASC, e.ord ASC'; + } + + $query = $this->_em->createQuery($dql); + $query->setParameters(array('usr_id' => $user->get_id())); + + return $query->getResult(); + } + +} diff --git a/lib/Doctrine/Repositories/StoryWZRepository.php b/lib/Doctrine/Repositories/StoryWZRepository.php new file mode 100644 index 0000000000..8b1db19628 --- /dev/null +++ b/lib/Doctrine/Repositories/StoryWZRepository.php @@ -0,0 +1,128 @@ +_em->createQuery($dql); + $query->setParameters(array('usr_id' => $user->get_id())); + + $stories = $query->getResult(); + + foreach ($stories as $key => $story) + { + try + { + $story->getRecord()->get_title(); + } + catch (\Exception_Record_AdapterNotFound $e) + { + $this->getEntityManager()->remove($story); + unset($stories[$key]); + } + } + + $this->getEntityManager()->flush(); + + if ($sort == 'name') + { + $sortedStories = array(); + foreach ($stories as $story) + { + $sortedStories[] = $story->getRecord()->get_title(); + } + + uasort($sortedStories, function($a, $b) + { + if ($a == $b) + { + return 0; + } + + return ($a < $b) ? -1 : 1; + }); + + foreach ($sortedStories as $idStory => $titleStory) + { + $sortedStories[$idStory] = $stories[$idStory]; + } + } + + return $stories; + } + + public function findByUserAndId(\User_Adapter $user, $id) + { + $story = $this->find($id); + + if ($story) + { + try + { + $story->getRecord()->get_title(); + } + catch (\Exception_Record_AdapterNotFound $e) + { + $this->getEntityManager()->remove($story); + throw new \Exception_NotFound('Story not found'); + } + + if ($story->getUser()->get_id() !== $user->get_id()) + { + throw new \Exception_Forbidden('You have not access to ths story'); + } + } + else + { + throw new \Exception_NotFound('Story not found'); + } + + return $story; + } + + public function findUserStory(\User_Adapter $user, \record_adapter $Story) + { + $story = $this->findOneBy( + array( + 'usr_id' => $user->get_id(), + 'sbas_id' => $Story->get_sbas_id(), + 'record_id' => $Story->get_record_id(), + ) + ); + + if ($story) + { + try + { + $record = $story->getRecord(); + } + catch (\Exception_Record_AdapterNotFound $e) + { + $this->getEntityManager()->remove($story); + $this->getEntityManager()->flush(); + $story = null; + } + } + + return $story; + } + +} diff --git a/lib/Doctrine/Repositories/UsrListEntryRepository.php b/lib/Doctrine/Repositories/UsrListEntryRepository.php new file mode 100644 index 0000000000..dab4b9a254 --- /dev/null +++ b/lib/Doctrine/Repositories/UsrListEntryRepository.php @@ -0,0 +1,80 @@ + $user->get_id(), + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + public function findEntryByListAndEntryId(\Entities\UsrList $list, $entry_id) + { + $entry = $this->find($entry_id); + + if(!$entry) + { + throw new \Exception_NotFound('Entry not found'); + } + + /* @var $entry \Entities\UsrListEntry */ + if($entry->getList()->getId() != $list->getId()) + { + throw new \Exception_Forbidden('Entry mismatch list'); + } + + return $entry; + } + + + public function findEntryByListAndUsrId(\Entities\UsrList $list, $usr_id) + { + $dql = 'SELECT e FROM Entities\UsrListEntry e + JOIN e.list l + WHERE e.usr_id = :usr_id AND l.id = :list_id'; + + $params = array( + 'usr_id' => $usr_id, + 'list_id' => $list->getId(), + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + $entry = $query->getResult(); + + if(!$entry) + { + throw new \Exception_NotFound('Entry not found'); + } + + return $query->getSingleResult(); + } +} diff --git a/lib/Doctrine/Repositories/UsrListOwnerRepository.php b/lib/Doctrine/Repositories/UsrListOwnerRepository.php new file mode 100644 index 0000000000..789204c841 --- /dev/null +++ b/lib/Doctrine/Repositories/UsrListOwnerRepository.php @@ -0,0 +1,73 @@ +find($owner_id); + + /* @var $owner \Entities\UsrListOwner */ + if (null === $owner) + { + throw new \Exception_NotFound(_('Owner is not found')); + } + + if (!$owner->getList()->getid() != $list->getId()) + { + throw new \Exception_Forbidden(_('Owner and list mismatch')); + } + + return $owner; + } + + /** + * + * + * @param \Entities\UsrList $list + * @param type $usr_id + * @return \Entities\UsrList + */ + public function findByListAndUsrId(\Entities\UsrList $list, $usr_id) + { + $dql = 'SELECT o FROM Entities\UsrListOwner o + JOIN o.list l + WHERE l.id = :list_id AND o.usr_id = :usr_id'; + + $params = array( + 'usr_id' => $usr_id, + 'list_id' => $list->getId() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + $owner = $query->getSingleResult(); + + /* @var $owner \Entities\UsrListOwner */ + if (null === $owner) + { + throw new \Exception_NotFound(_('Owner is not found')); + } + + return $owner; + } + +} diff --git a/lib/Doctrine/Repositories/UsrListRepository.php b/lib/Doctrine/Repositories/UsrListRepository.php new file mode 100644 index 0000000000..a4f83dbd63 --- /dev/null +++ b/lib/Doctrine/Repositories/UsrListRepository.php @@ -0,0 +1,86 @@ + $user->get_id(), + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + /** + * + * @param \User_Adapter $user + * @param type $list_id + * @return \Entities\UsrList + */ + public function findUserListByUserAndId(\User_Adapter $user, $list_id) + { + $list = $this->find($list_id); + + /* @var $basket \Entities\UsrList */ + if (null === $list) + { + throw new \Exception_NotFound(_('List is not found')); + } + + if (!$list->hasAccess($user)) + { + throw new \Exception_Forbidden(_('You have not access to this list')); + } + + return $list; + } + + /** + * Search for a UsrList like '' with a given value, for a user + * + * @param \User_Adapter $user + * @param type $name + * @return \Doctrine\Common\Collections\ArrayCollection + */ + public function findUserListLike(\User_Adapter $user, $name) + { + $dql = 'SELECT l FROM Entities\UsrList l + JOIN l.owners o + WHERE o.usr_id = :usr_id AND l.name LIKE :name'; + + $params = array( + 'usr_id' => $user->get_id(), + 'name' => $name.'%' + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + +} diff --git a/lib/classes/cache/opcode/interface.class.php b/lib/Doctrine/Repositories/ValidationParticipantRepository.php similarity index 67% rename from lib/classes/cache/opcode/interface.class.php rename to lib/Doctrine/Repositories/ValidationParticipantRepository.php index 4f753e9e9b..6340358c5a 100644 --- a/lib/classes/cache/opcode/interface.class.php +++ b/lib/Doctrine/Repositories/ValidationParticipantRepository.php @@ -9,19 +9,18 @@ * file that was distributed with this source code. */ +namespace Repositories; + +use Doctrine\ORM\EntityRepository; + /** * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -interface cache_opcode_interface +class ValidationParticipantRepository extends EntityRepository { - public function get($key); - public function set($key, $var); - - public function is_set($key); - - public function un_set($key); } + diff --git a/lib/Doctrine/Types/Binary.php b/lib/Doctrine/Types/Binary.php new file mode 100644 index 0000000000..17debee9b4 --- /dev/null +++ b/lib/Doctrine/Types/Binary.php @@ -0,0 +1,38 @@ +getDoctrineTypeMapping('BINARY'); + } + +} diff --git a/lib/Doctrine/Types/Blob.php b/lib/Doctrine/Types/Blob.php new file mode 100644 index 0000000000..9f6ead26d5 --- /dev/null +++ b/lib/Doctrine/Types/Blob.php @@ -0,0 +1,38 @@ +getDoctrineTypeMapping('BLOB'); + } + +} diff --git a/lib/Doctrine/Types/Enum.php b/lib/Doctrine/Types/Enum.php new file mode 100644 index 0000000000..6c9a51d4d9 --- /dev/null +++ b/lib/Doctrine/Types/Enum.php @@ -0,0 +1,38 @@ +getDoctrineTypeMapping('ENUM'); + } + +} diff --git a/lib/Doctrine/Types/LongBlob.php b/lib/Doctrine/Types/LongBlob.php new file mode 100644 index 0000000000..6ac39ddb01 --- /dev/null +++ b/lib/Doctrine/Types/LongBlob.php @@ -0,0 +1,38 @@ +getDoctrineTypeMapping('LONGBLOB'); + } + +} diff --git a/lib/Doctrine/Types/VarBinary.php b/lib/Doctrine/Types/VarBinary.php new file mode 100644 index 0000000000..b8796064ad --- /dev/null +++ b/lib/Doctrine/Types/VarBinary.php @@ -0,0 +1,38 @@ +getDoctrineTypeMapping('VARBINARY'); + } + +} diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 08b4717058..36ad600b21 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -11,9 +11,10 @@ /** * - * @package + * @return \Alchemy\Phrasea\Core * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ require_once dirname(__FILE__) . '/classes/bootstrap.class.php'; -bootstrap::execute(); + +return bootstrap::execute(); diff --git a/lib/classes/ACL.class.php b/lib/classes/ACL.class.php index fd3ca9eb08..667af5771b 100644 --- a/lib/classes/ACL.class.php +++ b/lib/classes/ACL.class.php @@ -93,6 +93,9 @@ class ACL implements cache_cacheableInterface const CACHE_RIGHTS_RECORDS = 'rights_records'; const CACHE_GLOBAL_RIGHTS = 'global_rights'; + const GRANT_ACTION_PUSH = 'push'; + const GRANT_ACTION_VALIDATE = 'validate'; + /** * Constructor * @@ -300,11 +303,15 @@ class ACL implements cache_cacheableInterface $bas_to_acces = $masks_to_give = $rights_to_give = array(); - $sbmap = array(// map masks (and+xor) of template to masks to apply to user on base (and_and, and_or, xor_and, xor_or) - '00' => array('aa' => '1', 'ao' => '0', 'xa' => '1', 'xo' => '0'), - '01' => array('aa' => '1', 'ao' => '0', 'xa' => '1', 'xo' => '0'), - '10' => array('aa' => '1', 'ao' => '1', 'xa' => '0', 'xo' => '0'), - '11' => array('aa' => '1', 'ao' => '1', 'xa' => '1', 'xo' => '1') + /** + * map masks (and+xor) of template to masks to apply to user on base + * (and_and, and_or, xor_and, xor_or) + */ + $sbmap = array( + '00' => array('aa' => '1', 'ao' => '0', 'xa' => '1', 'xo' => '0'), + '01' => array('aa' => '1', 'ao' => '0', 'xa' => '1', 'xo' => '0'), + '10' => array('aa' => '1', 'ao' => '1', 'xa' => '0', 'xo' => '0'), + '11' => array('aa' => '1', 'ao' => '1', 'xa' => '1', 'xo' => '1') ); foreach ($template_user->ACL()->get_granted_base() as $collection) @@ -327,17 +334,35 @@ class ACL implements cache_cacheableInterface } } - // apply sb : unchecked boxes on template will be unchecked on user - // checked boxes on template does nothing (left unchanged on user) - // get masks from 64 bits int AS DECIMAL STRING to BINARY STRING - $mand = substr(str_repeat('0', 64) . databox_status::dec2bin($template_user->ACL()->get_mask_and($base_id)), -64); - $mxor = substr(str_repeat('0', 64) . databox_status::dec2bin($template_user->ACL()->get_mask_xor($base_id)), -64); - $m = array('aa' => '', 'ao' => '', 'xa' => '', 'xo' => ''); - for ($i = 0; $i < 64; $i++) + $mask_and = $template_user->ACL()->get_mask_and($base_id); + $mask_xor = $template_user->ACL()->get_mask_xor($base_id); + + $mask_and = ctype_digit($mask_and) ? $mask_and : '0'; + $mask_xor = ctype_digit($mask_xor) ? $mask_xor : '0'; + + + /** + * apply sb is substractive + */ + $mand = substr( + str_repeat('0', 64) + . databox_status::dec2bin($mask_and) + , -64 + ); + $mxor = substr( + str_repeat('0', 64) + . databox_status::dec2bin($mask_xor) + , -64 + ); + $m = array('aa' => '', 'ao' => '', 'xa' => '', 'xo' => ''); + for ($i = 0; $i < 64; $i++) { $ax = $mand[$i] . $mxor[$i]; + foreach ($m as $k => $v) + { $m[$k] .= $sbmap[$ax][$k]; + } } $masks_to_give[$base_id] = array( @@ -928,10 +953,10 @@ class ACL implements cache_cacheableInterface $this->_global_rights['order_master'] = true; $row['limited_from'] = $row['limited_from'] == '0000-00-00 00:00:00' ? '' : trim($row['limited_from']); - $row['limited_to'] = $row['limited_to'] == '0000-00-00 00:00:00' ? '' : trim($row['limited_to']); + $row['limited_to'] = $row['limited_to'] == '0000-00-00 00:00:00' ? '' : trim($row['limited_to']); if ($row['time_limited'] == '1' - && ($row['limited_from'] !== '' || $row['limited_to'] !== '')) + && ($row['limited_from'] !== '' || $row['limited_to'] !== '')) { $this->_limited[$row['base_id']] = array( 'dmin' => $row['limited_from'] ? new DateTime($row['limited_from']) : null diff --git a/lib/classes/API/OAuth2/Adapter.class.php b/lib/classes/API/OAuth2/Adapter.class.php index ab3d8458d1..15d6eee145 100644 --- a/lib/classes/API/OAuth2/Adapter.class.php +++ b/lib/classes/API/OAuth2/Adapter.class.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__) . '/../../../vendor/oauth2/lib/OAuth2.inc'; +require_once __DIR__ . '/../../../vendor/oauth2/lib/OAuth2.inc'; /** * @@ -406,11 +406,22 @@ class API_OAuth2_Adapter extends OAuth2 'response_type' => $request->get('response_type', false) , 'client_id' => $request->get('client_id', false) , 'redirect_uri' => $request->get('redirect_uri', false) - , 'scope' => $request->get('scope', false) - , 'state' => $request->get('state', false) ); + $scope = $request->get('scope', false); + $state = $request->get('state', false); + + if($state) + { + $datas["state"] = $state; + } + + if($scope) + { + $datas["scope"] = $scope; + } + $filters = array( "client_id" => array( "filter" => FILTER_VALIDATE_REGEXP diff --git a/lib/classes/API/OAuth2/Autoloader.class.php b/lib/classes/API/OAuth2/Autoloader.class.php index 6fd696ef08..1099c5eac6 100644 --- a/lib/classes/API/OAuth2/Autoloader.class.php +++ b/lib/classes/API/OAuth2/Autoloader.class.php @@ -41,7 +41,7 @@ class API_OAuth2_Autoloader */ static public function autoload($class) { - if (file_exists($file = dirname(__FILE__) . '/../../../vendor/oauth2/lib/' . str_replace(array('_', "\0"), array('/', ''), $class) . '.inc')) + if (file_exists($file = __DIR__ . '/../../../vendor/oauth2/lib/' . str_replace(array('_', "\0"), array('/', ''), $class) . '.inc')) { require $file; } diff --git a/lib/classes/API/OAuth2/Form/DevApp.class.php b/lib/classes/API/OAuth2/Form/DevAppDesktop.class.php similarity index 61% rename from lib/classes/API/OAuth2/Form/DevApp.class.php rename to lib/classes/API/OAuth2/Form/DevAppDesktop.class.php index 98d63961c7..175eea6e4b 100644 --- a/lib/classes/API/OAuth2/Form/DevApp.class.php +++ b/lib/classes/API/OAuth2/Form/DevAppDesktop.class.php @@ -24,7 +24,7 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Constraints; -class API_OAuth2_Form_DevApp +class API_OAuth2_Form_DevAppDesktop { /** @@ -51,6 +51,14 @@ class API_OAuth2_Form_DevApp */ public $callback; + /** + * + * @var string + */ + public $type; + public $scheme_website; + public $urlwebsite; + /** * * @param Request $request @@ -58,10 +66,14 @@ class API_OAuth2_Form_DevApp */ public function __construct(Request $request) { - $this->name = $request->get('name', null); - $this->description = $request->get('description', null); - $this->website = $request->get('website', null); - $this->callback = $request->get('callback', null); + $this->name = $request->get('name', ''); + $this->description = $request->get('description', ''); + $this->scheme_website = $request->get('scheme-website', 'http://'); + $this->website = $request->get('website', ''); + $this->callback = API_OAuth2_Application::NATIVE_APP_REDIRECT_URI; + $this->type = API_OAuth2_Application::DESKTOP_TYPE; + + $this->urlwebsite = $this->scheme_website . $this->website; return $this; } @@ -75,18 +87,6 @@ class API_OAuth2_Form_DevApp return $this->name; } - /** - * - * @param string $callback - * @return API_OAuth2_Form_DevApp - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - /** * * @return string @@ -96,18 +96,6 @@ class API_OAuth2_Form_DevApp return $this->description; } - /** - * - * @param string $callback - * @return API_OAuth2_Form_DevApp - */ - public function setDescription($description) - { - $this->description = $description; - - return $this; - } - /** * * @return string @@ -117,18 +105,6 @@ class API_OAuth2_Form_DevApp return $this->website; } - /** - * - * @param string $callback - * @return API_OAuth2_Form_DevApp - */ - public function setWebsite($website) - { - $this->website = $website; - - return $this; - } - /** * * @return string @@ -140,17 +116,29 @@ class API_OAuth2_Form_DevApp /** * - * @param string $callback - * @return API_OAuth2_Form_DevApp + * @return string */ - public function setCallback($callback) + public function getType() { - $this->callback = $callback; - - return $this; + return $this->type; } - /** + public function getSchemeWebsite() + { + return $this->scheme_website; + } + + public function getUrlwebsite() + { + return $this->urlwebsite; + } + + public function getSchemeCallback() + { + return ''; + } + + /** * * @param ClassMetadata $metadata * @return API_OAuth2_Form_DevApp @@ -162,10 +150,8 @@ class API_OAuth2_Form_DevApp $metadata->addPropertyConstraint('name', new Constraints\NotBlank($blank)); $metadata->addPropertyConstraint('description', new Constraints\NotBlank($blank)); - $metadata->addPropertyConstraint('website', new Constraints\NotBlank($blank)); - $metadata->addPropertyConstraint('website', new Constraints\Url($url)); - $metadata->addPropertyConstraint('callback', new Constraints\NotBlank($blank)); - $metadata->addPropertyConstraint('callback', new Constraints\Url($url)); + $metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank($blank)); + $metadata->addPropertyConstraint('urlwebsite', new Constraints\Url($url)); return; } diff --git a/lib/classes/API/OAuth2/Form/DevAppInternet.class.php b/lib/classes/API/OAuth2/Form/DevAppInternet.class.php new file mode 100644 index 0000000000..4e93dca0a3 --- /dev/null +++ b/lib/classes/API/OAuth2/Form/DevAppInternet.class.php @@ -0,0 +1,166 @@ +name = $request->get('name', ''); + $this->description = $request->get('description', ''); + $this->website = $request->get('website', ''); + $this->callback = $request->get('callback', ''); + $this->scheme_website = $request->get('scheme-website', 'http://'); + $this->scheme_callback = $request->get('scheme-callback', 'http://'); + $this->type = API_OAuth2_Application::WEB_TYPE; + + $this->urlwebsite = $this->scheme_website.$this->website; + $this->urlcallback = $this->scheme_callback.$this->callback; + + return $this; + } + + /** + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * + * @return string + */ + public function getWebsite() + { + return $this->website; + } + + /** + * + * @return string + */ + public function getCallback() + { + return $this->callback; + } + + /** + * + * @return string + */ + public function getType() + { + return $this->type; + } + + public function getSchemeWebsite() + { + return $this->scheme_website; + } + + public function getSchemeCallback() + { + return $this->scheme_callback; + } + + public function getUrlwebsite() + { + return $this->urlwebsite; + } + + public function getUrlcallback() + { + return $this->urlcallback; + } + + /** + * + * @param ClassMetadata $metadata + * @return API_OAuth2_Form_DevApp + */ + static public function loadValidatorMetadata(ClassMetadata $metadata) + { + $blank = array('message' => _('Cette valeur ne peut être vide')); + $url = array('message' => _('Url non valide')); + + $metadata->addPropertyConstraint('name', new Constraints\NotBlank($blank)); + $metadata->addPropertyConstraint('description', new Constraints\NotBlank($blank)); + $metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank($blank)); + $metadata->addPropertyConstraint('urlwebsite', new Constraints\Url($url)); + $metadata->addPropertyConstraint('urlcallback', new Constraints\NotBlank($blank)); + $metadata->addPropertyConstraint('urlcallback', new Constraints\Url($url)); + + return; + } + +} diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index 75b9fe69ec..6cacd688c8 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -25,7 +25,7 @@ class API_V1_adapter extends API_V1_Abstract * * @var string */ - protected $version = '1.0'; + protected $version = '1.1'; /** * Appbox where the API works @@ -34,6 +34,13 @@ class API_V1_adapter extends API_V1_Abstract */ protected $appbox; + /** + * Phraseanet Core + * + * @var \Alchemy\Phrasea\Core + */ + protected $core; + /** * API constructor * @@ -41,9 +48,10 @@ class API_V1_adapter extends API_V1_Abstract * @param appbox $appbox Appbox object * @return API_V1_adapter */ - public function __construct($auth_token, appbox &$appbox) + public function __construct($auth_token, appbox &$appbox, Alchemy\Phrasea\Core $core) { $this->appbox = $appbox; + $this->core = $core; return $this; } @@ -115,11 +123,11 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $result->set_datas( - array( - "collections" => $this->list_databox_collections( - $this->appbox->get_databox($databox_id) - ) - ) + array( + "collections" => $this->list_databox_collections( + $this->appbox->get_databox($databox_id) + ) + ) ); return $result; @@ -138,12 +146,12 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $result->set_datas( - array( - "status" => - $this->list_databox_status( - $this->appbox->get_databox($databox_id)->get_statusbits() - ) - ) + array( + "status" => + $this->list_databox_status( + $this->appbox->get_databox($databox_id)->get_statusbits() + ) + ) ); return $result; @@ -162,13 +170,13 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $result->set_datas( - array( - "metadatas" => - $this->list_databox_metadatas_fields( - $this->appbox->get_databox($databox_id) - ->get_meta_structure() - ) - ) + array( + "metadatas" => + $this->list_databox_metadatas_fields( + $this->appbox->get_databox($databox_id) + ->get_meta_structure() + ) + ) ); return $result; @@ -187,15 +195,35 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $result->set_datas( - array( - "termsOfUse" => - $this->list_databox_terms($this->appbox->get_databox($databox_id)) - ) + array( + "termsOfUse" => + $this->list_databox_terms($this->appbox->get_databox($databox_id)) + ) ); return $result; } + public function caption_records(Request $request, $databox_id, $record_id) + { + $result = new API_V1_result($request, $this); + + $record = $this->appbox->get_databox($databox_id)->get_record($record_id); + $fields = $record->get_caption()->get_fields(); + $ret = array(); + foreach ($fields as $field) + { + $ret[$field->get_meta_struct_id()] = array( + 'meta_structure_id' => $field->get_meta_struct_id() + , 'name' => $field->get_name() + , 'value' => $field->get_serialized_values(";") + ); + } + $result->set_datas($ret); + + return $result; + } + /** * Get an API_V1_result containing the results of a records search * @@ -206,37 +234,37 @@ class API_V1_adapter extends API_V1_Abstract */ public function search_records(Request $request) { - $session = $this->appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); + $session = $this->appbox->get_session(); + $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); $registry = $this->appbox->get_registry(); - $result = new API_V1_result($request, $this); + $result = new API_V1_result($request, $this); $search_type = ($request->get('search_type') - && in_array($request->get('search_type'), array(0, 1))) ? - $request->get('search_type') : 0; + && in_array($request->get('search_type'), array(0, 1))) ? + $request->get('search_type') : 0; $record_type = ($request->get('record_type') - && in_array( - $request->get('record_type') - , array('audio', 'video', 'image', 'document', 'flash')) - ) ? - $request->get('record_type') : ''; + && in_array( + $request->get('record_type') + , array('audio', 'video', 'image', 'document', 'flash')) + ) ? + $request->get('record_type') : ''; $params = array( - 'fields' => is_array($request->get('fields')) ? $request->get('fields') : array() - , 'status' => is_array($request->get('status')) ? $request->get('status') : array() - , 'bases' => is_array($request->get('bases')) ? $request->get('bases') : array() - , 'search_type' => $search_type - , 'recordtype' => $record_type - , 'datemin' => $request->get('datemin') ? : '' - , 'datemax' => $request->get('datemax') ? : '' - , 'datefield' => $request->get('datefield') ? : '' - , 'sort' => $request->get('sort') ? : '' - , 'ord' => $request->get('ord') ? : '' - , 'stemme' => $request->get('stemme') ? : '' - , 'per_page' => $request->get('per_page') ? : 10 - , 'query' => $request->get('query') ? : '' - , 'page' => (int) ($request->get('page') ? : 0) + 'fields' => is_array($request->get('fields')) ? $request->get('fields') : array() + , 'status' => is_array($request->get('status')) ? $request->get('status') : array() + , 'bases' => is_array($request->get('bases')) ? $request->get('bases') : array() + , 'search_type' => $search_type + , 'recordtype' => $record_type + , 'datemin' => $request->get('datemin') ? : '' + , 'datemax' => $request->get('datemax') ? : '' + , 'datefield' => $request->get('datefield') ? : '' + , 'sort' => $request->get('sort') ? : '' + , 'ord' => $request->get('ord') ? : '' + , 'stemme' => $request->get('stemme') ? : '' + , 'per_page' => $request->get('per_page') ? : 10 + , 'query' => $request->get('query') ? : '' + , 'page' => (int) ($request->get('page') ? : 0) ); if (is_array($request->get('bases')) === false) @@ -266,7 +294,7 @@ class API_V1_adapter extends API_V1_Abstract $options->set_sort($params['sort'], $params['ord']); $options->set_use_stemming($params['stemme']); - $perPage = $params['per_page']; + $perPage = (int) $params['per_page']; $search_engine = new searchEngine_adapter($registry); $search_engine->set_options($options); @@ -285,17 +313,17 @@ class API_V1_adapter extends API_V1_Abstract $search_result = $search_engine->query_per_page($params['query'], $params["page"], $perPage); $ret = array( - 'total_pages' => $search_result->get_total_pages() - , 'current_page' => $search_result->get_current_page() - , 'available_results' => $search_result->get_count_available_results() - , 'total_results' => $search_result->get_count_total_results() - , 'error' => $search_result->get_error() - , 'warning' => $search_result->get_warning() - , 'query_time' => $search_result->get_query_time() - , 'search_indexes' => $search_result->get_search_indexes() - , 'suggestions' => $search_result->get_suggestions() - , 'results' => array() - , 'query' => $search_engine->get_query() + 'total_pages' => $search_result->get_total_pages() + , 'current_page' => $search_result->get_current_page() + , 'available_results' => $search_result->get_count_available_results() + , 'total_results' => $search_result->get_count_total_results() + , 'error' => $search_result->get_error() + , 'warning' => $search_result->get_warning() + , 'query_time' => $search_result->get_query_time() + , 'search_indexes' => $search_result->get_search_indexes() + , 'suggestions' => $search_result->get_suggestions() + , 'results' => array() + , 'query' => $search_engine->get_query() ); foreach ($search_result->get_datas()->get_elements() as $record) @@ -325,14 +353,14 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $containers = $this->appbox - ->get_databox($databox_id) - ->get_record($record_id) - ->get_container_baskets(); + ->get_databox($databox_id) + ->get_record($record_id) + ->get_container_baskets(); $ret = array(); foreach ($containers as $basket) { - $ret[$basket->get_ssel_id()] = $this->list_basket($basket); + $ret[$basket->getId()] = $this->list_basket($basket); } $result->set_datas(array("baskets" => $ret)); @@ -356,9 +384,9 @@ class API_V1_adapter extends API_V1_Abstract $record = $this->appbox->get_databox($databox_id)->get_record($record_id); $result->set_datas( - array( - "metadatas" => $this->list_record_caption($record->get_caption()) - ) + array( + "metadatas" => $this->list_record_caption($record->get_caption()) + ) ); return $result; @@ -378,17 +406,17 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $record = $this->appbox - ->get_databox($databox_id) - ->get_record($record_id); + ->get_databox($databox_id) + ->get_record($record_id); $result->set_datas( - array( - "status" => - $this->list_record_status( - $this->appbox->get_databox($databox_id) - , $record->get_status() - ) - ) + array( + "status" => + $this->list_record_status( + $this->appbox->get_databox($databox_id) + , $record->get_status() + ) + ) ); return $result; @@ -429,8 +457,19 @@ class API_V1_adapter extends API_V1_Abstract try { $metadatas = $request->get('metadatas'); + if (!is_array($metadatas)) - throw new Exception(); + { + throw new Exception('Metadatas should be an array'); + } + + foreach ($metadatas as $metadata) + { + if (!is_array($metadata)) + { + throw new Exception('Each Metadata value should be an array'); + } + } $record->set_metadatas($metadatas); $result->set_datas(array("metadatas" => $this->list_record_caption($record->get_caption()))); @@ -445,9 +484,9 @@ class API_V1_adapter extends API_V1_Abstract public function set_record_status(Request $request, $databox_id, $record_id) { - $result = new API_V1_result($request, $this); - $databox = $this->appbox->get_databox($databox_id); - $record = $databox->get_record($record_id); + $result = new API_V1_result($request, $this); + $databox = $this->appbox->get_databox($databox_id); + $record = $databox->get_record($record_id); $status_bits = $databox->get_statusbits(); try @@ -473,9 +512,9 @@ class API_V1_adapter extends API_V1_Abstract $record->set_binary_status($datas); $result->set_datas(array( - "status" => - $this->list_record_status($databox, $record->get_status()) - ) + "status" => + $this->list_record_status($databox, $record->get_status()) + ) ); } catch (Exception $e) @@ -496,9 +535,9 @@ class API_V1_adapter extends API_V1_Abstract */ public function set_record_collection(Request $request, $databox_id, $record_id) { - $result = new API_V1_result($request, $this); + $result = new API_V1_result($request, $this); $databox = $this->appbox->get_databox($databox_id); - $record = $databox->get_record($record_id); + $record = $databox->get_record($record_id); try { @@ -525,7 +564,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function get_record(Request $request, $databox_id, $record_id) { - $result = new API_V1_result($request, $this); + $result = new API_V1_result($request, $this); $databox = $this->appbox->get_databox($databox_id); try { @@ -562,7 +601,7 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($request, $this); - $usr_id = $session = $this->appbox->get_session()->get_usr_id(); + $usr_id = $session = $this->appbox->get_session()->get_usr_id(); $result->set_datas(array('baskets' => $this->list_baskets($usr_id))); @@ -577,16 +616,16 @@ class API_V1_adapter extends API_V1_Abstract */ protected function list_baskets($usr_id) { - $basket_coll = new basketCollection($this->appbox, $usr_id); + $em = $this->core->getEntityManager(); + $repo = $em->getRepository('\Entities\Basket'); + /* @var $repo \Repositories\BasketRepository */ + + $baskets = $repo->findActiveByUser($this->core->getAuthenticatedUser()); $ret = array(); - foreach ($basket_coll->get_baskets() as $basktype => $baskets) + foreach ($baskets as $basket) { - if (!in_array($basktype, array('recept', 'baskets'))) - continue; - - foreach ($baskets as $basket) - $ret[$basket->get_ssel_id()] = $this->list_basket($basket); + $ret[$basket->getId()] = $this->list_basket($basket); } return $ret; @@ -607,10 +646,18 @@ class API_V1_adapter extends API_V1_Abstract if (trim(strip_tags($name)) === '') throw new API_V1_exception_badrequest (); - $user = User_Adapter::getInstance($this->appbox->get_session()->get_usr_id(), $this->appbox); - $basket = basket_adapter::create($this->appbox, $name, $user); + $user = $this->core->getAuthenticatedUser(); + + $Basket = new \Entities\Basket(); + $Basket->setOwner($user); + $Basket->setName($name); + + $em = $this->core->getEntityManager(); + $em->persist($Basket); + $em->flush(); + $ret = array(); - $ret[$basket->get_ssel_id()] = $this->list_basket($basket); + $ret[$Basket->getId()] = $this->list_basket($Basket); $result->set_datas(array("basket" => $ret)); return $result; @@ -627,12 +674,15 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($request, $this); - $basket = basket_adapter::getInstance( - $this->appbox - , $basket_id - , $this->appbox->get_session()->get_usr_id() - ); - $basket->delete(); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser(), true); + $em->remove($Basket); + $em->flush(); return $this->search_baskets($request); } @@ -647,21 +697,21 @@ class API_V1_adapter extends API_V1_Abstract public function get_basket(Request $request, $basket_id) { $result = new API_V1_result($request, $this); - try - { - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $result->set_datas( - array("basket_elements" => - array( - $basket->get_ssel_id() => $this->list_basket_content($basket) - ) - ) - ); - } - catch (Exception $e) - { - } + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser(), false); + + $result->set_datas( + array("basket_elements" => + array( + $Basket->getId() => $this->list_basket_content($Basket) + ) + ) + ); return $result; } @@ -669,16 +719,18 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve elements of one basket * - * @param basket_adapter $basket + * @param \Entities\Basket $Basket * @return type */ - protected function list_basket_content(basket_adapter $basket) + protected function list_basket_content(\Entities\Basket $Basket) { - $ret = $this->list_basket($basket); + $ret = $this->list_basket($Basket); + $ret['basket_elements'] = array(); - foreach ($basket->get_elements() as $basket_element) + + foreach ($Basket->getElements() as $basket_element) { - $ret['basket_elements'][$basket_element->get_sselcont_id()] = $this->list_basket_element($basket_element); + $ret['basket_elements'][$basket_element->getId()] = $this->list_basket_element($basket_element); } return $ret; @@ -687,23 +739,46 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve detailled informations about a basket element * - * @param basket_element_adapter $basket_element + * @param \Entities\BasketElement $basket_element * @return type */ - protected function list_basket_element(basket_element_adapter $basket_element) + protected function list_basket_element(\Entities\BasketElement $basket_element) { $ret = array( - 'basket_element_id' => $basket_element->get_sselcont_id() - , 'order' => $basket_element->get_order() - , 'record' => $this->list_record($basket_element->get_record()) - , 'validation_item' => $basket_element->is_validation_item() + 'basket_element_id' => $basket_element->getId() + , 'order' => $basket_element->getOrd() + , 'record' => $this->list_record($basket_element->getRecord()) + , 'validation_item' => !!$basket_element->getValidationDatas() ); - if ($basket_element->is_validation_item()) + if ($basket_element->getValidationDatas()) { - $ret['choices'] = $basket_element->get_choices(); - $ret['agreement'] = $basket_element->get_my_agreement(); - $ret['note'] = $basket_element->get_my_note(); + $choices = array(); + $agreement = $note = null; + + foreach ($basket_element->getValidationDatas() as $validation_datas) + { + $user = $validation_datas->getParticipant()->getUser(); + /* @var $validation_datas Entities\ValidationData */ + $choices[$user->get_id()] = array( + 'usr_id' => $user->get_id(), + 'usr_name' => $user->get_display_name(), + 'is_mine' => $user->get_id() == $this->core->getAuthenticatedUser()->get_id(), + 'agreement' => $validation_datas->getAgreement(), + 'updated_on' => $validation_datas->getUpdated()->format(DATE_ATOM), + 'note' => $validation_datas->getNote() + ); + + if ($user->get_id() == $this->core->getAuthenticatedUser()->get_id()) + { + $agreement = $validation_datas->getAgreement(); + $note = $validation_datas->getNote(); + } + } + + $ret['choices'] = $choices(); + $ret['agreement'] = $agreement(); + $ret['note'] = $note(); } return $ret; @@ -721,14 +796,25 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $name = $request->get('name'); - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $basket->set_name($name); + + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser(), true); + $Basket->setName($name); + + $em->merge($Basket); + $em->flush(); + $result->set_datas( - array( - "basket" => - array($basket->get_ssel_id() => $this->list_basket_content($basket) - ) - ) + array( + "basket" => + array($Basket->getId() => $this->list_basket_content($Basket) + ) + ) ); return $result; @@ -746,14 +832,25 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $desc = $request->get('description'); - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $basket->set_description($desc); + + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser(), true); + $Basket->setDescription($desc); + + $em->merge($Basket); + $em->flush(); + $result->set_datas( - array( - "basket" => - array($basket->get_ssel_id() => $this->list_basket_content($basket) - ) - ) + array( + "basket" => + array($Basket->getId() => $this->list_basket_content($Basket) + ) + ) ); return $result; @@ -809,15 +906,15 @@ class API_V1_adapter extends API_V1_Abstract $feed = Feed_Adapter::load_with_user($this->appbox, $user, $publication_id); $offset_start = (int) ($request->get('offset_start') ? : 0); - $per_page = (int) ($request->get('per_page') ? : 5); + $per_page = (int) ($request->get('per_page') ? : 5); $per_page = (($per_page >= 1) && ($per_page <= 20)) ? $per_page : 5; $datas = array( - 'feed' => $this->list_publication($feed, $user) - , 'offset_start' => $offset_start - , 'per_page' => $per_page - , 'entries' => $this->list_publications_entries($feed, $offset_start, $per_page) + 'feed' => $this->list_publication($feed, $user) + , 'offset_start' => $offset_start + , 'per_page' => $per_page + , 'entries' => $this->list_publications_entries($feed, $offset_start, $per_page) ); $result->set_datas($datas); @@ -835,15 +932,15 @@ class API_V1_adapter extends API_V1_Abstract protected function list_publication(Feed_Adapter $feed, $user) { return array( - 'id' => $feed->get_id() - , 'title' => $feed->get_title() - , 'subtitle' => $feed->get_subtitle() - , 'total_entries' => $feed->get_count_total_entries() - , 'icon' => $feed->get_icon_url() - , 'public' => $feed->is_public() - , 'is_mine' => $feed->is_owner($user) - , 'created_on' => $feed->get_created_on()->format(DATE_ATOM) - , 'updated_on' => $feed->get_updated_on()->format(DATE_ATOM) + 'id' => $feed->get_id() + , 'title' => $feed->get_title() + , 'subtitle' => $feed->get_subtitle() + , 'total_entries' => $feed->get_count_total_entries() + , 'icon' => $feed->get_icon_url() + , 'public' => $feed->is_public() + , 'is_mine' => $feed->is_owner($user) + , 'created_on' => $feed->get_created_on()->format(DATE_ATOM) + , 'updated_on' => $feed->get_updated_on()->format(DATE_ATOM) ); } @@ -867,8 +964,8 @@ class API_V1_adapter extends API_V1_Abstract } return array( - 'offset_start' => $offset_start - , 'entries' => $out + 'offset_start' => $offset_start + , 'entries' => $out ); } @@ -887,13 +984,13 @@ class API_V1_adapter extends API_V1_Abstract } return array( - 'author_email' => $entry->get_author_email() - , 'author_name' => $entry->get_author_name() - , 'created_on' => $entry->get_created_on()->format(DATE_ATOM) - , 'updated_on' => $entry->get_updated_on()->format(DATE_ATOM) - , 'title' => $entry->get_title() - , 'subtitle' => $entry->get_subtitle() - , 'items' => $items + 'author_email' => $entry->get_author_email() + , 'author_name' => $entry->get_author_name() + , 'created_on' => $entry->get_created_on()->format(DATE_ATOM) + , 'updated_on' => $entry->get_updated_on()->format(DATE_ATOM) + , 'title' => $entry->get_title() + , 'subtitle' => $entry->get_subtitle() + , 'items' => $items ); } @@ -906,8 +1003,8 @@ class API_V1_adapter extends API_V1_Abstract protected function list_publication_entry_item(Feed_Entry_Item $item) { $datas = array( - 'item_id' => $item->get_id() - , 'record' => $this->list_record($item->get_record()) + 'item_id' => $item->get_id() + , 'record' => $this->list_record($item->get_record()) ); return $datas; @@ -955,12 +1052,12 @@ class API_V1_adapter extends API_V1_Abstract $permalink = null; return array( - 'permalink' => $permalink - , 'height' => $media->get_height() - , 'width' => $media->get_width() - , 'filesize' => $media->get_size() - , 'player_type' => $media->get_type() - , 'mime_type' => $media->get_mime() + 'permalink' => $permalink + , 'height' => $media->get_height() + , 'width' => $media->get_width() + , 'filesize' => $media->get_size() + , 'player_type' => $media->get_type() + , 'mime_type' => $media->get_mime() ); } @@ -974,13 +1071,13 @@ class API_V1_adapter extends API_V1_Abstract protected function list_permalink(media_Permalink_Adapter &$permalink, registryInterface &$registry) { return array( - 'created_on' => $permalink->get_created_on()->format(DATE_ATOM) - , 'id' => $permalink->get_id() - , 'is_activated' => $permalink->get_is_activated() - , 'label' => $permalink->get_label() - , 'last_modified' => $permalink->get_last_modified()->format(DATE_ATOM) - , 'page_url' => $permalink->get_page($registry) - , 'url' => $permalink->get_url($registry) + 'created_on' => $permalink->get_created_on()->format(DATE_ATOM) + , 'id' => $permalink->get_id() + , 'is_activated' => $permalink->get_is_activated() + , 'label' => $permalink->get_label() + , 'last_modified' => $permalink->get_last_modified()->format(DATE_ATOM) + , 'page_url' => $permalink->get_page($registry) + , 'url' => $permalink->get_url($registry) ); } @@ -994,10 +1091,10 @@ class API_V1_adapter extends API_V1_Abstract protected function list_record_status(databox $databox, $status) { $status = strrev($status); - $ret = array(); + $ret = array(); foreach ($databox->get_statusbits() as $bit => $status_datas) { - $ret[$bit] = array('bit' => $bit, 'state' => !!substr($status, ($bit - 1), 1)); + $ret[$bit] = array('bit' => $bit, 'state' => !!substr($status, ($bit - 1), 1)); } return $ret; @@ -1014,7 +1111,10 @@ class API_V1_adapter extends API_V1_Abstract $ret = array(); foreach ($caption->get_fields() as $field) { - $ret[$field->get_meta_id()] = $this->list_record_caption_field($field); + foreach ($field->get_values() as $value) + { + $ret[$value->getId()] = $this->list_record_caption_field($value, $field); + } } return $ret; @@ -1026,7 +1126,7 @@ class API_V1_adapter extends API_V1_Abstract * @param caption_field $field * @return array */ - protected function list_record_caption_field(caption_field $field) + protected function list_record_caption_field(caption_Field_Value $value, caption_field $field) { /** * @todo ajouter une option pour avoir les values serialisées @@ -1034,42 +1134,65 @@ class API_V1_adapter extends API_V1_Abstract */ return array( - 'meta_id' => $field->get_meta_id() - , 'meta_structure_id' => $field->get_meta_struct_id() - , 'name' => $field->get_name() - , 'value' => $field->get_value() + 'meta_id' => $value->getId() + , 'meta_structure_id' => $field->get_meta_struct_id() + , 'name' => $field->get_name() + , 'value' => $value->getValue() ); } /** * Retirve information about one basket * - * @param basket_adapter $basket + * @param \Entities\Basket $basket * @return array */ - protected function list_basket(basket_adapter $basket) + protected function list_basket(\Entities\Basket $basket) { $ret = array( - 'created_on' => $basket->get_create_date()->format(DATE_ATOM) - , 'description' => $basket->get_description() - , 'name' => $basket->get_name() - , 'pusher_usr_id' => $basket->get_pusher() ? $basket->get_pusher()->get_id() : null - , 'ssel_id' => $basket->get_ssel_id() - , 'updated_on' => $basket->get_update_date()->format(DATE_ATOM) - , 'unread' => $basket->is_unread() + 'created_on' => $basket->getCreated()->format(DATE_ATOM) + , 'description' => (string) $basket->getDescription() + , 'name' => $basket->getName() + , 'pusher_usr_id' => $basket->getPusherId() + , 'ssel_id' => $basket->getId() + , 'updated_on' => $basket->getUpdated()->format(DATE_ATOM) + , 'unread' => !$basket->getIsRead() ); - if ($basket->is_valid()) + if ($basket->getValidation()) { + $users = array(); + + foreach ($basket->getValidation()->getParticipants() as $participant) + { + /* @var $participant \Entities\ValidationParticipant */ + $user = $participant->getUser(); + + $users[$user->get_id()] = array( + 'usr_id' => $user->get_id(), + 'usr_name' => $user->get_display_name(), + 'confirmed' => $participant->getIsConfirmed(), + 'can_agree' => $participant->getCanAgree(), + 'can_see_others' => $participant->getCanSeeOthers() + ); + } + + $expires_on_atom = $basket->getValidation()->getExpires(); + + if ($expires_on_atom instanceof DateTime) + $expires_on_atom = $expires_on_atom->format(DATE_ATOM); + + $user = \User_Adapter::getInstance($this->appbox->get_session()->get_usr_id(), $this->appbox); + $ret = array_merge( - array( - 'validation_users' => $basket->get_validating_users() - , 'validation_end_date' => ($basket->get_validation_end_date() instanceof DateTime ? $basket->get_validation_end_date()->format(DATE_ATOM) : null) - , 'validation_infos' => $basket->get_validation_infos() - , 'validation_confirmed' => $basket->is_confirmed() - , 'mine' => $basket->is_mine() - ) - , $ret + array( + 'validation_users' => $users + , 'validation_end_date' => $expires_on_atom + , 'validation_infos' => $basket->getValidation()->getValidationString($user) + , 'validation_confirmed' => $basket->getValidation()->getParticipant($user)->getIsConfirmed() + , 'mine' => $basket->getValidation()->isInitiator($user) + ) + , $ret ); } @@ -1085,21 +1208,21 @@ class API_V1_adapter extends API_V1_Abstract protected function list_record(record_adapter $record) { return array( - 'databox_id' => $record->get_sbas_id() - , 'record_id' => $record->get_record_id() - , 'mime_type' => $record->get_mime() - , 'title' => $record->get_title() - , 'original_name' => $record->get_original_name() - , 'last_modification' => $record->get_modification_date()->format(DATE_ATOM) - , 'created_on' => $record->get_creation_date()->format(DATE_ATOM) - , 'collection_id' => phrasea::collFromBas($record->get_base_id()) - , 'sha256' => $record->get_sha256() - , 'thumbnail' => $this->list_embedable_media( - $record->get_thumbnail(), registry::get_instance() - ) - , 'technical_informations' => $record->get_technical_infos() - , 'phrasea_type' => $record->get_type() - , 'uuid' => $record->get_uuid() + 'databox_id' => $record->get_sbas_id() + , 'record_id' => $record->get_record_id() + , 'mime_type' => $record->get_mime() + , 'title' => $record->get_title() + , 'original_name' => $record->get_original_name() + , 'last_modification' => $record->get_modification_date()->format(DATE_ATOM) + , 'created_on' => $record->get_creation_date()->format(DATE_ATOM) + , 'collection_id' => phrasea::collFromBas($record->get_base_id()) + , 'sha256' => $record->get_sha256() + , 'thumbnail' => $this->list_embedable_media( + $record->get_thumbnail(), registry::get_instance() + ) + , 'technical_informations' => $record->get_technical_infos() + , 'phrasea_type' => $record->get_type() + , 'uuid' => $record->get_uuid() ); } @@ -1130,7 +1253,7 @@ class API_V1_adapter extends API_V1_Abstract $ret = array(); foreach ($databox->get_cgus() as $locale => $array_terms) { - $ret[$locale] = array('locale' => $locale, 'terms' => $array_terms['value']); + $ret[$locale] = array('locale' => $locale, 'terms' => $array_terms['value']); } return $ret; @@ -1146,8 +1269,8 @@ class API_V1_adapter extends API_V1_Abstract $ret = array(); $ret['databox_id'] = $databox->get_sbas_id(); - $ret['name'] = $databox->get_viewname(); - $ret['version'] = $databox->get_version(); + $ret['name'] = $databox->get_viewname(); + $ret['version'] = $databox->get_version(); return $ret; } @@ -1179,10 +1302,10 @@ class API_V1_adapter extends API_V1_Abstract protected function list_collection(collection $collection) { $ret = array( - 'base_id' => $collection->get_base_id() - , 'coll_id' => $collection->get_coll_id() - , 'name' => $collection->get_name() - , 'record_amount' => $collection->get_record_amount() + 'base_id' => $collection->get_base_id() + , 'coll_id' => $collection->get_coll_id() + , 'name' => $collection->get_name() + , 'record_amount' => $collection->get_record_amount() ); return $ret; @@ -1200,13 +1323,13 @@ class API_V1_adapter extends API_V1_Abstract foreach ($status as $n => $datas) { $ret[$n] = array( - 'bit' => $n - , 'label_on' => $datas['labelon'] - , 'label_off' => $datas['labeloff'] - , 'img_on' => $datas['img_on'] - , 'img_off' => $datas['img_off'] - , 'searchable' => $datas['searchable'] - , 'printable' => $datas['printable'] + 'bit' => $n + , 'label_on' => $datas['labelon'] + , 'label_off' => $datas['labeloff'] + , 'img_on' => $datas['img_on'] + , 'img_off' => $datas['img_off'] + , 'searchable' => $datas['searchable'] + , 'printable' => $datas['printable'] ); } @@ -1239,18 +1362,18 @@ class API_V1_adapter extends API_V1_Abstract protected function list_databox_metadata_field_properties(databox_field $databox_field) { $ret = array( - 'id' => $databox_field->get_id() - , 'namespace' => $databox_field->get_metadata_namespace() - , 'source' => $databox_field->get_metadata_source() - , 'tagname' => $databox_field->get_metadata_tagname() - , 'name' => $databox_field->get_name() - , 'separator' => $databox_field->get_separator() - , 'thesaurus_branch' => $databox_field->get_tbranch() - , 'type' => $databox_field->get_type() - , 'indexable' => $databox_field->is_indexable() - , 'multivalue' => $databox_field->is_multi() - , 'readonly' => $databox_field->is_readonly() - , 'required' => $databox_field->is_required() + 'id' => $databox_field->get_id() + , 'namespace' => $databox_field->get_metadata_namespace() + , 'source' => $databox_field->get_metadata_source() + , 'tagname' => $databox_field->get_metadata_tagname() + , 'name' => $databox_field->get_name() + , 'separator' => $databox_field->get_separator() + , 'thesaurus_branch' => $databox_field->get_tbranch() + , 'type' => $databox_field->get_type() + , 'indexable' => $databox_field->is_indexable() + , 'multivalue' => $databox_field->is_multi() + , 'readonly' => $databox_field->is_readonly() + , 'required' => $databox_field->is_required() ); return $ret; diff --git a/lib/classes/API/V1/result.class.php b/lib/classes/API/V1/result.class.php index cf8f410e83..4469c26413 100644 --- a/lib/classes/API/V1/result.class.php +++ b/lib/classes/API/V1/result.class.php @@ -1,6 +1,6 @@ $response['refresh_token'], 'auth_token' => $response['access_token']); } diff --git a/lib/classes/Bridge/Api/Dailymotion.class.php b/lib/classes/Bridge/Api/Dailymotion.class.php index 8cbc9fdfb8..57a916af15 100644 --- a/lib/classes/Bridge/Api/Dailymotion.class.php +++ b/lib/classes/Bridge/Api/Dailymotion.class.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__) . "/../../../classes/DailymotionWithoutOauth2.php"; +require_once __DIR__ . "/../../../classes/DailymotionWithoutOauth2.php"; use \Symfony\Component\HttpFoundation\Request; diff --git a/lib/classes/Bridge/Api/Dailymotion/Container.class.php b/lib/classes/Bridge/Api/Dailymotion/Container.class.php index 99f23fc1d5..d40265c2ec 100644 --- a/lib/classes/Bridge/Api/Dailymotion/Container.class.php +++ b/lib/classes/Bridge/Api/Dailymotion/Container.class.php @@ -131,4 +131,18 @@ class Bridge_Api_Dailymotion_Container implements Bridge_Api_ContainerInterface return $this->url; } + public function get_duration() + { + return ''; + } + + public function get_category() + { + return ''; + } + + public function is_private() + { + return null; + } } diff --git a/lib/classes/Bridge/Api/Flickr.class.php b/lib/classes/Bridge/Api/Flickr.class.php index 47f1484f03..f99aa1fb25 100644 --- a/lib/classes/Bridge/Api/Flickr.class.php +++ b/lib/classes/Bridge/Api/Flickr.class.php @@ -9,13 +9,18 @@ * file that was distributed with this source code. */ -$new_include_path = dirname(__FILE__) . "/../../../vendor/" . PATH_SEPARATOR . get_include_path(); -set_include_path($new_include_path); + +$include_path = realpath(__DIR__ . '/../../../vendor'); +if (strpos(get_include_path(), $include_path . ':') === false) +{ + $new_include_path = $include_path . PATH_SEPARATOR . get_include_path(); + set_include_path($new_include_path); +} use \Symfony\Component\HttpFoundation\Request; -require_once dirname(__FILE__) . "/../../../vendor/Phlickr/Api.php"; -require_once dirname(__FILE__) . "/../../../vendor/Phlickr/Uploader.php"; +require_once __DIR__ . "/../../../vendor/Phlickr/Api.php"; +require_once __DIR__ . "/../../../vendor/Phlickr/Uploader.php"; /** * @@ -38,14 +43,14 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf */ protected $registry; - const ELEMENT_TYPE_PHOTO = 'photo'; - const CONTAINER_TYPE_PHOTOSET = 'photoset'; - const AUTH_TYPE = 'Flickr'; - const AUTH_PHOTO_SIZE = 15728640; //15 mo - const UPLOAD_STATE_DONE = 'done'; - const UPLOAD_STATE_FAILED = 'failed'; + const ELEMENT_TYPE_PHOTO = 'photo'; + const CONTAINER_TYPE_PHOTOSET = 'photoset'; + const AUTH_TYPE = 'Flickr'; + const AUTH_PHOTO_SIZE = 15728640; //15 mo + const UPLOAD_STATE_DONE = 'done'; + const UPLOAD_STATE_FAILED = 'failed'; const UPLOAD_STATE_FAILED_CONVERTING = 'failed_converting'; - const UPLOAD_STATE_NOT_COMPLETED = 'not_completed'; + const UPLOAD_STATE_NOT_COMPLETED = 'not_completed'; /** * @@ -178,7 +183,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf switch ($object) { case self::ELEMENT_TYPE_PHOTO: - $params = array('photo_id' => $element_id); + $params = array('photo_id' => $element_id); $th_response = $this->_api->executeMethod('flickr.photos.getInfo', $params); if (!$th_response->isOk()) @@ -209,12 +214,12 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf case self::CONTAINER_TYPE_PHOTOSET: $params = array('photoset_id' => $element_id); - $response = $this->_api->executeMethod('flickr.photoset.getInfo', $params); + $response = $this->_api->executeMethod('flickr.photoset.getInfo', $params); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve photoset infos for ' . $object); - $xml = $response->getXml(); + $xml = $response->getXml(); $primary_photo = $this->get_element_from_id((string) $child['primary'], self::ELEMENT_TYPE_PHOTO); return new Bridge_Api_Flickr_Container($xml, $this->get_user_id(), $type, $primary_photo->get_thumbnail()); @@ -241,20 +246,20 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf $params = array(); if ($quantity) $params['per_page'] = $quantity; - $params['page'] = $quantity != 0 ? floor($offset_start / $quantity) + 1 : 1; - $params['user_id'] = $user_id = $this->get_user_id(); - $response = $this->_api->executeMethod('flickr.photosets.getList', $params); + $params['page'] = $quantity != 0 ? floor($offset_start / $quantity) + 1 : 1; + $params['user_id'] = $user_id = $this->get_user_id(); + $response = $this->_api->executeMethod('flickr.photosets.getList', $params); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve container list ' . $object); $photosets = new Bridge_Api_ContainerCollection(); - $xml = $response->getXml(); + $xml = $response->getXml(); $photosets->set_current_page((int) $xml->photosets['page']) - ->set_items_per_page((int) $xml->photosets['perpage']) - ->set_total_items((int) $xml->photosets['total']) - ->set_total_page((int) $xml->photosets['pages']); + ->set_items_per_page((int) $xml->photosets['perpage']) + ->set_total_items((int) $xml->photosets['total']) + ->set_total_page((int) $xml->photosets['pages']); foreach ($xml->photosets->children() as $child) { @@ -288,9 +293,9 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf } $params = array( - 'title' => $datas["title"] - , 'photo_id' => $object_id - , 'description' => $datas["description"] + 'title' => $datas["title"] + , 'photo_id' => $object_id + , 'description' => $datas["description"] ); switch ($object) @@ -326,9 +331,9 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf throw new Bridge_Exception_ActionMandatoryField('You must define a default photo for the photoset'); $params = array( - 'title' => $request->get('title') - , 'primary_photo_id' => $pid - , 'description' => $request->get('description') + 'title' => $request->get('title') + , 'primary_photo_id' => $pid + , 'description' => $request->get('description') ); $response = $this->_api->executeMethod('flickr.photosets.create', $params); @@ -337,9 +342,9 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf throw new Bridge_Exception_ApiConnectorRequestFailed(); $user_id = $this->get_user_id(); - $xml = $response->getXml(); + $xml = $response->getXml(); - $photoset = $xml->photoset; + $photoset = $xml->photoset; $primary_photo = $this->get_element_from_id($pid, self::ELEMENT_TYPE_PHOTO); return new Bridge_Api_Flickr_Container($photoset, $user_id, $container_type, $primary_photo->get_thumbnail()); @@ -366,8 +371,8 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf switch ($destination) { case self::CONTAINER_TYPE_PHOTOSET: - $params = array('photo_id' => $element_id, 'photoset_id' => $container_id); - $response = $this->_api->executeMethod('flickr.photosets.addPhoto', $params); + $params = array('photo_id' => $element_id, 'photoset_id' => $container_id); + $response = $this->_api->executeMethod('flickr.photosets.addPhoto', $params); if (!$response->isOk()) { @@ -402,16 +407,16 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf { case self::ELEMENT_TYPE_PHOTO: $response = $this->_api->executeMethod( - 'flickr.photos.delete' - , array('photo_id' => $object_id) + 'flickr.photos.delete' + , array('photo_id' => $object_id) ); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed(); break; case self::CONTAINER_TYPE_PHOTOSET: - $response = $this->_api->executeMethod( - 'flickr.photosets.delete' - , array('photoset_id' => $object_id) + $response = $this->_api->executeMethod( + 'flickr.photosets.delete' + , array('photoset_id' => $object_id) ); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed(); @@ -439,25 +444,25 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf $params = array(); //info to display during search $extras = array( - 'description' - , 'license' - , 'date_upload' - , 'date_taken' - , 'owner_name' - , 'last_update' - , 'tags' - , 'views' - , 'url_sq' - , 'url_t' + 'description' + , 'license' + , 'date_upload' + , 'date_taken' + , 'owner_name' + , 'last_update' + , 'tags' + , 'views' + , 'url_sq' + , 'url_t' ); $params['user_id'] = $this->get_user_id(); - $params['extras'] = implode(",", $extras); + $params['extras'] = implode(",", $extras); if ($quantity) $params['per_page'] = $quantity; - $params['page'] = $quantity != 0 ? floor($offset_start / $quantity) + 1 : 1; - $response = $this->_api->executeMethod('flickr.photos.search', $params); + $params['page'] = $quantity != 0 ? floor($offset_start / $quantity) + 1 : 1; + $response = $this->_api->executeMethod('flickr.photos.search', $params); $photos = new Bridge_Api_ElementCollection(); @@ -465,9 +470,9 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve element list ' . $type); $xml = $response->getXml(); $photos->set_current_page((int) $xml->photos['page']) - ->set_items_per_page((int) $xml->photos['perpage']) - ->set_total_items((int) $xml->photos['total']) - ->set_total_page((int) $xml->photos['pages']); + ->set_items_per_page((int) $xml->photos['perpage']) + ->set_total_items((int) $xml->photos['total']) + ->set_total_page((int) $xml->photos['pages']); foreach ($xml->photos->children() as $child) { $photos->add_element(new Bridge_Api_Flickr_Element($child, $params['user_id'], $type)); @@ -542,7 +547,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf $privacy = $this->get_default_privacy(); $uploader->setPerms($privacy['public'], $privacy['friends'], $privacy['family']); - $type = $record->get_type() == 'image' ? self::ELEMENT_TYPE_PHOTO : $record->get_type(); + $type = $record->get_type() == 'image' ? self::ELEMENT_TYPE_PHOTO : $record->get_type(); switch ($type) { case self::ELEMENT_TYPE_PHOTO : @@ -561,43 +566,43 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf public function acceptable_records() { return function (record_adapter &$record) - { - return in_array($record->get_type(), array('image')); - }; + { + return in_array($record->get_type(), array('image')); + }; } protected function get_default_privacy() { - $privacy = null; + $privacy = null; $response = $this->_api->executeMethod('flickr.prefs.getPrivacy'); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve default privacy settings'); - $xml = $response->getXml(); - $privacy = (string) $xml->person['privacy']; + $xml = $response->getXml(); + $privacy = (string) $xml->person['privacy']; switch ($privacy) { case '1': default: - $public = true; - $friends = $family = false; + $public = true; + $friends = $family = false; break; case '2': $friends = true; - $public = $family = false; + $public = $family = false; break; case '3': - $family = true; - $public = $friends = false; + $family = true; + $public = $friends = false; break; case '4': - $friends = $family = true; - $public = false; + $friends = $family = true; + $public = false; break; case '5': - $family = $friends = $public = false; + $family = $friends = $public = false; break; } - $ret = array('friends' => $friends, 'family' => $family, 'public' => $public); + $ret = array('friends' => $friends, 'family' => $family, 'public' => $public); return $ret; } @@ -680,8 +685,8 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf protected function initialize_transport() { $this->_api = new Phlickr_Api( - $this->registry->get('GV_flickr_client_id'), - $this->registry->get('GV_flickr_client_secret') + $this->registry->get('GV_flickr_client_id'), + $this->registry->get('GV_flickr_client_secret') ); return $this; @@ -709,11 +714,11 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf protected function set_auth_params() { $this->_auth->set_parameters( - array( - 'flickr_client_id' => $this->registry->get('GV_flickr_client_id') - , 'flickr_client_secret' => $this->registry->get('GV_flickr_client_secret') - , 'permissions' => 'delete' - ) + array( + 'flickr_client_id' => $this->registry->get('GV_flickr_client_id') + , 'flickr_client_secret' => $this->registry->get('GV_flickr_client_secret') + , 'permissions' => 'delete' + ) ); return $this; @@ -728,24 +733,24 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf public function check_upload_constraints(array $datas, record_adapter $record) { $errors = $this->check_record_constraints($record); - $check = function($field) use (&$errors, $datas, $record) - { - $key = $record->get_serialize_key(); - $name = $field['name']; - $length = (int) $field['length']; - $required = !!$field['required']; + $check = function($field) use (&$errors, $datas, $record) + { + $key = $record->get_serialize_key(); + $name = $field['name']; + $length = (int) $field['length']; + $required = !!$field['required']; - if (!isset($datas[$name]) || trim($datas[$name]) === '') - { - if ($required) - $errors[$name . '_' . $key] = _("Ce champ est obligatoire"); - } - elseif ($length !== 0) - { - if (mb_strlen($datas[$name]) > $length) - $errors[$name . '_' . $key] = sprintf(_("Ce champ est trop long %s caracteres max"), $length); - } - }; + if (!isset($datas[$name]) || trim($datas[$name]) === '') + { + if ($required) + $errors[$name . '_' . $key] = _("Ce champ est obligatoire"); + } + elseif ($length !== 0) + { + if (mb_strlen($datas[$name]) > $length) + $errors[$name . '_' . $key] = sprintf(_("Ce champ est trop long %s caracteres max"), $length); + } + }; array_map($check, $this->get_fields()); @@ -756,22 +761,22 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf { $errors = array(); $check = function($field) use (&$errors, $datas) - { - $name = $field['name']; - $length = (int) $field['length']; - $required = !!$field['required']; + { + $name = $field['name']; + $length = (int) $field['length']; + $required = !!$field['required']; - if (!isset($datas[$name]) || trim($datas[$name]) === '') - { - if ($required) - $errors[$name] = _("Ce champ est obligatoire"); - } - elseif ($length !== 0) - { - if (mb_strlen($datas[$name]) > $length) - $errors[$name] = sprintf(_("Ce champ est trop long %s caracteres max"), $length); - } - }; + if (!isset($datas[$name]) || trim($datas[$name]) === '') + { + if ($required) + $errors[$name] = _("Ce champ est obligatoire"); + } + elseif ($length !== 0) + { + if (mb_strlen($datas[$name]) > $length) + $errors[$name] = sprintf(_("Ce champ est trop long %s caracteres max"), $length); + } + }; array_map($check, $this->get_fields()); @@ -786,8 +791,8 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf public function get_update_datas(Request $request) { $datas = array( - 'title' => $request->get('modif_title', ''), - 'description' => $request->get('modif_description', '') + 'title' => $request->get('modif_title', ''), + 'description' => $request->get('modif_description', '') ); return $datas; @@ -800,13 +805,13 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf */ public function get_upload_datas(Request $request, record_adapter $record) { - $key = $record->get_serialize_key(); + $key = $record->get_serialize_key(); $datas = array( - 'title' => $request->get('title_' . $key), - 'description' => $request->get('description_' . $key), - 'category' => $request->get('category_' . $key), - 'tags' => $request->get('tags_' . $key), - 'privacy' => $request->get('privacy_' . $key), + 'title' => $request->get('title_' . $key), + 'description' => $request->get('description_' . $key), + 'category' => $request->get('category_' . $key), + 'tags' => $request->get('tags_' . $key), + 'privacy' => $request->get('privacy_' . $key), ); return $datas; @@ -828,21 +833,21 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf private function get_fields() { return array( - array( - 'name' => 'title', - 'length' => '100', - 'required' => true - ) - , array( - 'name' => 'description', - 'length' => '500', - 'required' => false - ) - , array( - 'name' => 'tags', - 'length' => '200', - 'required' => false - ) + array( + 'name' => 'title', + 'length' => '100', + 'required' => true + ) + , array( + 'name' => 'description', + 'length' => '500', + 'required' => false + ) + , array( + 'name' => 'tags', + 'length' => '200', + 'required' => false + ) ); } @@ -857,21 +862,21 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf if (!$record->get_hd_file() instanceof SplFileObject) $errors["file_size"] = _("Le record n'a pas de fichier physique"); //Record must rely on real file if ($record->get_technical_infos('size') > self::AUTH_PHOTO_SIZE) - $errors["size"] = sprintf(_("Le poids maximum d'un fichier est de %s"), p4string::format_octets(self::AUTH_PHOTO_SIZE)); + $errors["size"] = sprintf(_("Le poids maximum d'un fichier est de %s"), p4string::format_octets(self::AUTH_PHOTO_SIZE)); return $errors; } private function checkTicket($ticketsId, $type) { - $return = array("status" => self::UPLOAD_STATE_FAILED, "dist_id" => null); + $return = array("status" => self::UPLOAD_STATE_FAILED, "dist_id" => null); $response = $this->_api->executeMethod("flickr.photos.upload.checkTickets", array("tickets" => $ticketsId)); if (!$response->isOk()) throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve element list ' . $type); - $xml = $response->getXml(); + $xml = $response->getXml(); $complete = isset($xml->uploader->ticket["complete"]) ? (string) $xml->uploader->ticket["complete"] : null; - $invalid = isset($xml->uploader->ticket["invalid"]) ? (string) $xml->uploader->ticket["invalid"] : null; + $invalid = isset($xml->uploader->ticket["invalid"]) ? (string) $xml->uploader->ticket["invalid"] : null; if ($complete) { @@ -882,7 +887,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf else { $return["dist_id"] = (string) $xml->uploader->ticket["photoid"]; - $return["status"] = self::UPLOAD_STATE_DONE; + $return["status"] = self::UPLOAD_STATE_DONE; } } diff --git a/lib/classes/Bridge/Api/Flickr/Container.class.php b/lib/classes/Bridge/Api/Flickr/Container.class.php index 20f2954f97..b542d58058 100644 --- a/lib/classes/Bridge/Api/Flickr/Container.class.php +++ b/lib/classes/Bridge/Api/Flickr/Container.class.php @@ -138,4 +138,19 @@ class Bridge_Api_Flickr_Container implements Bridge_Api_ContainerInterface return $this->type; } + + public function get_duration() + { + return ''; + } + + public function get_category() + { + return ''; + } + + public function is_private() + { + return null; + } } diff --git a/lib/classes/Bridge/Api/Flickr/Element.class.php b/lib/classes/Bridge/Api/Flickr/Element.class.php index 241f6397f2..a62874740d 100644 --- a/lib/classes/Bridge/Api/Flickr/Element.class.php +++ b/lib/classes/Bridge/Api/Flickr/Element.class.php @@ -210,7 +210,7 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface */ public function get_category() { - return null; + return ''; } /** @@ -219,7 +219,7 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface */ public function get_duration() { - return null; + return ''; } /** @@ -279,5 +279,4 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface { return $this->entry["tags"]; } - } diff --git a/lib/classes/Bridge/Api/Youtube.class.php b/lib/classes/Bridge/Api/Youtube.class.php index 7d0629d09e..2d2484cfdf 100644 --- a/lib/classes/Bridge/Api/Youtube.class.php +++ b/lib/classes/Bridge/Api/Youtube.class.php @@ -9,8 +9,12 @@ * file that was distributed with this source code. */ -$new_include_path = dirname(__FILE__) . '/../../../vendor/gdata/' . PATH_SEPARATOR . get_include_path(); -set_include_path($new_include_path); +$include_path = realpath(__DIR__ . '/../../../vendor/gdata/'); +if(strpos(get_include_path(), $include_path) === false) +{ + $new_include_path = $include_path . PATH_SEPARATOR . get_include_path(); + set_include_path($new_include_path); +} require_once('Zend/Loader.php'); Zend_Loader::loadClass('Zend_Gdata_YouTube'); @@ -245,7 +249,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter break; default: - throw new Bridge_Exception_ElementUnknown('Unknown element ' . $type); + throw new Bridge_Exception_ElementUnknown('Unknown element ' . $object); break; } } diff --git a/lib/classes/Bridge/Api/Youtube/Container.class.php b/lib/classes/Bridge/Api/Youtube/Container.class.php index 6a63aee7c0..1775c17d9f 100644 --- a/lib/classes/Bridge/Api/Youtube/Container.class.php +++ b/lib/classes/Bridge/Api/Youtube/Container.class.php @@ -117,4 +117,20 @@ class Bridge_Api_Youtube_Container implements Bridge_Api_ContainerInterface return $this->type; } + public function get_duration() + { + return ''; + } + + + public function get_category() + { + return ''; + } + + + public function is_private() + { + return null; + } } diff --git a/lib/classes/Bridge/Exception.class.php b/lib/classes/Bridge/Exception.class.php index 37a18a3af7..fb4215aeef 100644 --- a/lib/classes/Bridge/Exception.class.php +++ b/lib/classes/Bridge/Exception.class.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class Bridge_Exception extends Exception +class Bridge_Exception extends \Exception { } diff --git a/lib/classes/Bridge/Exception/ApiConnectorNotConfigured.class.php b/lib/classes/Bridge/Exception/ApiConnectorNotConfigured.class.php index 7fb7faf5f9..8799133c1b 100644 --- a/lib/classes/Bridge/Exception/ApiConnectorNotConfigured.class.php +++ b/lib/classes/Bridge/Exception/ApiConnectorNotConfigured.class.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class Bridge_Exception_ApiConnectorNotConfigured extends Bridge_Exception +class Bridge_Exception_ApiConnectorNotConfigured extends \Bridge_Exception { } diff --git a/lib/classes/Bridge/Exception/ApiConnectorNotConnected.class.php b/lib/classes/Bridge/Exception/ApiConnectorNotConnected.class.php index 351007ec8c..14844026ef 100644 --- a/lib/classes/Bridge/Exception/ApiConnectorNotConnected.class.php +++ b/lib/classes/Bridge/Exception/ApiConnectorNotConnected.class.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class Bridge_Exception_ApiConnectorNotConnected extends Bridge_Exception +class Bridge_Exception_ApiConnectorNotConnected extends \Bridge_Exception { } diff --git a/lib/classes/Controller/Admin/Subdefs.class.php b/lib/classes/Controller/Admin/Subdefs.class.php deleted file mode 100644 index 773da8bfdc..0000000000 --- a/lib/classes/Controller/Admin/Subdefs.class.php +++ /dev/null @@ -1,140 +0,0 @@ -databox = $databox; - if ($request->has_post_datas()) - { - $parm = $request->get_parms('delete_subdef', 'add_subdef', 'subdefs'); - - $add_subdef = array('class' => null, 'name' => null, 'group' => null); - foreach ($add_subdef as $k => $v) - { - if (!isset($parm['add_subdef'][$k]) || trim($parm['add_subdef'][$k]) === '') - unset($add_subdef[$k]); - else - $add_subdef[$k] = $parm['add_subdef'][$k]; - } - - if ($parm['delete_subdef']) - { - $delete_subef = explode('_', $parm['delete_subdef']); - $group = $delete_subef[0]; - $name = $delete_subef[1]; - - $subdefs = $this->databox->get_subdef_structure(); - $subdefs->delete_subdef($group, $name); - } - elseif (count($add_subdef) === 3) - { - $subdefs = $this->databox->get_subdef_structure(); - - $group = $add_subdef['group']; - $name = $add_subdef['name']; - $class = $add_subdef['class']; - - $subdefs->add_subdef($group, $name, $class); - } - else - { - $subdefs = $this->databox->get_subdef_structure(); - - $options = array(); - - foreach ($parm['subdefs'] as $post_sub) - { - $post_sub_ex = explode('_', $post_sub); - $group = $post_sub_ex[0]; - $name = $post_sub_ex[1]; - - $parm_loc = $request->get_parms($post_sub . '_class', $post_sub . '_downloadable'); - - $class = $parm_loc[$post_sub . '_class']; - $downloadable = $parm_loc[$post_sub . '_downloadable']; - - $defaults = array('path', 'baseurl', 'meta', 'mediatype'); - foreach ($defaults as $def) - { - $parm_loc = $request->get_parms($post_sub . '_' . $def); - - if ($def == 'meta' && !$parm_loc[$post_sub . '_' . $def]) - { - $parm_loc[$post_sub . '_' . $def] = "no"; - } - - $options[$def] = $parm_loc[$post_sub . '_' . $def]; - } - - $parm_loc = $request->get_parms($post_sub . '_mediatype'); - $mediatype = $parm_loc[$post_sub . '_mediatype']; - $parm_loc = $request->get_parms($post_sub . '_' . $mediatype); - - if (isset($parm_loc[$post_sub . '_' . $mediatype])) - { - foreach ($parm_loc[$post_sub . '_' . $mediatype] as $option => $value) - { - if ($option == 'resolution' && $mediatype == 'image') - $option = 'dpi'; - $options[$option] = $value; - } - } - $subdefs->set_subdef($group, $name, $class, $downloadable, $options); - } - } - - return phrasea::redirect('/admin/subdefs.php?p0=' . $databox->get_sbas_id()); - } - - return $this; - } - - /** - * - * @return controller_admin_subdefs - */ - public function render() - { - - $twig = new supertwig(); - $twig->display( - 'admin/subdefs.twig', - array( - 'databox' => $this->databox, - 'subdefs' => $this->databox->get_subdef_structure() - ) - ); - - return $this; - } - -} diff --git a/lib/classes/Controller/Prod/Records/Edit.class.php b/lib/classes/Controller/Prod/Records/Edit.class.php deleted file mode 100644 index a0215e928c..0000000000 --- a/lib/classes/Controller/Prod/Records/Edit.class.php +++ /dev/null @@ -1,61 +0,0 @@ -post('/', function() use ($app) - { - $request = $app['request']; - $editing = new module_prod_route_records_edit($request); - $editing->propose_editing(); - - $template = 'prod/actions/edit_default.twig'; - - $twig = new supertwig(); - $twig->addFilter(array('sbas_names' => 'phrasea::sbas_names')); - - return $twig->render($template, array('edit' => $editing, 'message' => '')); - } - ); - - $controllers->post('/apply/', function() use ($app) - { - $request = $app['request']; - $editing = new module_prod_route_records_edit($request); - $editing->execute($request); - - $template = 'prod/actions/edit_default.twig'; - - $twig = new supertwig(); - $twig->addFilter(array('sbas_names' => 'phrasea::sbas_names')); - - return $twig->render($template, array('edit' => $editing, 'message' => '')); - } - ); - - return $controllers; - } - -} diff --git a/lib/classes/Controller/Prod/Records/Feed.class.php b/lib/classes/Controller/Prod/Records/Feed.class.php deleted file mode 100644 index 72886200f6..0000000000 --- a/lib/classes/Controller/Prod/Records/Feed.class.php +++ /dev/null @@ -1,334 +0,0 @@ -post('/requestavailable/', function() use ($app, $appbox, $twig) - { - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feeds = Feed_Collection::load_all($appbox, $user); - $request = $app['request']; - $publishing = new module_prod_route_records_feed($request); - - $datas = $twig->render('prod/actions/publish/publish.html', array('publishing' => $publishing, 'feeds' => $feeds)); - - return new Response($datas); - }); - - - /** - * I've selected a publication for my ocs, let's publish them - */ - $controllers->post('/entry/create/', function() use ($app, $appbox, $twig) - { - try - { - $request = $app['request']; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feed = new Feed_Adapter($appbox, $request->get('feed_id')); - $publisher = Feed_Publisher_Adapter::getPublisher($appbox, $feed, $user); - - $title = $request->get('title'); - $subtitle = $request->get('subtitle'); - $author_name = $request->get('author_name'); - $author_mail = $request->get('author_mail'); - - $entry = Feed_Entry_Adapter::create($appbox, $feed, $publisher, $title, $subtitle, $author_name, $author_mail); - $publishing = new module_prod_route_records_feed($request); - - foreach ($publishing->get_elements() as $record) - { - $item = Feed_Entry_Item::create($appbox, $entry, $record); - } - $datas = array('error' => false, 'message' => false); - } - catch (Exception $e) - { - $datas = array('error' => true, 'message' => _('An error occured'), 'details' => $e->getMessage()); - } - - return new Response(p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json')); - }); - - - $controllers->get('/entry/{id}/edit/', function($id) use ($app, $appbox, $twig) - { - - $request = $app['request']; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - - $entry = Feed_Entry_Adapter::load_from_id($appbox, $id); - - if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) - { - throw new Exception_UnauthorizedAction(); - } - $feeds = Feed_Collection::load_all($appbox, $user); - - - $datas = $twig->render('prod/actions/publish/publish_edit.html', array('entry' => $entry, 'feeds' => $feeds)); - - return new Response($datas); - }); - - - $controllers->post('/entry/{id}/update/', function($id) use ($app, $appbox, $twig) - { - $datas = array('error' => true, 'message' => '', 'datas' => ''); - try - { - $appbox->get_connection()->beginTransaction(); - $request = $app['request']; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - - $entry = Feed_Entry_Adapter::load_from_id($appbox, $id); - - if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) - { - throw new Exception_UnauthorizedAction(); - } - - $title = $request->get('title'); - $subtitle = $request->get('subtitle'); - $author_name = $request->get('author_name'); - $author_mail = $request->get('author_mail'); - - $entry->set_author_email($author_mail) - ->set_author_name($author_name) - ->set_title($title) - ->set_subtitle($subtitle); - - $items = explode(';', $request->get('sorted_lst')); - foreach ($items as $item_sort) - { - $item_sort_datas = explode('_', $item_sort); - if (count($item_sort_datas) != 2) - continue; - - $item = new Feed_Entry_Item($appbox, $entry, $item_sort_datas[0]); - $item->set_ord($item_sort_datas[1]); - } - $appbox->get_connection()->commit(); - - $twig->addFilter( - array( - 'sbasFromBas' => 'phrasea::sbasFromBas' - , 'getPrettyDate' => 'phraseadate::getPrettyString' - , 'nl2br' => 'nl2br' - ) - ); - $entry = $twig->render('prod/feeds/entry.html', array('entry' => $entry)); - - $datas = array('error' => false, 'message' => 'succes', 'datas' => $entry); - } - catch (Exception_Feed_EntryNotFound $e) - { - $appbox->get_connection()->rollBack(); - $datas['message'] = _('Feed entry not found'); - } - catch (Exception $e) - { - $appbox->get_connection()->rollBack(); - $datas['message'] = $e->getMessage(); - } - - return new Response(p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json')); - }); - - - $controllers->post('/entry/{id}/delete/', function($id) use ($app, $appbox, $twig) - { - $datas = array('error' => true, 'message' => ''); - try - { - $appbox->get_connection()->beginTransaction(); - $request = $app['request']; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - - $entry = Feed_Entry_Adapter::load_from_id($appbox, $id); - - if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id() - && $entry->get_feed()->is_owner($user) === false) - { - throw new Exception_UnauthorizedAction(_('Action Forbidden : You are not the publisher')); - } - - $entry->delete(); - - $appbox->get_connection()->commit(); - $datas = array('error' => false, 'message' => 'succes'); - } - catch (Exception_Feed_EntryNotFound $e) - { - $appbox->get_connection()->rollBack(); - $datas['message'] = _('Feed entry not found'); - } - catch (Exception $e) - { - $appbox->get_connection()->rollBack(); - $datas['message'] = $e->getMessage(); - } - - return new Response(p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json')); - }); - -//$app->post('/entry/{id}/addelement/', function($id) use ($app, $appbox, $twig) -// { -// -// }); -// -//$app->post('/element/{id}/update/', function($id) use ($app, $appbox, $twig) -// { -// -// }); -// -//$app->post('/element/{id}/delete/', function($id) use ($app, $appbox, $twig) -// { -// -// }); -//$app->get('/entry/{id}/', function($id) use ($app, $appbox, $twig) -// { -// -// }); - - $controllers->get('/', function() use ($app, $appbox, $twig) - { - $request = $app['request']; - $page = (int) $request->get('page'); - $page = $page > 0 ? $page : 1; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feeds = Feed_Collection::load_all($appbox, $user); - - - $twig->addFilter( - array( - 'sbasFromBas' => 'phrasea::sbasFromBas' - , 'getPrettyDate' => 'phraseadate::getPrettyString' - , 'nl2br' => 'nl2br' - ) - ); - $datas = $twig->render('prod/feeds/feeds.html' - , array( - 'feeds' => $feeds - , 'feed' => $feeds->get_aggregate() - , 'page' => $page - ) - ); - - return new Response($datas); - }); - - - $controllers->get('/feed/{id}/', function($id) use ($app, $appbox, $twig) - { - - $request = $app['request']; - $page = (int) $request->get('page'); - $page = $page > 0 ? $page : 1; - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - - $feed = Feed_Adapter::load_with_user($appbox, $user, $id); - $feeds = Feed_Collection::load_all($appbox, $user); - - $twig->addFilter( - array( - 'sbasFromBas' => 'phrasea::sbasFromBas' - , 'getPrettyDate' => 'phraseadate::getPrettyString' - , 'nl2br' => 'nl2br' - ) - ); - $datas = $twig->render('prod/feeds/feeds.html', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page)); - - return new Response($datas); - }); - - - $controllers->get('/subscribe/aggregated/', function() use ($app, $appbox, $twig) - { - - $request = $app['request']; - - $renew = ($request->get('renew') === 'true'); - - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feeds = Feed_Collection::load_all($appbox, $user); - $registry = $appbox->get_registry(); - - - $output = p4string::jsonencode( - array( - 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') - . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

-
', - 'titre' => _('publications::votre rss personnel') - ) - ); - - return new Response($output, 200, array('Content-Type' => 'application/json')); - }); - - - $controllers->get('/subscribe/{id}/', function($id) use ($app, $appbox, $twig) - { - - $request = $app['request']; - - $renew = ($request->get('renew') === 'true'); - $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - $feed = Feed_Adapter::load_with_user($appbox, $user, $id); - $registry = $appbox->get_registry(); - - $output = p4string::jsonencode( - array( - 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') - . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

-
', - 'titre' => _('publications::votre rss personnel') - ) - ); - - return new Response($output, 200, array('Content-Type' => 'application/json')); - }); - - return $controllers; - } - -} diff --git a/lib/classes/Controller/Prod/Records/Tooltip.class.php b/lib/classes/Controller/Prod/Records/Tooltip.class.php deleted file mode 100644 index 372492752d..0000000000 --- a/lib/classes/Controller/Prod/Records/Tooltip.class.php +++ /dev/null @@ -1,177 +0,0 @@ -post('/basket/{ssel_id}/' - , function($ssel_id) use ($app) - { - $bask = basket_adapter::getInstance($app['appbox'], $ssel_id, $app['appbox']->get_session()->get_usr_id()); - $isReg = false; - - return new Response('
' . - $bask->get_name() . '
' . - ($isReg ? ('
' . _('phraseanet::collection') . ' ' . phrasea::bas_names($bask->get_base_id()) . '
') : '') - . '
' . nl2br($bask->get_description()) . '
' . - '
' . sprintf(_('paniers: %d elements'), count($bask->get_elements())) . - ' - ' . phraseadate::getPrettyString($bask->get_update_date()) . '

-
' . $bask->get_excerpt() . '
'); - })->assert('ssel_id', '\d+'); - - - $controllers->post('/preview/{sbas_id}/{record_id}/' - , function($sbas_id, $record_id) use ($app) - { - $record = new record_adapter($sbas_id, $record_id); - - $twig = new supertwig(); - - return new Response($twig->render( - 'common/preview.html' - , array( - 'record' => $record - , 'not_wrapped' => true - ) - ) - ); - })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $controllers->post('/caption/{sbas_id}/{record_id}/{view}/' - , function($sbas_id, $record_id, $view) use ($app) - { - $number = (int) $app['request']->get('number'); - $record = new record_adapter($sbas_id, $record_id, $number); - - $search_engine = null; - if (($search_engine_options = unserialize($app['request']->get('options_serial'))) !== false) - { - $search_engine = new searchEngine_adapter($app['appbox']->get_registry()); - $search_engine->set_options($search_engine_options); - } - - $twig = new supertwig(); - $twig->addFilter(array('formatoctet' => 'p4string::format_octets')); - - return new Response( - $twig->render( - 'common/caption.html' - , array( - 'record' => $record - , 'view' => $view - , 'highlight' => $app['request']->get('query') - , 'searchEngine' => $search_engine - ) - ) - ); - })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $controllers->post('/tc_datas/{sbas_id}/{record_id}/' - , function($sbas_id, $record_id) use ($app) - { - $record = new record_adapter($sbas_id, $record_id); - $document = $record->get_subdef('document'); - - $twig = new supertwig(); - $twig->addFilter(array('formatoctet' => 'p4string::format_octets')); - - return new Response( - $twig->render( - 'common/technical_datas.twig' - , array('record' => $record, 'document' => $document) - ) - ); - })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $controllers->post('/metas/FieldInfos/{sbas_id}/{field_id}/' - , function($sbas_id, $field_id) use ($app) - { - $databox = databox::get_instance((int) $sbas_id); - $field = databox_field::get_instance($databox, $field_id); - - $twig = new supertwig(); - - return new Response( - $twig->render( - 'common/databox_field.twig' - , array('field' => $field) - ) - ); - })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); - - - $controllers->post('/metas/DCESInfos/{sbas_id}/{field_id}/' - , function($sbas_id, $field_id) use ($app) - { - try - { - $databox = databox::get_instance((int) $sbas_id); - $field = databox_field::get_instance($databox, $field_id); - - $twig = new supertwig(); - - return new Response( - $twig->render( - 'common/databox_field_DCES.twig' - , array('field' => $field) - ) - ); - } - catch (Exception $e) - { - exit($e->getMessage()); - } - })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); - - - $controllers->post('/metas/restrictionsInfos/{sbas_id}/{field_id}/' - , function($sbas_id, $field_id) use ($app) - { - $databox = databox::get_instance((int) $sbas_id); - $field = databox_field::get_instance($databox, $field_id); - - $twig = new supertwig(); - - return new Response( - $twig->render( - 'common/databox_field_restrictions.twig' - , array('field' => $field) - ) - ); - })->assert('sbas_id', '\d+')->assert('field_id', '\d+'); - - return $controllers; - } - -} diff --git a/lib/classes/Controller/Setup/Upgrader.class.php b/lib/classes/Controller/Setup/Upgrader.class.php deleted file mode 100644 index 2fcc4ea46c..0000000000 --- a/lib/classes/Controller/Setup/Upgrader.class.php +++ /dev/null @@ -1,89 +0,0 @@ -get('/', function() use ($app) - { - require_once dirname(__FILE__) . '/../../../bootstrap.php'; - $upgrade_status = Setup_Upgrade::get_status(); - - ini_set('display_errors', 'on'); - $html = $app['twig']->render( - '/setup/upgrader.twig' - , array( - 'locale' => Session_Handler::get_locale() - , 'upgrade_status' => $upgrade_status - , 'available_locales' => $app['available_languages'] - , 'bad_users' => User_Adapter::get_wrong_email_users(appbox::get_instance()) - , 'version_number' => GV_version - , 'version_name' => GV_version_name) - ); - ini_set('display_errors', 'on'); - - return new Response($html); - }); - - $controllers->get('/status/', function() use ($app) - { - require_once dirname(__FILE__) . '/../../../bootstrap.php'; - ini_set('display_errors', 'on'); - - $datas = Setup_Upgrade::get_status(); - - return new Response(p4string::jsonencode($datas), 200, array('Content-Type: application/json')); - }); - - $controllers->post('/execute/', function() use ($app) - { - require_once dirname(__FILE__) . '/../../../bootstrap.php'; - ini_set('display_errors', 'on'); - set_time_limit(0); - session_write_close(); - ignore_user_abort(true); - - $appbox = appbox::get_instance(); - $upgrader = new Setup_Upgrade($appbox); - $appbox->forceUpgrade($upgrader); - - return; - }); - - return $controllers; - } - -} diff --git a/lib/version.inc b/lib/classes/Exception/BadRequest.class.php similarity index 82% rename from lib/version.inc rename to lib/classes/Exception/BadRequest.class.php index e024da6dac..019ca68d0b 100644 --- a/lib/version.inc +++ b/lib/classes/Exception/BadRequest.class.php @@ -15,5 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -define('GV_version', '3.5.9.0'); -define('GV_version_name', 'Baobab'); +class Exception_BadRequest extends Exception_Abstract +{ + +} diff --git a/lib/classes/Feed/Adapter.class.php b/lib/classes/Feed/Adapter.class.php index 9fdf9e5756..6705feb602 100644 --- a/lib/classes/Feed/Adapter.class.php +++ b/lib/classes/Feed/Adapter.class.php @@ -55,9 +55,7 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea protected $icon_url; const CACHE_ENTRY_NUMBER = 'entrynumber'; - const CACHE_USER_TOKEN = 'usr_token'; - const MAX_ENTRIES = 20; /** @@ -250,9 +248,9 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea */ public function has_access(User_Adapter $user) { - if($this->get_collection() instanceof collection) + if ($this->get_collection() instanceof collection) - return $user->ACL ()->has_access_to_base ($this->collection->get_base_id ()); + return $user->ACL()->has_access_to_base($this->collection->get_base_id()); return true; } @@ -263,8 +261,10 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea public function is_public() { if ($this->get_collection() instanceof collection) - + { return false; + } + return $this->public; } diff --git a/lib/classes/Feed/Entry/Adapter.class.php b/lib/classes/Feed/Entry/Adapter.class.php index aa15389755..95cdfe8e96 100644 --- a/lib/classes/Feed/Entry/Adapter.class.php +++ b/lib/classes/Feed/Entry/Adapter.class.php @@ -141,7 +141,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':id' => $this->id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if (!$row) @@ -156,13 +156,13 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa $this->created_on = new DateTime($row['created_on']); $datas = array( - 'title' => $this->title - , 'subtitle' => $this->subtitle - , 'author_name' => $this->author_name - , 'author_email' => $this->author_email - , 'publisher_id' => $this->publisher_id - , 'updated_on' => $this->updated_on - , 'created_on' => $this->created_on + 'title' => $this->title + , 'subtitle' => $this->subtitle + , 'author_name' => $this->author_name + , 'author_email' => $this->author_email + , 'publisher_id' => $this->publisher_id + , 'updated_on' => $this->updated_on + , 'created_on' => $this->created_on ); $this->set_data_to_cache($datas); @@ -175,9 +175,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa $registry = registry::get_instance(); $href = sprintf( - '%slightbox/feeds/entry/%d/' - , $registry->get('GV_ServerName') - , $this->get_id() + '%slightbox/feeds/entry/%d/' + , $registry->get('GV_ServerName') + , $this->get_id() ); return new Feed_Link($href, $this->get_title(), 'text/html'); @@ -231,10 +231,10 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa if ($title === '') throw new Exception_InvalidArgument(); - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET title = :title, updated_on = NOW() WHERE id = :entry_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':title' => $title, ':entry_id' => $this->get_id())); + $stmt->execute(array(':title' => $title, ':entry_id' => $this->get_id())); $stmt->closeCursor(); $this->title = $title; $this->delete_data_from_cache(); @@ -251,11 +251,11 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa { $subtitle = strip_tags($subtitle); - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET description = :subtitle, updated_on = NOW() WHERE id = :entry_id'; $params = array(':subtitle' => $subtitle, ':entry_id' => $this->get_id()); - $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $this->subtitle = $subtitle; @@ -271,14 +271,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa */ public function set_author_name($author_name) { - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET author_name = :author_name, updated_on = NOW() WHERE id = :entry_id'; $params = array( - ':author_name' => $author_name, - ':entry_id' => $this->get_id() + ':author_name' => $author_name, + ':entry_id' => $this->get_id() ); - $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $this->author_name = $author_name; @@ -294,14 +294,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa */ public function set_author_email($author_email) { - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET author_email = :author_email, updated_on = NOW() WHERE id = :entry_id'; $params = array( - ':author_email' => $author_email, - ':entry_id' => $this->get_id() + ':author_email' => $author_email, + ':entry_id' => $this->get_id() ); - $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $this->author_email = $author_email; @@ -312,14 +312,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa public function set_created_on(DateTime $datetime) { - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET created_on = :created_on WHERE id = :entry_id'; $params = array( - ':created_on' => $datetime->format(DATE_ISO8601), - ':entry_id' => $this->get_id() + ':created_on' => $datetime->format(DATE_ISO8601), + ':entry_id' => $this->get_id() ); - $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $this->created_on = $datetime; @@ -330,14 +330,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa public function set_updated_on(DateTime $datetime) { - $sql = 'UPDATE feed_entries + $sql = 'UPDATE feed_entries SET updated_on = :updated_on WHERE id = :entry_id'; $params = array( - ':updated_on' => $datetime->format(DATE_ISO8601), - ':entry_id' => $this->get_id() + ':updated_on' => $datetime->format(DATE_ISO8601), + ':entry_id' => $this->get_id() ); - $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $this->updated_on = $datetime; @@ -414,7 +414,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa return $this->items; - $rs = $this->retrieve_elements(); + $rs = $this->retrieve_elements(); $items = array(); foreach ($rs as $item_id) { @@ -444,11 +444,11 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa } - $sql = 'SELECT id FROM feed_entry_elements + $sql = 'SELECT id FROM feed_entry_elements WHERE entry_id = :entry_id ORDER BY ord ASC'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':entry_id' => $this->get_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $items = array(); @@ -474,7 +474,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa $content->delete(); } - $sql = 'DELETE FROM feed_entries WHERE id = :entry_id'; + $sql = 'DELETE FROM feed_entries WHERE id = :entry_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':entry_id' => $this->get_id())); $stmt->closeCursor(); @@ -515,12 +515,12 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa , :description, NOW(), NOW(), :author_name, :author_email)'; $params = array( - ':feed_id' => $feed->get_id() - , ':publisher_id' => $publisher->get_id() - , ':title' => trim($title) - , ':description' => trim($subtitle) - , ':author_name' => trim($author_name) - , ':author_email' => trim($author_mail) + ':feed_id' => $feed->get_id() + , ':publisher_id' => $publisher->get_id() + , ':title' => trim($title) + , ':description' => trim($subtitle) + , ':author_name' => trim($author_name) + , ':author_email' => trim($author_mail) ); $stmt = $appbox->get_connection()->prepare($sql); @@ -531,7 +531,12 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa $feed->delete_data_from_cache(); - return new self($appbox, $feed, $entry_id); + $entry = new self($appbox, $feed, $entry_id); + + $eventsmanager = \eventsmanager_broker::getInstance($appbox, \bootstrap::getCore()); + $eventsmanager->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry_id), $entry); + + return $entry; } /** @@ -542,10 +547,10 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa */ public static function load_from_id(appbox $appbox, $id) { - $sql = 'SELECT feed_id FROM feed_entries WHERE id = :entry_id'; + $sql = 'SELECT feed_id FROM feed_entries WHERE id = :entry_id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array(':entry_id' => $id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if (!$row) diff --git a/lib/classes/Feed/XML/Abstract.class.php b/lib/classes/Feed/XML/Abstract.class.php index d61a6cd79f..d111c70ec2 100644 --- a/lib/classes/Feed/XML/Abstract.class.php +++ b/lib/classes/Feed/XML/Abstract.class.php @@ -235,7 +235,7 @@ abstract class Feed_XML_Abstract $title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title); if ($title_field) { - $str_title = $title_field->get_value(true, ' '); + $str_title = $title_field->get_serialized_values(' '); $title = $this->addTag($document, $group, 'media:title', $str_title); $title->setAttribute('type', 'plain'); } @@ -243,7 +243,7 @@ abstract class Feed_XML_Abstract $desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description); if ($desc_field) { - $str_desc = $desc_field->get_value(true, ' '); + $str_desc = $desc_field->get_serialized_values(' '); $desc = $this->addTag($document, $group, 'media:description', $str_desc); $desc->setAttribute('type', 'plain'); } @@ -251,7 +251,7 @@ abstract class Feed_XML_Abstract $contrib_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Contributor); if ($contrib_field) { - $str_contrib = $contrib_field->get_value(true, ' '); + $str_contrib = $contrib_field->get_serialized_values(' '); $contrib = $this->addTag($document, $group, 'media:credit', $str_contrib); $contrib->setAttribute('role', 'contributor'); $contrib->setAttribute('scheme', 'urn:ebu'); @@ -260,7 +260,7 @@ abstract class Feed_XML_Abstract $director_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Creator); if ($director_field) { - $str_director = $director_field->get_value(true, ' '); + $str_director = $director_field->get_serialized_values(' '); $director = $this->addTag($document, $group, 'media:credit', $str_director); $director->setAttribute('role', 'director'); $director->setAttribute('scheme', 'urn:ebu'); @@ -269,7 +269,7 @@ abstract class Feed_XML_Abstract $publisher_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Publisher); if ($publisher_field) { - $str_publisher = $publisher_field->get_value(true, ' '); + $str_publisher = $publisher_field->get_serialized_values(' '); $publisher = $this->addTag($document, $group, 'media:credit', $str_publisher); $publisher->setAttribute('role', 'publisher'); $publisher->setAttribute('scheme', 'urn:ebu'); @@ -278,14 +278,14 @@ abstract class Feed_XML_Abstract $rights_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Rights); if ($rights_field) { - $str_rights = $rights_field->get_value(true, ' '); + $str_rights = $rights_field->get_serialized_values(' '); $rights = $this->addTag($document, $group, 'media:copyright', $str_rights); } $keyword_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Subject); if ($keyword_field) { - $str_keywords = $keyword_field->get_value(true, ', '); + $str_keywords = $keyword_field->get_serialized_values(', '); $keywords = $this->addTag($document, $group, 'media:keywords', $str_keywords); } diff --git a/lib/classes/Feed/XML/Cooliris.class.php b/lib/classes/Feed/XML/Cooliris.class.php index 45d81183a0..8bf18786f3 100644 --- a/lib/classes/Feed/XML/Cooliris.class.php +++ b/lib/classes/Feed/XML/Cooliris.class.php @@ -383,7 +383,7 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface $title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title); if ($title_field) { - $str_title = $title_field->get_value(true, ' '); + $str_title = $title_field->get_serialized_values(' '); } else { @@ -396,7 +396,7 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface $desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description); if ($desc_field) { - $str_desc = $desc_field->get_value(true, ' '); + $str_desc = $desc_field->get_serialized_values(' '); } else { diff --git a/lib/classes/Session/Handler.class.php b/lib/classes/Session/Handler.class.php index d408aea3d5..949a776078 100644 --- a/lib/classes/Session/Handler.class.php +++ b/lib/classes/Session/Handler.class.php @@ -558,7 +558,7 @@ class Session_Handler $browser = Browser::getInstance(); if($this->is_authenticated()) - $user = User_Adapter::getInstance ($this->get_usr_id (), appbox::get_instance ()); + $user = User_Adapter::getInstance ($this->get_usr_id (), appbox::get_instance (\bootstrap::getCore())); return Session_Logger::create($databox, $browser, $this, $user); } @@ -571,10 +571,12 @@ class Session_Handler return $this; } - $registry = $this->appbox->get_registry(); + $Core = bootstrap::getCore(); + + $registry = $Core->getRegistry(); $date_two_day = new DateTime('+' . (int) $registry->get('GV_validation_reminder') . ' days'); - $events_mngr = eventsmanager_broker::getInstance($this->appbox); + $events_mngr = eventsmanager_broker::getInstance($this->appbox, $Core); $sql = 'SELECT v.id as validate_id, v.usr_id, v.ssel_id , s.usr_id as owner, t.value @@ -708,7 +710,7 @@ class Session_Handler $rs[$k]['created_on'] = new DateTime($row['created_on']); $rs[$k]['lastaccess'] = new DateTime($row['lastaccess']); $rs[$k]['token'] = !!$row['token']; - $rs[$k]['usr_id'] = User_Adapter::getInstance($row['usr_id'], appbox::get_instance()); + $rs[$k]['usr_id'] = User_Adapter::getInstance($row['usr_id'], appbox::get_instance(\bootstrap::getCore())); $datas = $geonames->find_geoname_from_ip($row['ip']); diff --git a/lib/classes/Setup/Registry.class.php b/lib/classes/Setup/Registry.class.php index cef6827c56..a7117f7c20 100644 --- a/lib/classes/Setup/Registry.class.php +++ b/lib/classes/Setup/Registry.class.php @@ -26,7 +26,7 @@ class Setup_Registry implements registryInterface return isset($this->datas[$key]) ? $this->datas[$key] : $defaultvalue; } - public function set($key, $value) + public function set($key, $value, $type) { $this->datas[$key] = $value; } diff --git a/lib/classes/Setup/Upgrade.class.php b/lib/classes/Setup/Upgrade.class.php index 08209f2b34..8d17fafc32 100644 --- a/lib/classes/Setup/Upgrade.class.php +++ b/lib/classes/Setup/Upgrade.class.php @@ -179,7 +179,7 @@ class Setup_Upgrade */ public static function get_lock_file() { - return dirname(__FILE__) . '/../../../tmp/upgrade.lock'; + return __DIR__ . '/../../../tmp/upgrade.lock'; } /** diff --git a/lib/classes/User/Adapter.class.php b/lib/classes/User/Adapter.class.php index 69522981dc..91839ce4e4 100644 --- a/lib/classes/User/Adapter.class.php +++ b/lib/classes/User/Adapter.class.php @@ -29,11 +29,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface * @var Array */ public static $locales = array( - 'ar_SA' => 'العربية' - , 'de_DE' => 'Deutsch' - , 'en_GB' => 'English' - , 'es_ES' => 'Español' - , 'fr_FR' => 'Français' + 'ar_SA' => 'العربية' + , 'de_DE' => 'Deutsch' + , 'en_GB' => 'English' + , 'es_ES' => 'Español' + , 'fr_FR' => 'Français' ); /** @@ -65,27 +65,27 @@ class User_Adapter implements User_Interface, cache_cacheableInterface * @var array */ protected static $def_values = array( - 'view' => 'thumbs', - 'images_per_page' => 20, - 'images_size' => 120, - 'editing_images_size' => 134, - 'editing_top_box' => '180px', - 'editing_right_box' => '400px', - 'editing_left_box' => '710px', - 'basket_sort_field' => 'name', - 'basket_sort_order' => 'ASC', - 'warning_on_delete_story' => 'true', - 'client_basket_status' => '1', - 'css' => '000000', - 'start_page_query' => 'last', - 'start_page' => 'QUERY', - 'rollover_thumbnail' => 'caption', - 'technical_display' => '1', - 'doctype_display' => '1', - 'bask_val_order' => 'nat', - 'basket_caption_display' => '0', - 'basket_status_display' => '0', - 'basket_title_display' => '0' + 'view' => 'thumbs', + 'images_per_page' => 20, + 'images_size' => 120, + 'editing_images_size' => 134, + 'editing_top_box' => '180px', + 'editing_right_box' => '400px', + 'editing_left_box' => '710px', + 'basket_sort_field' => 'name', + 'basket_sort_order' => 'ASC', + 'warning_on_delete_story' => 'true', + 'client_basket_status' => '1', + 'css' => '000000', + 'start_page_query' => 'last', + 'start_page' => 'QUERY', + 'rollover_thumbnail' => 'caption', + 'technical_display' => '1', + 'doctype_display' => '1', + 'bask_val_order' => 'nat', + 'basket_caption_display' => '0', + 'basket_status_display' => '0', + 'basket_title_display' => '0' ); /** @@ -93,13 +93,13 @@ class User_Adapter implements User_Interface, cache_cacheableInterface * @var array */ protected static $available_values = array( - 'view' => array('thumbs', 'list'), - 'basket_sort_field' => array('name', 'date'), - 'basket_sort_order' => array('ASC', 'DESC'), - 'start_page' => array('PUBLI', 'QUERY', 'LAST_QUERY', 'HELP'), - 'technical_display' => array('0', '1', 'group'), - 'rollover_thumbnail' => array('caption', 'preview'), - 'bask_val_order' => array('nat', 'asc', 'desc') + 'view' => array('thumbs', 'list'), + 'basket_sort_field' => array('name', 'date'), + 'basket_sort_order' => array('ASC', 'DESC'), + 'start_page' => array('PUBLI', 'QUERY', 'LAST_QUERY', 'HELP'), + 'technical_display' => array('0', '1', 'group'), + 'rollover_thumbnail' => array('caption', 'preview'), + 'bask_val_order' => array('nat', 'asc', 'desc') ); /** @@ -390,7 +390,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $password = self::salt_password($pasword, $this->get_nonce()); $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':password' => $password, ':usr_id' => $this->get_id())); + $stmt->execute(array(':password' => $password, ':usr_id' => $this->get_id())); $stmt->closeCursor(); return $this; @@ -413,9 +413,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface throw new Exception_InvalidArgument(sprintf(_('A user already exists with email addres %s'), $email)); } - $sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':new_email' => $email, ':usr_id' => $this->get_id())); + $stmt->execute(array(':new_email' => $email, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->email = $email; $this->delete_data_from_cache(); @@ -443,30 +443,30 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function get_protected_rss_url($renew = false) { - $session = $this->appbox->get_session(); + $session = $this->appbox->get_session(); $registry = $this->appbox->get_registry(); $token = $title = false; if (!$renew) { - $sql = 'SELECT value FROM tokens WHERE usr_id = :usr_id AND type="rss"'; + $sql = 'SELECT value FROM tokens WHERE usr_id = :usr_id AND type="rss"'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $token = $row['value']; + $token = $row['value']; } else { - $sql = 'DELETE FROM tokens WHERE usr_id = :usr_id AND type="rss"'; + $sql = 'DELETE FROM tokens WHERE usr_id = :usr_id AND type="rss"'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); } if ($token === false) { - $token = random::getUrlToken('rss', $this->id); + $token = random::getUrlToken(\random::TYPE_RSS, $this->id); } return new system_url($registry->get('GV_ServerName') . 'atom/' . $token); @@ -482,17 +482,17 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { try { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $sql = "INSERT INTO dsel (id, name, usr_id, query) + $sql = "INSERT INTO dsel (id, name, usr_id, query) VALUES (null, :name, :usr_id, :query)"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array( - ':name' => $query, - ':usr_id' => $session->get_usr_id(), - ':query' => $query + ':name' => $query, + ':usr_id' => $session->get_usr_id(), + ':query' => $query )); $stmt->closeCursor(); @@ -531,10 +531,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function get_usr_id_from_login($login) { $conn = connection::getPDOConnection(); - $sql = 'SELECT usr_id FROM usr WHERE usr_login = :login'; + $sql = 'SELECT usr_id FROM usr WHERE usr_login = :login'; $stmt = $conn->prepare($sql); $stmt->execute(array(':login' => trim($login))); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); $usr_id = $row ? (int) $row['usr_id'] : false; @@ -549,9 +549,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function set_defaultftpdatas($datas) { - $sql = 'UPDATE usr SET defaultftpdatasent = :defaultftpdatas WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET defaultftpdatasent = :defaultftpdatas WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':defaultftpdatas' => $datas, ':usr_id' => $this->get_id())); + $stmt->execute(array(':defaultftpdatas' => $datas, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->defaultftpdatas = $datas; @@ -566,9 +566,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_mail_notifications($boolean) { $value = $boolean ? '1' : '0'; - $sql = 'UPDATE usr SET mail_notifications = :mail_notifications WHERE usr_id = :usr_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':mail_notifications' => $value, ':usr_id' => $this->get_id())); + $sql = 'UPDATE usr SET mail_notifications = :mail_notifications WHERE usr_id = :usr_id'; + $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt->execute(array(':mail_notifications' => $value, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->mail_notifications = !!$boolean; $this->delete_data_from_cache(); @@ -584,9 +584,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_activeftp($boolean) { $value = $boolean ? '1' : '0'; - $sql = 'UPDATE usr SET activeftp = :activeftp WHERE usr_id = :usr_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':activeftp' => $value, ':usr_id' => $this->get_id())); + $sql = 'UPDATE usr SET activeftp = :activeftp WHERE usr_id = :usr_id'; + $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt->execute(array(':activeftp' => $value, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->activeftp = $boolean; @@ -601,9 +601,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_ldap_created($boolean) { $value = $boolean ? '1' : '0'; - $sql = 'UPDATE usr SET ldap_created = :ldap_created WHERE usr_id = :usr_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ldap_created' => $value, ':usr_id' => $this->get_id())); + $sql = 'UPDATE usr SET ldap_created = :ldap_created WHERE usr_id = :usr_id'; + $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt->execute(array(':ldap_created' => $value, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ldap_created = $boolean; @@ -617,9 +617,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function set_ftp_address($address) { - $sql = 'UPDATE usr SET addrftp = :addrftp WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET addrftp = :addrftp WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':addrftp' => $address, ':usr_id' => $this->get_id())); + $stmt->execute(array(':addrftp' => $address, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_address = $address; $this->delete_data_from_cache(); @@ -634,9 +634,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function set_ftp_login($login) { - $sql = 'UPDATE usr SET loginftp = :loginftp WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET loginftp = :loginftp WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':loginftp' => $login, ':usr_id' => $this->get_id())); + $stmt->execute(array(':loginftp' => $login, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_login = $login; @@ -650,9 +650,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function set_ftp_password($password) { - $sql = 'UPDATE usr SET pwdFTP = :passwordftp WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET pwdFTP = :passwordftp WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':passwordftp' => $password, ':usr_id' => $this->get_id())); + $stmt->execute(array(':passwordftp' => $password, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_password = $password; $this->delete_data_from_cache(); @@ -663,9 +663,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_ftp_passif($boolean) { $value = $boolean ? '1' : '0'; - $sql = 'UPDATE usr SET passifftp = :passifftp WHERE usr_id = :usr_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':passifftp' => $value, ':usr_id' => $this->get_id())); + $sql = 'UPDATE usr SET passifftp = :passifftp WHERE usr_id = :usr_id'; + $stmt = $this->appbox->get_connection()->prepare($sql); + $stmt->execute(array(':passifftp' => $value, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_passif = !!$boolean; @@ -674,9 +674,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_ftp_dir($ftp_dir) { - $sql = 'UPDATE usr SET destftp = :destftp WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET destftp = :destftp WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':destftp' => $ftp_dir, ':usr_id' => $this->get_id())); + $stmt->execute(array(':destftp' => $ftp_dir, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_dir = $ftp_dir; $this->delete_data_from_cache(); @@ -686,9 +686,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_ftp_dir_prefix($ftp_dir_prefix) { - $sql = 'UPDATE usr SET prefixFTPfolder = :prefixftp WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET prefixFTPfolder = :prefixftp WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':prefixftp' => $ftp_dir_prefix, ':usr_id' => $this->get_id())); + $stmt->execute(array(':prefixftp' => $ftp_dir_prefix, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->ftp_dir_prefix = $ftp_dir_prefix; @@ -697,9 +697,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_firstname($firstname) { - $sql = 'UPDATE usr SET usr_prenom = :usr_prenom WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET usr_prenom = :usr_prenom WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_prenom' => $firstname, ':usr_id' => $this->get_id())); + $stmt->execute(array(':usr_prenom' => $firstname, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->firstname = $firstname; $this->delete_data_from_cache(); @@ -709,9 +709,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_lastname($lastname) { - $sql = 'UPDATE usr SET usr_nom = :usr_nom WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET usr_nom = :usr_nom WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_nom' => $lastname, ':usr_id' => $this->get_id())); + $stmt->execute(array(':usr_nom' => $lastname, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->lastname = $lastname; $this->delete_data_from_cache(); @@ -721,9 +721,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_address($address) { - $sql = 'UPDATE usr SET adresse = :adresse WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET adresse = :adresse WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':adresse' => $address, ':usr_id' => $this->get_id())); + $stmt->execute(array(':adresse' => $address, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->address = $address; $this->delete_data_from_cache(); @@ -733,9 +733,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_city($city) { - $sql = 'UPDATE usr SET ville = :city WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET ville = :city WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':city' => $city, ':usr_id' => $this->get_id())); + $stmt->execute(array(':city' => $city, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->city = $city; $this->delete_data_from_cache(); @@ -745,14 +745,14 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_geonameid($geonameid) { - $geonames = new geonames(); + $geonames = new geonames(); $country_code = $geonames->get_country_code($geonameid); - $sql = 'UPDATE usr SET geonameid = :geonameid, pays=:country_code WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET geonameid = :geonameid, pays=:country_code WHERE usr_id = :usr_id'; $datas = array( - ':geonameid' => $geonameid, - ':usr_id' => $this->get_id(), - ':country_code' => $country_code + ':geonameid' => $geonameid, + ':usr_id' => $this->get_id(), + ':country_code' => $country_code ); $stmt = $this->appbox->get_connection()->prepare($sql); @@ -767,9 +767,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_zip($zip) { - $sql = 'UPDATE usr SET cpostal = :cpostal WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET cpostal = :cpostal WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':cpostal' => $zip, ':usr_id' => $this->get_id())); + $stmt->execute(array(':cpostal' => $zip, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->zip = $zip; $this->delete_data_from_cache(); @@ -779,9 +779,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_gender($gender) { - $sql = 'UPDATE usr SET usr_sexe = :usr_sexe WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET usr_sexe = :usr_sexe WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_sexe' => $gender, ':usr_id' => $this->get_id())); + $stmt->execute(array(':usr_sexe' => $gender, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->gender = $gender; $this->delete_data_from_cache(); @@ -791,9 +791,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_tel($tel) { - $sql = 'UPDATE usr SET tel = :tel WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET tel = :tel WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':tel' => $tel, ':usr_id' => $this->get_id())); + $stmt->execute(array(':tel' => $tel, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->tel = $tel; $this->delete_data_from_cache(); @@ -803,9 +803,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_fax($fax) { - $sql = 'UPDATE usr SET fax = :fax WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET fax = :fax WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':fax' => $fax, ':usr_id' => $this->get_id())); + $stmt->execute(array(':fax' => $fax, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->fax = $fax; $this->delete_data_from_cache(); @@ -815,9 +815,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_job($job) { - $sql = 'UPDATE usr SET fonction = :fonction WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET fonction = :fonction WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':fonction' => $job, ':usr_id' => $this->get_id())); + $stmt->execute(array(':fonction' => $job, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->job = $job; $this->delete_data_from_cache(); @@ -827,9 +827,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_position($position) { - $sql = 'UPDATE usr SET activite = :activite WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET activite = :activite WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':activite' => $position, ':usr_id' => $this->get_id())); + $stmt->execute(array(':activite' => $position, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->position = $position; $this->delete_data_from_cache(); @@ -839,9 +839,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_company($company) { - $sql = 'UPDATE usr SET societe = :company WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET societe = :company WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':company' => $company, ':usr_id' => $this->get_id())); + $stmt->execute(array(':company' => $company, ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->company = $company; $this->delete_data_from_cache(); @@ -857,32 +857,32 @@ class User_Adapter implements User_Interface, cache_cacheableInterface if ($owner->get_id() == $this->get_id()) throw new Exception_InvalidArgument (); - $sql = 'UPDATE usr SET model_of = :owner_id WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET model_of = :owner_id WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':owner_id' => $owner->get_id(), ':usr_id' => $this->get_id())); + $stmt->execute(array(':owner_id' => $owner->get_id(), ':usr_id' => $this->get_id())); $stmt->closeCursor(); $this->set_ftp_address('') - ->set_activeftp(false) - ->set_city('') - ->set_company('') - ->set_email(null) - ->set_fax('') - ->set_firstname('') - ->set_ftp_dir('') - ->set_ftp_dir_prefix('') - ->set_ftp_login('') - ->set_ftp_passif('') - ->set_ftp_password('') - ->set_gender('') - ->set_geonameid('') - ->set_job('') - ->set_lastname('') - ->set_mail_locked(false) - ->set_mail_notifications(true) - ->set_position('') - ->set_zip('') - ->set_tel(''); + ->set_activeftp(false) + ->set_city('') + ->set_company('') + ->set_email(null) + ->set_fax('') + ->set_firstname('') + ->set_ftp_dir('') + ->set_ftp_dir_prefix('') + ->set_ftp_login('') + ->set_ftp_passif('') + ->set_ftp_password('') + ->set_gender('') + ->set_geonameid('') + ->set_job('') + ->set_lastname('') + ->set_mail_locked(false) + ->set_mail_notifications(true) + ->set_position('') + ->set_zip('') + ->set_tel(''); $this->delete_data_from_cache(); @@ -911,13 +911,13 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return false; $conn = connection::getPDOConnection(); - $sql = 'SELECT usr_id FROM usr + $sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email AND usr_login NOT LIKE "(#deleted_%" AND invite="0" AND usr_login != "autoregister"'; $stmt = $conn->prepare($sql); $stmt->execute(array(':email' => trim($email))); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); $usr_id = $row ? $row['usr_id'] : false; @@ -931,68 +931,68 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function delete() { - $sql = 'UPDATE usr SET usr_login = :usr_login , usr_mail = null + $sql = 'UPDATE usr SET usr_login = :usr_login , usr_mail = null WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_login' => '(#deleted_' . $this->get_login() . '_' . $this->get_id(), ':usr_id' => $this->get_id())); + $stmt->execute(array(':usr_login' => '(#deleted_' . $this->get_login() . '_' . $this->get_id(), ':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM basusr WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM basusr WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM sbasusr WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM sbasusr WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM dsel WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM dsel WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM edit_presets WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM edit_presets WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM ftp_export WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM ftp_export WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM `order` WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM `order` WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM tokens WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM tokens WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM usrlist WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM usrlist WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM usr_settings WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM usr_settings WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM usrlistusers WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM usrlistusers WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); - $sql = 'DELETE FROM ssel WHERE usr_id = :usr_id'; + $sql = 'DELETE FROM ssel WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $stmt->closeCursor(); @@ -1120,8 +1120,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $sql = 'UPDATE usr SET lastModel = :template_id WHERE usr_id = :usr_id'; $params = array( - ':usr_id' => $this->get_id() - , ':template_id' => $template->get_login() + ':usr_id' => $this->get_id() + , ':template_id' => $template->get_login() ); $stmt = $this->appbox->get_connection()->prepare($sql); @@ -1134,9 +1134,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_mail_locked($boolean) { - $sql = 'UPDATE usr SET mail_locked = :mail_locked WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET mail_locked = :mail_locked WHERE usr_id = :usr_id'; $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_id' => $this->get_id(), ':mail_locked' => ($boolean ? '1' : '0'))); + $stmt->execute(array(':usr_id' => $this->get_id(), ':mail_locked' => ($boolean ? '1' : '0'))); $stmt->closeCursor(); $this->mail_locked = !!$boolean; @@ -1283,10 +1283,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $registry = \registry::get_instance(); - $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; + $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':id' => $this->id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -1298,7 +1298,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { if (!isset($this->_prefs[$k])) { - if($k == 'start_page_query' && $registry->get('GV_defaultQuery')) + if ($k == 'start_page_query' && $registry->get('GV_defaultQuery')) { $v = $registry->get('GV_defaultQuery'); } @@ -1313,7 +1313,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface protected function load_notifications_preferences() { - $evt_mngr = eventsmanager_broker::getInstance($this->appbox); + $Core = bootstrap::getCore(); + $evt_mngr = eventsmanager_broker::getInstance($this->appbox, $Core); $notifications = $evt_mngr->list_notifications_available($this->id); foreach ($notifications as $notification_group => $nots) @@ -1372,9 +1373,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array( - ':usr_id' => $this->id, - ':prop' => $prop, - ':value' => $value + ':usr_id' => $this->id, + ':prop' => $prop, + ':value' => $value )); $this->delete_data_from_cache(); } @@ -1416,7 +1417,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $lngs = array(); - $path = dirname(__FILE__) . "/../../../locale"; + $path = __DIR__ . "/../../../locale"; if ($hdir = opendir($path)) { while (false !== ($file = readdir($hdir))) @@ -1427,10 +1428,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { if (!array_key_exists($file, self::$locales)) continue; - $supFile = explode('_', $file); + $supFile = explode('_', $file); if (!isset($lngs[$supFile[0]])) $lngs[$supFile[0]] = array(); - $lngs[$supFile[0]][$file] = array('name' => self::$locales[$file], 'selected' => false); + $lngs[$supFile[0]][$file] = array('name' => self::$locales[$file], 'selected' => false); } } } @@ -1438,95 +1439,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return $lngs; } - public static function detectLanguage(registryInterface $registry, $setLng = null) - { - $avLanguages = self::avLanguages(); - $sel = $askLng = $askLocale = ''; - - if ($setLng !== null) - { - $askLng = substr($setLng, 0, 2); - $askLocale = $setLng; - } - elseif (Session_Handler::isset_cookie('locale')) - { - $askLng = substr(Session_Handler::get_cookie('locale'), 0, 2); - $askLocale = Session_Handler::get_cookie('locale'); - } - elseif (strlen($registry->get('GV_default_lng')) > 2) - { - $askLng = substr($registry->get('GV_default_lng'), 0, 2); - $askLocale = $registry->get('GV_default_lng'); - } - - - if ($askLng != '' && isset($avLanguages[$askLng]) && isset($avLanguages[$askLng][$askLocale])) - { - $avLanguages[$askLng][$askLocale]['selected'] = true; - $sel = $askLocale; - } - - if ($sel === '' && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) - { - $languages = explode(';', $_SERVER['HTTP_ACCEPT_LANGUAGE']); - $found = false; - - foreach ($languages as $language) - { - $language = explode(',', strtolower($language)); - if (count($language) != 2) - continue; - - foreach ($language as $lang) - { - if (strpos($lang, '-') == 2 && strlen($lang) == 5) - { - $l = explode('-', $lang); - $l[0] = strtolower($l[0]); - $l[1] = strtoupper($l[1]); - - if ($sel != '') - { - $found = true; - break; - } - $lang = implode('_', $l); - if (isset($avLanguages[$l[0]])) - { - if (!isset($avLanguages[$l[0]][$lang])) - { - $lang = end(array_keys($avLanguages[$l[0]])); - } - $avLanguages[$l[0]][$lang]['selected'] = true; - $sel = $lang; - $found = true; - break; - } - } - } - if ($found) - break; - } - if (!$found && array_key_exists(substr($registry->get('GV_default_lng'), 0, 2), $avLanguages)) - { - $avLanguages[substr($registry->get('GV_default_lng'), 0, 2)][$registry->get('GV_default_lng')]['selected'] = true; - $sel = $registry->get('GV_default_lng'); - } - } - if ($sel == '') - { - $key = end(array_keys($avLanguages)); - $lang = end(array_keys($avLanguages[$key])); - $avLanguages[$key][$lang]['selected'] = true; - $sel = $lang; - } - Session_Handler::set_locale($sel); - - $sel = explode('_', $sel); - - return $avLanguages; - } - public static function get_wrong_email_users(appbox $appbox) { @@ -1560,7 +1472,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $bad_users[$email] = array(); foreach ($usrs as $usr_id) { - $user = User_Adapter::getInstance($usr_id, $appbox); + $user = User_Adapter::getInstance($usr_id, $appbox); $bad_users[$email][$user->get_id()] = $user; } } @@ -1575,8 +1487,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $this->load_preferences(); if (isset($this->_prefs[$prop]) && $this->_prefs[$prop] === $value) - - return $value; + { + return $this->_prefs[$prop]; + } $ok = true; @@ -1610,7 +1523,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function updateClientInfos($app_id) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); if (!$session->is_authenticated()) @@ -1622,15 +1535,15 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $user = User_Adapter::getInstance($usr_id, $appbox); $appName = array( - '1' => 'Prod', - '2' => 'Client', - '3' => 'Admin', - '4' => 'Report', - '5' => 'Thesaurus', - '6' => 'Compare', - '7' => 'Validate', - '8' => 'Upload', - '9' => 'API' + '1' => 'Prod', + '2' => 'Client', + '3' => 'Admin', + '4' => 'Report', + '5' => 'Thesaurus', + '6' => 'Compare', + '7' => 'Validate', + '8' => 'Upload', + '9' => 'API' ); if (isset($appName[$app_id])) @@ -1644,10 +1557,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $logger = $session->get_logger(databox::get_instance($sbas_id)); $connbas = connection::getPDOConnection($sbas_id); - $sql = 'SELECT appli FROM log WHERE id = :log_id'; - $stmt = $connbas->prepare($sql); + $sql = 'SELECT appli FROM log WHERE id = :log_id'; + $stmt = $connbas->prepare($sql); $stmt->execute(array(':log_id' => $logger->get_id())); - $row3 = $stmt->fetch(PDO::FETCH_ASSOC); + $row3 = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if (!$row3) @@ -1662,8 +1575,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $sql = 'UPDATE log SET appli = :applis WHERE id = :log_id'; $params = array( - ':applis' => serialize($applis) - , ':log_id' => $logger->get_id() + ':applis' => serialize($applis) + , ':log_id' => $logger->get_id() ); $stmt = $connbas->prepare($sql); @@ -1677,10 +1590,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface } } - $sql = 'SELECT app FROM cache WHERE session_id = :ses_id'; + $sql = 'SELECT app FROM cache WHERE session_id = :ses_id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array(':ses_id' => $ses_id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); $apps = array(); @@ -1690,7 +1603,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface if (!in_array($app_id, $apps)) $apps[] = $app_id; - $sql = "UPDATE cache SET app = :applis WHERE session_id = :ses_id"; + $sql = "UPDATE cache SET app = :applis WHERE session_id = :ses_id"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array(':applis' => serialize($apps), ':ses_id' => $ses_id)); $stmt->closeCursor(); @@ -1700,11 +1613,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function get_sys_admins() { - $sql = 'SELECT usr_id, usr_login FROM usr WHERE create_db="1"'; + $sql = 'SELECT usr_id, usr_login FROM usr WHERE create_db="1"'; $conn = connection::getPDOConnection(); $stmt = $conn->prepare($sql); $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $users = array(); @@ -1719,15 +1632,15 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { try { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $sql = "UPDATE usr SET create_db='0' WHERE create_db='1' AND usr_id != :usr_id"; + $sql = "UPDATE usr SET create_db='0' WHERE create_db='1' AND usr_id != :usr_id"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $session->get_usr_id())); $stmt->closeCursor(); - $sql = "UPDATE usr SET create_db='1' WHERE usr_id IN (" . implode(',', $admins) . ")"; + $sql = "UPDATE usr SET create_db='1' WHERE usr_id IN (" . implode(',', $admins) . ")"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); @@ -1746,8 +1659,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $users = self::get_sys_admins(); - $appbox = appbox::get_instance(); - $conn = $appbox->get_connection(); + $appbox = appbox::get_instance(\bootstrap::getCore()); + $conn = $appbox->get_connection(); foreach ($appbox->get_databoxes() as $databox) { @@ -1757,10 +1670,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $user->ACL()->give_access_to_sbas(array($databox->get_sbas_id())); $rights = array( - 'bas_manage' => '1' - , 'bas_modify_struct' => '1' - , 'bas_modif_th' => '1' - , 'bas_chupub' => '1' + 'bas_manage' => '1' + , 'bas_modify_struct' => '1' + , 'bas_modif_th' => '1' + , 'bas_chupub' => '1' ); $user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights); @@ -1770,24 +1683,24 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $user->ACL()->give_access_to_base(array($collection->get_base_id())); $rights = array( - 'canputinalbum' => '1' - , 'candwnldhd' => '1' - , 'candwnldsubdef' => '1' - , 'nowatermark' => '1' - , 'candwnldpreview' => '1' - , 'cancmd' => '1' - , 'canadmin' => '1' - , 'canreport' => '1' - , 'canpush' => '1' - , 'creationdate' => '1' - , 'canaddrecord' => '1' - , 'canmodifrecord' => '1' - , 'candeleterecord' => '1' - , 'chgstatus' => '1' - , 'imgtools' => '1' - , 'manage' => '1' - , 'modify_struct' => '1' - , 'bas_modify_struct' => '1' + 'canputinalbum' => '1' + , 'candwnldhd' => '1' + , 'candwnldsubdef' => '1' + , 'nowatermark' => '1' + , 'candwnldpreview' => '1' + , 'cancmd' => '1' + , 'canadmin' => '1' + , 'canreport' => '1' + , 'canpush' => '1' + , 'creationdate' => '1' + , 'canaddrecord' => '1' + , 'canmodifrecord' => '1' + , 'candeleterecord' => '1' + , 'chgstatus' => '1' + , 'imgtools' => '1' + , 'manage' => '1' + , 'modify_struct' => '1' + , 'bas_modify_struct' => '1' ); $user->ACL()->update_rights_to_base($collection->get_base_id(), $rights); @@ -1804,15 +1717,15 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $locale = 'en_GB'; try { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = appbox::get_instance(\bootstrap::getCore()); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); - $locale = $registry->get('GV_default_lng'); + $locale = $registry->get('GV_default_lng'); - $sql = "SELECT locale FROM usr WHERE usr_id = :usr_id"; + $sql = "SELECT locale FROM usr WHERE usr_id = :usr_id"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $session->get_usr_id())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if ($row) @@ -1830,50 +1743,43 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function create(appbox &$appbox, $login, $password, $email, $admin, $invite = false) { - try + $conn = $appbox->get_connection(); + + if (trim($login) == '') + throw new Exception('Invalid username'); + if (trim($password) == '') + throw new Exception('Invalid password'); + + $login = $invite ? 'invite' . random::generatePassword(16) : $login; + + $nonce = random::generatePassword(16); + + $sql = 'INSERT INTO usr + (usr_id, usr_login, usr_password, usr_creationdate, usr_mail, create_db, nonce, salted_password, invite) + VALUES (null, :login, :password, NOW(), :email, :admin, :nonce, 1, :invite)'; + + $stmt = $conn->prepare($sql); + $stmt->execute(array( + ':login' => $login, + ':nonce' => $nonce, + ':password' => self::salt_password($password, $nonce), + ':email' => ($email ? $email : null), + ':admin' => ($admin ? '1' : '0'), + ':invite' => ($invite ? '1' : '0') + )); + $stmt->closeCursor(); + + $usr_id = $conn->lastInsertId(); + + if ($invite) { - $conn = $appbox->get_connection(); - - if (trim($login) == '') - throw new Exception('Invalid username'); - if (trim($password) == '') - throw new Exception('Invalid password'); - - $login = $invite ? 'invite' . random::generatePassword(16) : $login; - - $nonce = random::generatePassword(16); - - $sql = 'INSERT INTO usr - (usr_id, usr_login, usr_password, usr_creationdate, usr_mail, create_db, nonce, salted_password, invite) - VALUES (null, :login, :password, NOW(), :email, :admin, :nonce, 1, :invite)'; - + $sql = 'UPDATE usr SET usr_login = "invite' . $usr_id . '" WHERE usr_id="' . $usr_id . '"'; $stmt = $conn->prepare($sql); - $stmt->execute(array( - ':login' => $login, - ':nonce' => $nonce, - ':password' => self::salt_password($password, $nonce), - ':email' => ($email ? $email : null), - ':admin' => ($admin ? '1' : '0'), - ':invite' => ($invite ? '1' : '0') - )); + $stmt->execute(); $stmt->closeCursor(); - - $usr_id = $conn->lastInsertId(); - - if ($invite) - { - $sql = 'UPDATE usr SET usr_login = "invite' . $usr_id . '" WHERE usr_id="' . $usr_id . '"'; - $stmt = $conn->prepare($sql); - $stmt->execute(); - $stmt->closeCursor(); - } - - return self::getInstance($usr_id, $appbox); - } - catch (Exception $e) - { - throw new Exception('Unable to create user : ' . $e->getMessage()); } + + return self::getInstance($usr_id, $appbox); } public static function salt_password($password, $nonce) @@ -1892,10 +1798,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return $this->nonce; $nonce = false; - $sql = 'SELECT nonce FROM usr WHERE usr_id = :usr_id '; + $sql = 'SELECT nonce FROM usr WHERE usr_id = :usr_id '; $stmt = $this->appbox->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); unset($stmt); diff --git a/lib/classes/User/Interface.class.php b/lib/classes/User/Interface.class.php index d1eaac9c11..d44f1c7b60 100644 --- a/lib/classes/User/Interface.class.php +++ b/lib/classes/User/Interface.class.php @@ -147,8 +147,6 @@ interface User_Interface public static function avLanguages(); - public static function detectLanguage(registryInterface $registry, $setLng = null); - public function setPrefs($prop, $value); public function getPrefs($prop); diff --git a/lib/classes/User/Query.class.php b/lib/classes/User/Query.class.php index 18fcadf804..d377b6491e 100644 --- a/lib/classes/User/Query.class.php +++ b/lib/classes/User/Query.class.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Doctrine\Common\Collections\ArrayCollection; + /** * * @package User @@ -137,30 +139,36 @@ class User_Query implements User_QueryInterface * @var int */ protected $results_quantity; - protected $include_phantoms = true; + protected $include_phantoms = true; protected $include_special_users = false; - protected $include_invite = false; + protected $include_invite = false; + protected $activities; + protected $templates; + protected $companies; + protected $countries; + protected $positions; + protected $in_ids; - const ORD_ASC = 'asc'; - const ORD_DESC = 'desc'; - const SORT_FIRSTNAME = 'usr_prenom'; - const SORT_LASTNAME = 'usr_nom'; - const SORT_COMPANY = 'societe'; - const SORT_LOGIN = 'usr_login'; - const SORT_EMAIL = 'usr_mail'; - const SORT_ID = 'usr_id'; + const ORD_ASC = 'asc'; + const ORD_DESC = 'desc'; + const SORT_FIRSTNAME = 'usr_prenom'; + const SORT_LASTNAME = 'usr_nom'; + const SORT_COMPANY = 'societe'; + const SORT_LOGIN = 'usr_login'; + const SORT_EMAIL = 'usr_mail'; + const SORT_ID = 'usr_id'; const SORT_CREATIONDATE = 'usr_creationdate'; - const SORT_COUNTRY = 'pays'; - const SORT_LASTMODEL = 'lastModel'; - const LIKE_FIRSTNAME = 'usr_prenom'; - const LIKE_LASTNAME = 'usr_nom'; - const LIKE_NAME = 'name'; - const LIKE_COMPANY = 'societe'; - const LIKE_LOGIN = 'usr_login'; - const LIKE_EMAIL = 'usr_mail'; - const LIKE_COUNTRY = 'pays'; - const LIKE_MATCH_AND = 'AND'; - const LIKE_MATCH_OR = 'OR'; + const SORT_COUNTRY = 'pays'; + const SORT_LASTMODEL = 'lastModel'; + const LIKE_FIRSTNAME = 'usr_prenom'; + const LIKE_LASTNAME = 'usr_nom'; + const LIKE_NAME = 'name'; + const LIKE_COMPANY = 'societe'; + const LIKE_LOGIN = 'usr_login'; + const LIKE_EMAIL = 'usr_mail'; + const LIKE_COUNTRY = 'pays'; + const LIKE_MATCH_AND = 'AND'; + const LIKE_MATCH_OR = 'OR'; /** * @@ -182,9 +190,11 @@ class User_Query implements User_QueryInterface return $this; } + protected $sql_params; + /** * - * @return Array + * @return \Doctrine\Common\Collections\ArrayCollection */ public function get_results() { @@ -197,7 +207,9 @@ class User_Query implements User_QueryInterface */ protected function generate_sql_constraints() { - $appbox = appbox::get_instance(); + $this->sql_params = array(); + + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $sql = ' @@ -231,6 +243,31 @@ class User_Query implements User_QueryInterface $sql .= ' AND (model_of=0 OR model_of = ' . $session->get_usr_id() . ' ) '; } + if ($this->activities) + { + $sql .= $this->generate_field_constraints('activite', $this->activities); + } + + if ($this->positions) + { + $sql .= $this->generate_field_constraints('fonction', $this->positions); + } + + if ($this->countries) + { + $sql .= $this->generate_field_constraints('pays', $this->countries); + } + + if ($this->companies) + { + $sql .= $this->generate_field_constraints('societe', $this->companies); + } + + if ($this->templates) + { + $sql .= $this->generate_field_constraints('lastModel', $this->templates); + } + $baslist = array(); if (count($this->base_ids) == 0) @@ -247,13 +284,13 @@ class User_Query implements User_QueryInterface if (count($not_base_id) > 0 && count($not_base_id) < count($this->base_ids)) { $sql .= sprintf(' AND ((base_id != %s ) ' . $extra . ')' - , implode(' AND base_id != ', $not_base_id) + , implode(' AND base_id != ', $not_base_id) ); } else { $sql .= sprintf(' AND (base_id = %s ' . $extra . ') ' - , implode(' OR base_id = ', $this->base_ids) + , implode(' OR base_id = ', $this->base_ids) ); } } @@ -273,17 +310,21 @@ class User_Query implements User_QueryInterface if (count($not_sbas_id) > 0 && count($not_sbas_id) < count($this->sbas_ids)) { $sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')' - , implode(' AND sbas_id != ', $not_sbas_id) + , implode(' AND sbas_id != ', $not_sbas_id) ); } else { $sql .= sprintf(' AND (sbas_id = %s ' . $extra . ') ' - , implode(' OR sbas_id = ', $this->sbas_ids) + , implode(' OR sbas_id = ', $this->sbas_ids) ); } } + if ($this->in_ids) + { + $sql .= 'AND (usr.usr_id = ' . implode(' OR usr.usr_id = ', $this->in_ids) . ')'; + } if ($this->have_rights) { @@ -307,6 +348,27 @@ class User_Query implements User_QueryInterface { switch ($like_field) { + case self::LIKE_NAME: + $qrys = array(); + foreach (explode(' ', $like_value) as $like_val) + { + if (trim($like_val) === '') + continue; + + $qrys[] = sprintf( + ' (usr.`%s` LIKE "%s%%" COLLATE utf8_unicode_ci + OR usr.`%s` LIKE "%s%%" COLLATE utf8_unicode_ci) ' + , self::LIKE_FIRSTNAME + , str_replace(array('"', '%'), array('\"', '\%'), $like_val) + , self::LIKE_LASTNAME + , str_replace(array('"', '%'), array('\"', '\%'), $like_val) + ); + } + + if (count($qrys) > 0) + $sql_like[] = ' (' . implode(' AND ', $qrys) . ') '; + + break; case self::LIKE_FIRSTNAME: case self::LIKE_LASTNAME: case self::LIKE_COMPANY: @@ -314,9 +376,9 @@ class User_Query implements User_QueryInterface case self::LIKE_LOGIN: case self::LIKE_COUNTRY: $sql_like[] = sprintf( - ' usr.`%s` LIKE "%s%%" COLLATE utf8_unicode_ci ' - , $like_field - , str_replace(array('"', '%'), array('\"', '\%'), $like_value) + ' usr.`%s` LIKE "%s%%" COLLATE utf8_unicode_ci ' + , $like_field + , str_replace(array('"', '%'), array('\"', '\%'), $like_value) ); break; default; @@ -331,6 +393,37 @@ class User_Query implements User_QueryInterface return $sql; } + protected function generate_field_constraints($fieldName, ArrayCollection $fields) + { + $n = 0; + $constraints = array(); + + foreach ($fields as $field) + { + $constraints[':' . $fieldName . $n++] = $field; + } + $sql = ' AND (' . $fieldName . ' = ' + . implode(' OR ' . $fieldName . ' = ', array_keys($constraints)) . ') '; + + $this->sql_params = array_merge($this->sql_params, $constraints); + + return $sql; + } + + public function in(array $usr_ids) + { + $tmp_usr_ids = array(); + + foreach ($usr_ids as $usr_id) + { + $tmp_usr_ids[] = (int) $usr_id; + } + + $this->in_ids = array_unique($tmp_usr_ids); + + return $this; + } + public function include_phantoms($boolean = true) { $this->include_phantoms = !!$boolean; @@ -459,18 +552,18 @@ class User_Query implements User_QueryInterface if (is_int($this->offset_start) && is_int($this->results_quantity)) { $sql .= sprintf( - ' LIMIT %d, %d' - , $this->offset_start - , $this->results_quantity + ' LIMIT %d, %d' + , $this->offset_start + , $this->results_quantity ); } $stmt = $conn->prepare($sql); - $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $users = array(); + $users = new ArrayCollection(); foreach ($rs as $row) { @@ -495,11 +588,11 @@ class User_Query implements User_QueryInterface $conn = $this->appbox->get_connection(); $sql_count = 'SELECT COUNT(DISTINCT usr.usr_id) as total ' - . $this->generate_sql_constraints(); + . $this->generate_sql_constraints(); $stmt = $conn->prepare($sql_count); - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->execute($this->sql_params); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -509,6 +602,7 @@ class User_Query implements User_QueryInterface if ($this->total > 0 && is_int($this->offset_start) && is_int($this->results_quantity)) { $this->page = floor($this->offset_start / $this->results_quantity) + 1; + $this->total_page = floor($this->total / $this->results_quantity) + 1; } return $this->total; @@ -525,6 +619,17 @@ class User_Query implements User_QueryInterface return $this->page; } + /** + * + * @return int + */ + public function get_total_page() + { + $this->get_total(); + + return $this->total_page; + } + /** * * @param ACL $ACL User's ACLs @@ -541,7 +646,7 @@ class User_Query implements User_QueryInterface else $this->base_ids = $baslist; - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -562,7 +667,7 @@ class User_Query implements User_QueryInterface else $this->sbas_ids = $sbaslist; - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -592,17 +697,17 @@ class User_Query implements User_QueryInterface public function like($like_field, $like_value) { - if ($like_field == self::LIKE_NAME) - { - $this->like_field[self::LIKE_FIRSTNAME] = trim($like_value); - $this->like_field[self::LIKE_LASTNAME] = trim($like_value); - } - else - { +// if ($like_field == self::LIKE_NAME) +// { +// $this->like_field[self::LIKE_FIRSTNAME] = trim($like_value); +// $this->like_field[self::LIKE_LASTNAME] = trim($like_value); +// } +// else +// { $this->like_field[trim($like_field)] = trim($like_value); - } +// } - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -624,7 +729,7 @@ class User_Query implements User_QueryInterface default: break; } - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -650,7 +755,7 @@ class User_Query implements User_QueryInterface else $this->base_ids = $base_ids; - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -675,7 +780,7 @@ class User_Query implements User_QueryInterface else $this->sbas_ids = $sbas_ids; - $this->total = $this->page = null; + $this->total = $this->page = $this->total_page = null; return $this; } @@ -695,6 +800,131 @@ class User_Query implements User_QueryInterface return $this; } + public function haveActivities(array $req_activities) + { + $Activities = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($req_activities as $activity) + { + $activity = trim($activity); + + if ($activity === '') + continue; + + if ($Activities->contains($activity)) + continue; + + $Activities->add($activity); + } + + if (!$Activities->isEmpty()) + { + $this->activities = $Activities; + } + + return $this; + } + + public function havePositions(array $req_positions) + { + $Positions = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($req_positions as $Position) + { + $Position = trim($Position); + + if ($Position === '') + continue; + + if ($Positions->contains($Position)) + continue; + + $Positions->add($Position); + } + + if (!$Positions->isEmpty()) + { + $this->positions = $Positions; + } + + return $this; + } + + public function inCountries(array $req_countries) + { + $Countries = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($req_countries as $Country) + { + $Country = trim($Country); + + if ($Country === '') + continue; + + if ($Countries->contains($Country)) + continue; + + $Countries->add($Country); + } + + if (!$Countries->isEmpty()) + { + $this->countries = $Countries; + } + + return $this; + } + + public function inCompanies(array $req_companies) + { + $Companies = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($req_companies as $Company) + { + $Company = trim($Company); + + if ($Company === '') + continue; + + if ($Companies->contains($Company)) + continue; + + $Companies->add($Company); + } + + if (!$Companies->isEmpty()) + { + $this->companies = $Companies; + } + + return $this; + } + + public function haveTemplate(array $req_templates) + { + $Templates = new \Doctrine\Common\Collections\ArrayCollection(); + + foreach ($req_templates as $Template) + { + $Template = trim($Template); + + if ($Template === '') + continue; + + if ($Templates->contains($Template)) + continue; + + $Templates->add($Template); + } + + if (!$Templates->isEmpty()) + { + $this->templates = $Templates; + } + + return $this; + } + /** * Wheter or not retrieve inactive users * (inactive users do not have the "access" right) @@ -709,4 +939,139 @@ class User_Query implements User_QueryInterface return $this; } + public function getRelatedActivities() + { + $conn = $this->appbox->get_connection(); + + $sql = 'SELECT DISTINCT usr.activite ' . $this->generate_sql_constraints(); + + $sql .= ' ORDER BY usr.activite'; + + $stmt = $conn->prepare($sql); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $activities = array(); + + foreach ($rs as $row) + { + if (trim($row['activite']) === '') + continue; + + $activities[] = $row['activite']; + } + + return $activities; + } + + public function getRelatedPositions() + { + $conn = $this->appbox->get_connection(); + + $sql = 'SELECT DISTINCT usr.fonction ' . $this->generate_sql_constraints(); + + $sql .= ' ORDER BY usr.fonction'; + + $stmt = $conn->prepare($sql); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $fonction = array(); + + foreach ($rs as $row) + { + if (trim($row['fonction']) === '') + continue; + + $fonction[] = $row['fonction']; + } + + return $fonction; + } + + public function getRelatedCountries() + { + require_once __DIR__ . '/../../classes/deprecated/countries.php'; + + $conn = $this->appbox->get_connection(); + + $sql = 'SELECT DISTINCT usr.pays ' . $this->generate_sql_constraints(); + + $sql .= ' ORDER BY usr.pays'; + + $stmt = $conn->prepare($sql); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $pays = array(); + + $ctry = \getCountries(\Session_Handler::get_locale()); + + foreach ($rs as $row) + { + if (trim($row['pays']) === '') + continue; + + if (isset($ctry[$row['pays']])) + $pays[$row['pays']] = $ctry[$row['pays']]; + } + + return $pays; + } + + public function getRelatedCompanies() + { + $conn = $this->appbox->get_connection(); + + $sql = 'SELECT DISTINCT usr.societe ' . $this->generate_sql_constraints(); + + $sql .= ' ORDER BY usr.societe'; + + $stmt = $conn->prepare($sql); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $societe = array(); + + foreach ($rs as $row) + { + if (trim($row['societe']) === '') + continue; + + $societe[] = $row['societe']; + } + + return $societe; + } + + public function getRelatedTemplates() + { + $conn = $this->appbox->get_connection(); + + $sql = 'SELECT DISTINCT usr.lastModel ' . $this->generate_sql_constraints(); + + $sql .= ' ORDER BY usr.lastModel'; + + $stmt = $conn->prepare($sql); + $stmt->execute($this->sql_params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $lastModel = array(); + + foreach ($rs as $row) + { + if (trim($row['lastModel']) === '') + continue; + + $lastModel[] = $row['lastModel']; + } + + return $lastModel; + } + } diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index 8e176f2fe1..5e3396b134 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -23,6 +23,7 @@ class appbox extends base * @var int */ protected $id; + /** * * @var appbox @@ -33,6 +34,7 @@ class appbox extends base * * constant defining the app type */ + const BASE_TYPE = self::APPLICATION_BOX; /** @@ -43,19 +45,21 @@ class appbox extends base protected $cache; protected $connection; protected $registry; + protected $Core; + const CACHE_LIST_BASES = 'list_bases'; - const CACHE_SBAS_IDS = 'sbas_ids'; + const CACHE_SBAS_IDS = 'sbas_ids'; /** * Singleton pattern * * @return appbox */ - public static function get_instance(registryInterface &$registry = null) + public static function get_instance(\Alchemy\Phrasea\Core $Core, registryInterface &$registry = null) { if (!self::$_instance instanceof self) { - self::$_instance = new self($registry); + self::$_instance = new self($Core, $registry); } return self::$_instance; @@ -66,21 +70,26 @@ class appbox extends base * * @return appbox */ - protected function __construct(registryInterface $registry=null) + protected function __construct(\Alchemy\Phrasea\Core $Core, registryInterface $registry = null) { - $this->connection = connection::getPDOConnection(); + $this->Core = $Core; if (!$registry) - $registry = registry::get_instance(); + $registry = registry::get_instance($Core); + $this->connection = connection::getPDOConnection(null, $registry); $this->registry = $registry; $this->session = Session_Handler::getInstance($this); - require dirname(__FILE__) . '/../../config/connexion.inc'; + $configuration = $Core->getConfiguration(); - $this->host = $hostname; - $this->port = $port; - $this->user = $user; - $this->passwd = $password; - $this->dbname = $dbname; + $choosenConnexion = $configuration->getPhraseanet()->get('database'); + + $connexion = $configuration->getConnexion($choosenConnexion); + + $this->host = $connexion->get('host'); + $this->port = $connexion->get('port'); + $this->user = $connexion->get('user'); + $this->passwd = $connexion->get('password'); + $this->dbname = $connexion->get('dbname'); return $this; } @@ -92,7 +101,7 @@ class appbox extends base * @param string $pic_type * @return appbox */ - public function write_collection_pic(collection $collection, system_file $pathfile=null, $pic_type) + public function write_collection_pic(collection $collection, system_file $pathfile = null, $pic_type) { if ($pathfile instanceof system_file) { @@ -103,14 +112,28 @@ class appbox extends base throw new Exception('Invalid file format'); } } - if (!in_array($pic_type, array(collection::PIC_LOGO, collection::PIC_WM, collection::PIC_STAMP, collection::PIC_PRESENTATION))) - throw new Exception('unknown pic_type'); + + switch($pic_type) + { + case collection::PIC_WM; + $collection->reset_watermark(); + break; + case collection::PIC_LOGO: + case collection::PIC_PRESENTATION: + break; + case collection::PIC_STAMP: + $collection->reset_stamp(); + break; + default: + throw new Exception('unknown pic_type'); + break; + } if ($pic_type == collection::PIC_LOGO) $collection->update_logo($pathfile); $registry = registry::get_instance(); - $file = $registry->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id(); + $file = $registry->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id(); if (is_file($file)) { unlink($file); @@ -152,7 +175,7 @@ class appbox extends base * @param $pic_type * @return appbox */ - public function write_databox_pic(databox $databox, system_file $pathfile=null, $pic_type) + public function write_databox_pic(databox $databox, system_file $pathfile = null, $pic_type) { if ($pathfile instanceof system_file) @@ -167,7 +190,7 @@ class appbox extends base if (!in_array($pic_type, array(databox::PIC_PDF))) throw new Exception('unknown pic_type'); $registry = $databox->get_registry(); - $file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id(); + $file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id(); if (is_file($file)) { unlink($file); @@ -212,8 +235,8 @@ class appbox extends base public function set_collection_order(collection $collection, $ordre) { $sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id"; - $stmt = $this->get_connection()->prepare($sqlupd); - $stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id())); + $stmt = $this->get_connection()->prepare($sqlupd); + $stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id())); $stmt->closeCursor(); $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS); @@ -230,12 +253,12 @@ class appbox extends base public function set_databox_indexable(databox $databox, $boolean) { $boolean = !!$boolean; - $sql = 'UPDATE sbas SET indexable = :indexable WHERE sbas_id = :sbas_id'; + $sql = 'UPDATE sbas SET indexable = :indexable WHERE sbas_id = :sbas_id'; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(array( - ':indexable' => ($boolean ? '1' : '0'), - ':sbas_id' => $databox->get_sbas_id() + ':indexable' => ($boolean ? '1' : '0'), + ':sbas_id' => $databox->get_sbas_id() )); $stmt->closeCursor(); @@ -253,7 +276,7 @@ class appbox extends base $stmt = $this->get_connection()->prepare($sql); $stmt->execute(array(':sbas_id' => $databox->get_sbas_id())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); $indexable = $row ? $row['indexable'] : null; @@ -270,13 +293,13 @@ class appbox extends base public function set_databox_viewname(databox $databox, $viewname) { $viewname = strip_tags($viewname); - $sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id'; + $sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id'; $stmt = $this->get_connection()->prepare($sql); - $stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $databox->get_sbas_id())); + $stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $databox->get_sbas_id())); $stmt->closeCursor(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES); cache_databox::update($databox->get_sbas_id(), 'structure'); @@ -294,7 +317,7 @@ class appbox extends base public function forceUpgrade(Setup_Upgrade &$upgrader) { - $upgrader->add_steps(7 + count($this->get_databoxes())); + $upgrader->add_steps(8 + count($this->get_databoxes())); $registry = $this->get_registry(); @@ -302,10 +325,24 @@ class appbox extends base * Step 1 */ $upgrader->set_current_message(_('Flushing cache')); - if ($this->get_cache()->ping()) + + $this->Core['CacheService']->flushAll(); + + $upgrader->add_steps_complete(1); + + + $upgrader->set_current_message(_('Creating new tables')); + $core = bootstrap::getCore(); + $em = $core->getEntityManager(); + //create schema + + if ($em->getConnection()->getDatabasePlatform()->supportsAlterTable()) { - $this->get_cache()->flush(); + $tool = new \Doctrine\ORM\Tools\SchemaTool($em); + $metas = $em->getMetadataFactory()->getAllMetadata(); + $tool->updateSchema($metas, true); } + $upgrader->add_steps_complete(1); /** @@ -345,7 +382,7 @@ class appbox extends base */ foreach ($this->get_databoxes() as $s) { - $upgrader->set_current_message(sprintf(_('Upgrading %s'),$s->get_viewname())); + $upgrader->set_current_message(sprintf(_('Upgrading %s'), $s->get_viewname())); $advices = array_merge($advices, $s->upgradeDB(true, $upgrader)); $upgrader->add_steps_complete(1); } @@ -362,10 +399,9 @@ class appbox extends base * Step 9 */ $upgrader->set_current_message(_('Flushing cache')); - if ($this->get_cache()->ping()) - { - $this->get_cache()->flush(); - } + + $this->Core['CacheService']->flushAll(); + $upgrader->add_steps_complete(1); return $advices; @@ -373,15 +409,17 @@ class appbox extends base protected function post_upgrade(Setup_Upgrade &$upgrader) { + $Core = bootstrap::getCore(); + $upgrader->add_steps(1 + count($this->get_databoxes())); - $this->apply_patches($this->get_version(), GV_version, true, $upgrader); - $this->setVersion(GV_version); + $this->apply_patches($this->get_version(), $Core->getVersion()->getNumber(), true, $upgrader); + $this->setVersion($Core->getVersion()->getNumber()); $upgrader->add_steps_complete(1); foreach ($this->get_databoxes() as $databox) { - $databox->apply_patches($databox->get_version(), GV_version, true, $upgrader); - $databox->setVersion(GV_version); + $databox->apply_patches($databox->get_version(), $Core->getVersion()->getNumber(), true, $upgrader); + $databox->setVersion($Core->getVersion()->getNumber()); $upgrader->add_steps_complete(1); } @@ -396,12 +434,14 @@ class appbox extends base * @param type $write_file * @return type */ - public static function create(registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false) + public static function create(\Alchemy\Phrasea\Core $Core, registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false) { $credentials = $conn->get_credentials(); if ($conn->is_multi_db() && trim($dbname) === '') - throw new Exception(_('Nom de base de donnee incorrect')); + { + throw new \Exception(_('Nom de base de donnee incorrect')); + } if ($write_file) { @@ -409,23 +449,67 @@ class appbox extends base { $credentials['dbname'] = $dbname; } - $connexion = dirname(__FILE__) . "/../../config/connexion.inc"; - if (is_file($connexion)) - unlink($connexion); - $EOL = PHP_EOL; - - $connexionINI = ' $value) { - $connexionINI .= '$' . $key . ' = "' . str_replace('"', '\"', $value) . '";' . $EOL; + $key = $key == 'hostname' ? 'host' : $key; + $connexionINI[$key] = (string) $value; } - if (!file_put_contents($connexion, $connexionINI, FILE_APPEND) !== false) - throw new Exception(sprintf(_('Impossible d\'ecrire dans le dossier %s'), dirname(dirname(__FILE__)) . "/config/")); + $Core->getConfiguration()->initialize(); + $connexionINI['driver'] = 'pdo_mysql'; + $connexionINI['charset'] = 'UTF8'; - if (function_exists('chmod')) - chmod($connexion, 0700); + $serverName = $registry->get('GV_ServerName'); + + $root = __DIR__ . '/../../'; + + $connexion = array( + 'main_connexion' => $connexionINI, + 'test_connexion' => array( + 'driver' => 'pdo_sqlite', + 'path' => realpath($root . 'lib/unitTest') . '/tests.sqlite', + 'charset' => 'UTF8' + )); + + $cacheService = "array_cache"; + + $Core->getConfiguration()->setConnexions($connexion); + + $services = $Core->getConfiguration()->getConfigurations(); + + foreach ($services as $serviceName => $service) + { + if ($serviceName === "doctrine_prod") + { + + $services["doctrine_prod"]["options"]["cache"] = array( + "query" => $cacheService, + "result" => $cacheService, + "metadata" => $cacheService + ); + } + } + $Core->getConfiguration()->setConfigurations($services); + + $arrayConf = $Core->getConfiguration()->getConfigurations(); + + foreach ($arrayConf as $key => $value) + { + if (is_array($value) && array_key_exists('phraseanet', $value)) + { + $arrayConf[$key]["phraseanet"]["servername"] = $serverName; + } + + if (is_array($value) && $key === 'prod') + { + $arrayConf[$key]["cache"] = $cacheService; + } + } + + $Core->getConfiguration()->setConfigurations($arrayConf); + + $Core->getConfiguration()->setEnvironnement('prod'); } try { @@ -454,7 +538,7 @@ class appbox extends base try { - $appbox = self::get_instance($registry); + $appbox = self::get_instance($Core, $registry); $appbox->insert_datas(); } catch (Exception $e) @@ -511,7 +595,7 @@ class appbox extends base $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -545,7 +629,7 @@ class appbox extends base public static function list_databox_templates() { $files = array(); - $dir = new DirectoryIterator(dirname(__FILE__) . '/../conf.d/data_templates/'); + $dir = new DirectoryIterator(__DIR__ . '/../conf.d/data_templates/'); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index 2aaab24e52..f5d87a5270 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -60,11 +60,12 @@ abstract class base implements cache_cacheableInterface /** * */ + const APPLICATION_BOX = 'APPLICATION_BOX'; /** * */ - const DATA_BOX = 'DATA_BOX'; + const DATA_BOX = 'DATA_BOX'; /** * @@ -161,14 +162,12 @@ abstract class base implements cache_cacheableInterface return $this->connection; } - /** - * - * @return cache_adapter - */ public function get_cache() { if (!$this->cache) - $this->cache = cache_adapter::get_instance($this->get_registry()); + { + $this->cache = $this->Core->getCache(); + } return $this->cache; } @@ -180,12 +179,18 @@ abstract class base implements cache_cacheableInterface */ public function get_data_from_cache($option = null) { + + if ($this->get_base_type() == self::DATA_BOX) + { + \cache_databox::refresh($this->id); + } + return $this->get_cache()->get($this->get_cache_key($option)); } public function set_data_to_cache($value, $option = null, $duration = 0) { - return $this->get_cache()->set($this->get_cache_key($option), $value, $duration); + return $this->get_cache()->save($this->get_cache_key($option), $value, $duration); } public function delete_data_from_cache($option = null) @@ -242,9 +247,9 @@ abstract class base implements cache_cacheableInterface if ($sql !== '') { - $stmt = $this->get_connection()->prepare($sql); + $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if ($row) $version = $row['version']; @@ -259,7 +264,7 @@ abstract class base implements cache_cacheableInterface { if ($this->get_version()) - return version_compare(GV_version, $this->get_version(), '>'); + return version_compare(\Alchemy\Phrasea\Core\Version::getNumber(), $this->get_version(), '>'); else return true; @@ -267,8 +272,6 @@ abstract class base implements cache_cacheableInterface protected function upgradeDb($apply_patches, Setup_Upgrade &$upgrader) { - require_once dirname(__FILE__) . '/../version.inc'; - $recommends = array(); $allTables = array(); @@ -280,13 +283,25 @@ abstract class base implements cache_cacheableInterface $upgrader->add_steps(count($allTables) + 1); - $sql = "SHOW TABLE STATUS"; + $sql = "SHOW TABLE STATUS"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); + $ORMTables = array( + 'BasketElements', + 'Baskets', + 'StoryWZ', + 'UsrListOwners', + 'UsrLists', + 'UsrListsContent', + 'ValidationDatas', + 'ValidationParticipants', + 'ValidationSessions', + ); + foreach ($rs as $row) { $tname = $row["Name"]; @@ -295,7 +310,7 @@ abstract class base implements cache_cacheableInterface { $upgrader->set_current_message(sprintf(_('Updating table %s'), $tname)); - $engine = strtolower(trim($allTables[$tname]->engine)); + $engine = strtolower(trim($allTables[$tname]->engine)); $ref_engine = strtolower($row['Engine']); if ($engine != $ref_engine && in_array($engine, array('innodb', 'myisam'))) @@ -310,22 +325,22 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $recommends[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $sql + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $sql ); } } - $ret = self::upgradeTable($allTables[$tname]); + $ret = self::upgradeTable($allTables[$tname]); $recommends = array_merge($recommends, $ret); unset($allTables[$tname]); $upgrader->add_steps_complete(1); } - else + elseif (!in_array($tname, $ORMTables)) { $recommends[] = array( - 'message' => 'Une table pourrait etre supprime', - 'sql' => 'DROP TABLE ' . $this->dbname . '.`' . $tname . '`;' + 'message' => 'Une table pourrait etre supprime', + 'sql' => 'DROP TABLE ' . $this->dbname . '.`' . $tname . '`;' ); } } @@ -338,10 +353,12 @@ abstract class base implements cache_cacheableInterface } $current_version = $this->get_version(); + $Core = bootstrap::getCore(); + $upgrader->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); if ($apply_patches) { - $this->apply_patches($current_version, GV_version, false, $upgrader); + $this->apply_patches($current_version, $Core->getVersion()->getNumber(), false, $upgrader); } $upgrader->add_steps_complete(1); @@ -390,7 +407,7 @@ abstract class base implements cache_cacheableInterface return $this; - $structure = simplexml_load_file(dirname(__FILE__) . "/../../lib/conf.d/bases_structure.xml"); + $structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml"); if (!$structure) throw new Exception('Unable to load schema'); @@ -418,8 +435,8 @@ abstract class base implements cache_cacheableInterface $this->createTable($table); } - if (defined('GV_version')) - $this->setVersion(GV_version); + $Core = bootstrap::getCore(); + $this->setVersion($Core->getVersion()->getNumber()); return $this; } @@ -431,7 +448,7 @@ abstract class base implements cache_cacheableInterface */ protected function createTable(SimpleXMLElement $table) { - $field_stmt = $defaults_stmt = array(); + $field_stmt = $defaults_stmt = array(); $create_stmt = "CREATE TABLE `" . $table['name'] . "` ("; @@ -448,8 +465,8 @@ abstract class base implements cache_cacheableInterface $character_set = ''; if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) - || substr(strtolower((string) $field->type), 0, 7) == 'varchar' - || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) + || substr(strtolower((string) $field->type), 0, 7) == 'varchar' + || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) { $collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci'; @@ -460,8 +477,8 @@ abstract class base implements cache_cacheableInterface } $field_stmt[] = " `" . $field->name . "` " . $field->type . " " - . $field->extra . " " . $character_set . " " - . $is_default . " " . $isnull . ""; + . $field->extra . " " . $character_set . " " + . $is_default . " " . $isnull . ""; } @@ -479,7 +496,7 @@ abstract class base implements cache_cacheableInterface $primary_fields[] = "`" . $field . "`"; } - $field_stmt[] = 'PRIMARY KEY (' . implode(',', $primary_fields) . ')'; + $field_stmt[] = 'PRIMARY KEY (' . implode(',', $primary_fields) . ')'; break; case "UNIQUE": $unique_fields = array(); @@ -508,32 +525,32 @@ abstract class base implements cache_cacheableInterface { foreach ($table->defaults->default as $default) { - $k = $v = $params = $dates_values = array(); + $k = $v = $params = $dates_values = array(); $nonce = random::generatePassword(16); foreach ($default->data as $data) { - $k = trim($data['key']); + $k = trim($data['key']); if ($k === 'usr_password') $data = User_Adapter::salt_password($data, $nonce); if ($k === 'nonce') $data = $nonce; - $v = trim(str_replace(array("\r\n", "\r", "\n", "\t"), '', $data)); + $v = trim(str_replace(array("\r\n", "\r", "\n", "\t"), '', $data)); if (trim(mb_strtolower($v)) == 'now()') $dates_values [$k] = 'NOW()'; else - $params[$k] = (trim(mb_strtolower($v)) == 'null' ? null : $v); + $params[$k] = (trim(mb_strtolower($v)) == 'null' ? null : $v); } $separator = ((count($params) > 0 && count($dates_values) > 0) ? ', ' : ''); $defaults_stmt[] = array( - 'sql' => - 'INSERT INTO `' . $table['name'] . '` (' . implode(', ', array_keys($params)) - . $separator . implode(', ', array_keys($dates_values)) . ') + 'sql' => + 'INSERT INTO `' . $table['name'] . '` (' . implode(', ', array_keys($params)) + . $separator . implode(', ', array_keys($dates_values)) . ') VALUES (:' . implode(', :', array_keys($params)) - . $separator . implode(', ', array_values($dates_values)) . ') ' - , 'params' => $params + . $separator . implode(', ', array_values($dates_values)) . ') ' + , 'params' => $params ); } } @@ -559,8 +576,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $recommends[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $def['sql'] + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $def['sql'] ); } } @@ -571,7 +588,7 @@ abstract class base implements cache_cacheableInterface protected function upgradeTable(SimpleXMLElement $table) { $correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array()); - $alter = $alter_pre = $return = array(); + $alter = $alter_pre = $return = array(); $registry = registry::get_instance(); @@ -586,8 +603,8 @@ abstract class base implements cache_cacheableInterface $collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci'; if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) - || substr(strtolower((string) $field->type), 0, 7) == 'varchar' - || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) + || substr(strtolower((string) $field->type), 0, 7) == 'varchar' + || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) { $code = array_pop(array_reverse(explode('_', $collation))); @@ -615,7 +632,7 @@ abstract class base implements cache_cacheableInterface foreach ($table->indexes->index as $index) { $i_name = (string) $index->name; - $expr = array(); + $expr = array(); foreach ($index->fields->field as $field) $expr[] = '`' . trim((string) $field) . '`'; @@ -627,25 +644,25 @@ abstract class base implements cache_cacheableInterface $correct_table['indexes']['PRIMARY'] = 'PRIMARY KEY (' . $expr . ')'; break; case "UNIQUE": - $correct_table['indexes'][$i_name] = 'UNIQUE KEY `' . $i_name . '` (' . $expr . ')'; + $correct_table['indexes'][$i_name] = 'UNIQUE KEY `' . $i_name . '` (' . $expr . ')'; break; case "INDEX": - $correct_table['indexes'][$i_name] = 'KEY `' . $i_name . '` (' . $expr . ')'; + $correct_table['indexes'][$i_name] = 'KEY `' . $i_name . '` (' . $expr . ')'; break; } } } - $sql = "SHOW FULL FIELDS FROM `" . $table['name'] . "`"; + $sql = "SHOW FULL FIELDS FROM `" . $table['name'] . "`"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs2 as $row2) { - $f_name = $row2['Field']; + $f_name = $row2['Field']; $expr_found = trim($row2['Type']); $_extra = $row2['Extra']; @@ -724,8 +741,8 @@ abstract class base implements cache_cacheableInterface else { $return[] = array( - 'message' => 'Un champ pourrait etre supprime', - 'sql' => "ALTER TABLE " . $this->dbname . ".`" . $table['name'] . "` DROP `$f_name`;" + 'message' => 'Un champ pourrait etre supprime', + 'sql' => "ALTER TABLE " . $this->dbname . ".`" . $table['name'] . "` DROP `$f_name`;" ); } } @@ -736,16 +753,16 @@ abstract class base implements cache_cacheableInterface } $tIndex = array(); - $sql = "SHOW INDEXES FROM `" . $table['name'] . "`"; + $sql = "SHOW INDEXES FROM `" . $table['name'] . "`"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs2 as $row2) { if (!isset($tIndex[$row2['Key_name']])) - $tIndex[$row2['Key_name']] = array('unique' => ((int) ($row2['Non_unique']) == 0), 'columns' => array()); + $tIndex[$row2['Key_name']] = array('unique' => ((int) ($row2['Non_unique']) == 0), 'columns' => array()); $tIndex[$row2['Key_name']]['columns'][(int) ($row2['Seq_in_index'])] = $row2['Column_name']; } @@ -783,8 +800,8 @@ abstract class base implements cache_cacheableInterface else { $return[] = array( - 'message' => 'Un index pourrait etre supprime', - 'sql' => 'ALTER TABLE ' . $this->dbname . '.`' . $table['name'] . '` DROP ' . $full_name_index . ';' + 'message' => 'Un index pourrait etre supprime', + 'sql' => 'ALTER TABLE ' . $this->dbname . '.`' . $table['name'] . '` DROP ' . $full_name_index . ';' ); } } @@ -803,8 +820,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $return[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $a + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $a ); } } @@ -820,8 +837,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $return[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $a + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $a ); } } @@ -832,8 +849,9 @@ abstract class base implements cache_cacheableInterface protected function apply_patches($from, $to, $post_process, Setup_Upgrade &$upgrader) { if (version_compare($from, $to, '=')) - + { return true; + } $list_patches = array(); @@ -878,23 +896,16 @@ abstract class base implements cache_cacheableInterface } $upgrader->add_steps_complete(1) - ->add_steps(count($list_patches)) - ->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); + ->add_steps(count($list_patches)) + ->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); ksort($list_patches); $success = true; foreach ($list_patches as $patch) { - try - { if (!$patch->apply($this)) $success = false; - } - catch(Exception $e) - { - $success = false; - } $upgrader->add_steps_complete(1); } diff --git a/lib/classes/basket/adapter.class.php b/lib/classes/basket/adapter.class.php deleted file mode 100644 index 3120d93ec8..0000000000 --- a/lib/classes/basket/adapter.class.php +++ /dev/null @@ -1,1996 +0,0 @@ -base_id; - } - - /** - * - * @return User_Adapter - */ - public function get_pusher() - { - return $this->pusher; - } - - /** - * - * @return DateTime - */ - public function get_create_date() - { - return $this->created_on; - } - - /** - * - * @return DateTime - */ - public function get_update_date() - { - return $this->updated_on; - } - - /** - * - * @return int - */ - public function get_record_id() - { - return $this->record_id; - } - - /** - * - * @return boolean - */ - public function is_mine() - { - return $this->is_mine; - } - - /** - * - * @return boolean - */ - public function is_grouping() - { - return $this->is_grouping; - } - - /** - * - * @return string - */ - public function get_name() - { - return $this->name; - } - - /** - * - * @return string - */ - public function get_description() - { - return $this->desc; - } - - /** - * - * @return int - */ - public function get_ssel_id() - { - return $this->ssel_id; - } - - /** - * - * @return array - */ - public function get_validating_users() - { - return $this->validating_users; - } - - /** - * - * @return basket_element_adapter - */ - public function get_elements() - { - if (!$this->elements) - $this->load_elements(); - - return $this->elements; - } - - /** - * - * @return int - */ - public function get_sbas_id() - { - return $this->sbas_id; - } - - /** - * - * @return boolean - */ - public function is_valid() - { - return in_array($this->valid, array('valid', 'myvalid')); - } - - /** - * - * @return boolean - */ - public function is_my_valid() - { - return $this->valid == 'myvalid'; - } - - /** - * - * @return boolean - */ - public function is_unread() - { - return $this->noview; - } - - /** - * - * @return basket_element_adapter - */ - public function get_first_element() - { - foreach ($this->get_elements() as $basket_element) - - return $basket_element; - return null; - } - - /** - * - * @return DateTime - */ - public function get_validation_end_date() - { - if (!$this->valid || !$this->validation_end_date) - - return null; - return $this->validation_end_date; - } - - /** - * - * @return boolean - */ - public function is_validation_finished() - { - if (!$this->valid || !$this->validation_end_date) - - return null; - $now = new DateTime(); - - return ($now > $this->validation_end_date); - } - - /** - * - * @return boolean - */ - public function is_confirmed() - { - if (!$this->valid) - - return null; - - return $this->validation_is_confirmed; - } - - public function is_releasable() - { - if (!$this->valid) - - return false; - - if ($this->is_confirmed()) - - return false; - - foreach ($this->get_elements() as $element) - { - if ($element->get_my_agreement() == '0') - - return false; - } - - return true; - } - - /** - * - * @param const $option - * @return string - */ - public function get_cache_key($option = null) - { - return 'basket_' . $this->usr_id . '_' . $this->ssel_id . ($option ? '_' . $option : ''); - } - - /** - * - * @param $option - * @return - */ - public function get_data_from_cache($option = null) - { - return $this->appbox->get_data_from_cache($this->get_cache_key($option)); - } - - /** - * - * @param $value - * @param $option - * @param $duration - * @return - */ - public function set_data_to_cache($value, $option = null, $duration = 0) - { - return $this->appbox->set_data_to_cache($value, $this->get_cache_key($option), $duration); - } - - /** - * - * @param $option - * @return - */ - public function delete_data_from_cache($option = null) - { - if ($option === self::CACHE_ELEMENTS) - $this->elements = null; - - return $this->appbox->delete_data_from_cache($this->get_cache_key($option)); - } - - /** - * - * @param appbox $appbox - * @param int $ssel_id - * @param int $usr_id - * @return basket_adapter - */ - protected function __construct(appbox &$appbox, $ssel_id, $usr_id) - { - $this->instance_key = 'basket_' . $usr_id . '_' . $ssel_id; - $this->appbox = $appbox; - $this->ssel_id = (int) $ssel_id; - $this->usr_id = $usr_id; - - $this->load(); - - if ($this->valid) - $this->load_validation_users(); - - return $this; - } - - protected function load() - { - - try - { - $datas = $this->get_data_from_cache(); - - $this->sbas_id = $datas['sbas_id']; - $this->record_id = $datas['record_id']; - $this->is_grouping = $datas['is_grouping']; - $this->pusher = $datas['pusher_id'] ? User_Adapter::getInstance($datas['pusher_id'], $this->appbox) : null; - $this->validation_is_confirmed = $datas['validation_is_confirmed']; - $this->validation_end_date = $datas['validation_end_date']; - $this->validation_see_others = $datas['validation_see_others']; - $this->valid = $datas['valid']; - $this->is_mine = $datas['is_mine']; - $this->noview = $datas['noview']; - $this->updated_on = $datas['updated_on']; - $this->created_on = $datas['created_on']; - $this->name = $datas['name']; - $this->desc = $datas['desc']; - - return $this; - } - catch (Exception $e) - { - - } - - $sql = 'SELECT s.pushFrom, n.id as noview, s.usr_id as owner, s.rid - , s.sbas_id, s.temporaryType, s.name, s.descript, s.pushFrom - , s.date, s.updater - , v.id as validate_id, v.can_see_others, v.expires_on, v.confirmed - FROM ssel s - LEFT JOIN validate v - ON (s.ssel_id = v.ssel_id AND v.usr_id = :validate_usr_id) - LEFT JOIN sselnew n - ON (n.usr_id = :receive_usr_id AND n.ssel_id = s.ssel_id) - WHERE s.ssel_id = :ssel_id - AND (s.usr_id = :usr_id OR v.id IS NOT NULL)'; - - $params = array( - ':usr_id' => $this->usr_id, - ':receive_usr_id' => $this->usr_id, - ':validate_usr_id' => $this->usr_id, - ':ssel_id' => $this->ssel_id - ); - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if (!$row) - throw new Exception_Basket_NotFound(); - - $this->name = $row['name']; - $this->desc = $row['descript']; - $this->created_on = new DateTime($row['date']); - $this->updated_on = new DateTime($row['updater']); - $this->noview = !!$row['noview']; - - $this->is_mine = ($row['owner'] == $this->usr_id); - - if ($row['validate_id'] != null) - { - $this->valid = 'valid'; - if ($this->is_mine) - { - $this->valid = 'myvalid'; - $this->validation_see_others = true; - } - elseif ($row['can_see_others'] == '1') - { - $this->validation_see_others = true; - } - $this->validation_end_date = $row['expires_on'] ? new DateTime($row['expires_on']) : null; - $this->validation_is_confirmed = !!$row['confirmed']; - - $this->load_validation_users(); - } - - - if ((int) $row['pushFrom'] > 0) - { - try - { - $this->pusher = User_Adapter::getInstance($row['pushFrom'], $this->appbox); - } - catch (Exception $e) - { - - } - } - - $this->is_grouping = ($row['temporaryType'] == 1); - if ($this->is_grouping) - { - $this->record_id = $row['rid']; - $this->sbas_id = $row['sbas_id']; - } - - $pusher_id = $this->pusher instanceof User_Adapter ? $this->pusher->get_id() : null; - - $datas = array( - 'sbas_id' => $this->sbas_id - , 'record_id' => $this->record_id - , 'is_grouping' => $this->is_grouping - , 'pusher_id' => $pusher_id - , 'validation_is_confirmed' => $this->validation_is_confirmed - , 'validation_end_date' => $this->validation_end_date - , 'validation_see_others' => $this->validation_see_others - , 'valid' => $this->valid - , 'is_mine' => $this->is_mine - , 'noview' => $this->noview - , 'updated_on' => $this->updated_on - , 'created_on' => $this->created_on - , 'name' => $this->name - , 'desc' => $this->desc - ); - - $this->set_data_to_cache($datas); - - return $this; - } - - /** - * - * @param $order - * @return basket_adapter - */ - public function sort($order) - { - if (!$this->valid || !in_array($order, array('asc', 'desc'))) - - return; - - $this->load_elements(); - - if ($order == 'asc') - uasort($this->elements, array('basket_adapter', 'order_validation_asc')); - else - uasort($this->elements, array('basket_adapter', 'order_validation_desc')); - - return $this; - } - - /** - * - * @todo change this shit - * @param mixed $lst - * @param boolean $fixing - * @return array - */ - public function push_list($lst, $fixing) - { - $ret = array('error' => false, 'datas' => array()); - - if (!is_array($lst)) - $lst = explode(';', $lst); - - foreach ($lst as $basrec) - { - try - { - if (!is_array($basrec)) - $basrec = explode('_', $basrec); - if (count($basrec) != 2) - continue; - $sbas_id = $basrec[0]; - $record = new record_adapter($sbas_id, $basrec[1]); - $push = $this->push_element($record, $this->record_id, $fixing); - unset($record); - if ($push['error']) - $ret['error'] = $push['error']; - else - $ret['datas'] = array_merge($ret['datas'], $push['datas']); - } - catch (Exception_Record_AdapterNotFound $e) - { - - } - catch (Exception $e) - { - $ret['error'] = "an error occured"; - } - } - - return $ret; - } - - /** - * - * @param record_Interface $record - * @param int $parent_record_id - * @param boolean $fixing - * @return array - */ - public function push_element(record_Interface $record, $parent_record_id, $fixing) - { - $base_id = $record->get_base_id(); - $record_id = $record->get_record_id(); - if ($parent_record_id === true && phrasea::sbasFromBas($base_id) != $this->sbas_id) - { - return array( - 'error' => _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre'), - 'datas' => array() - ); - } - - if ($this->valid && !$this->is_mine) - { - return array('error' => _('Ce panier est en lecture seule'), 'datas' => array()); - } - - try - { - $sselcont_id = basket_element_adapter::create($this, $base_id, $record_id, $parent_record_id, $this->valid, $fixing); - - $this->add_element($sselcont_id); - - $this->delete_data_from_cache(self::CACHE_ELEMENTS); - - $ret['error'] = false; - $ret['datas'] = array($sselcont_id->get_sselcont_id()); - } - catch (Exception $e) - { - $ret['error'] = $e->getMessage(); - $ret['datas'] = array(); - } - - return $ret; - } - - /** - * - * @return string - */ - public function get_excerpt() - { - $ret = ''; - - $i = 0; - - foreach ($this->get_elements() as $basket_element) - { - $i++; - if ($i > 9) - break; - - $thumbnail = $basket_element->get_record()->get_thumbnail(); - - $ratio = $thumbnail->get_width() / $thumbnail->get_height(); - $top = $left = 0; - if ($thumbnail->get_width() > $thumbnail->get_height())//paysage - { - $h = 80; - $w = $h * $ratio; - $left = round((80 - $w) / 2); - } - else - { - $w = 80; - $h = $w / $ratio; - $top = round((80 - $h) / 2); - } - $ret .= '
- -
'; - } - - return $ret; - } - - /** - * - * Return the total HD size of documents inside the basket - * @return - */ - public function get_size() - { - $totSize = 0; - $session = $this->appbox->get_session(); - - foreach ($this->get_elements() as $basket_element) - { - try - { - $sd = $basket_element->get_record()->get_subdef('document'); - $totSize += $sd->get_size(); - } - catch (Exception $e) - { - - } - } - - $totSize = round($totSize / (1024 * 1024), 2); - - return $totSize; - } - - /** - * - * @return - */ - public function getOrderDatas() - { - $out = ''; - $n = 0; - - foreach ($this->get_elements() as $basket_element) - { - $thumbnail = $basket_element->get_record()->get_thumbnail(); - if ($thumbnail->get_width() > $thumbnail->get_height()) - { - $h = (int) (82 * $thumbnail->get_height() / $thumbnail->get_width()); - $w = 82; - } - else - { - $w = (int) (82 * $thumbnail->get_width() / $thumbnail->get_height()); - $h = 82; - } - - $title = $basket_element->get_record()->get_title(); - $record = $basket_element->get_record(); - - $out .= '
' . - '
- ' . $title . '
' . - ''; - $out .= '
- '; - - $out .= ''; - - $out .= ' - - -
'; - $out .= '
'; - - $n++; - } - - return $out . '
- -
'; - } - - /** - * Save re-ordered basket - * @param Json serialized array - * @return Json serialized array - */ - public function saveOrderDatas($value) - { - $conn = connection::getPDOConnection(); - - $conn->beginTransaction(); - - $error = false; - - $value = json_decode($value); - - $rid_parent = (int) $this->record_id; - $ssel_id = (int) $this->ssel_id; - $sbas_id = (int) $this->sbas_id; - - $cacheusers = array(); - $sselcont_equiv = array(); - - - if ($this->is_grouping) - { - $sql = 'SELECT c1.sselcont_id, s.usr_id, s.ssel_id, c2.sselcont_id as equiv FROM sselcont c1, sselcont c2, ssel s - WHERE temporaryType="1" AND s.rid = :record_id AND s.sbas_id = :sbas_id - AND s.ssel_id = c1.ssel_id AND s.ssel_id != :ssel_id_dif AND c1.base_id = c2.base_id - AND c1.record_id = c2.record_id AND c2.ssel_id = :ssel_id'; - - $params = array( - ':record_id' => $this->get_record_id() - , ':sbas_id' => $this->get_sbas_id() - , ':ssel_id_dif' => $this->get_ssel_id() - , ':ssel_id' => $ssel_id - ); - - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - if (!isset($cacheusers[$row['usr_id']])) - $cacheusers[$row['usr_id']] = array(); - - $cacheusers[$row['usr_id']][$row['ssel_id']] = $row['ssel_id']; - - $sselcont_equiv[$row['equiv']][] = $row['sselcont_id']; - } - } - - foreach ($value as $id => $infos) - { - $infos->order = trim($infos->order); - $infos->record_id = (int) $infos->record_id; - $id = trim($id); - - if ($this->is_grouping) - { - try - { - $connbas = connection::getPDOConnection($sbas_id); - - $sql = 'UPDATE regroup SET ord = :ordre - WHERE rid_parent = :record_id_parent - AND rid_child = :record_id'; - - $params = array( - ':ordre' => $infos->order - , ':record_id_parent' => $rid_parent - , ':record_id' => $infos->record_id - ); - - $stmt = $connbas->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - - if (isset($sselcont_equiv[trim($id)])) - { - try - { - $sql = "UPDATE sselcont SET ord = :ordre'' - WHERE sselcont_id IN (" . implode(', ', $sselcont_equiv[$id]) . ")"; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':ordre' => $infos->order)); - $stmt->closeCursor(); - } - catch (Exception $e) - { - - } - } - } - catch (Exception $e) - { - $error = true; - } - } - - try - { - $sql = "UPDATE sselcont SET ord = :ordre - WHERE sselcont_id = :sselcont_id AND ssel_id = :ssel_id"; - - $params = array( - ':ordre' => $infos->order - , ':sselcont_id' => $id - , ':ssel_id' => $ssel_id - ); - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - } - catch (Exception $e) - { - $error = true; - } - } - - foreach ($cacheusers as $usr_id => $ssel_ids) - { - foreach ($ssel_ids as $ssel_id) - { - $basket_usr = self::getInstance($this->appbox, $ssel_id, $usr_id); - $basket_usr->set_unread(); - } - } - - if (!$error) - { - $conn->commit(); - } - else - { - $conn->rollBack(); - } - $this->delete_cache(); - - $ret = array('error' => $error); - - return p4string::jsonencode($ret); - } - - /** - * Delete the basket - * @return boolean - */ - public function delete() - { - $sql = 'DELETE FROM ssel WHERE ssel_id = :ssel_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id)); - $stmt->closeCursor(); - - $sql = 'DELETE FROM sselcont WHERE ssel_id = :ssel_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id)); - $stmt->closeCursor(); - - $sql = 'DELETE FROM sselnew WHERE ssel_id = :ssel_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id)); - $stmt->closeCursor(); - - $this->delete_cache(); - unset(self::$_instance[$this->instance_key]); - - return false; - } - - /** - * Set the basket unread for the user - * @return boolean - */ - public function set_unread($usr_id = null) - { - if (is_null($usr_id)) - $usr_id = $this->usr_id; - - try - { - $sql = 'INSERT INTO sselnew (id, ssel_id, usr_id) - VALUES (null, :ssel_id, :usr_id)'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id, ':usr_id' => $usr_id)); - $stmt->closeCursor(); - - $this->noview = true; - } - catch (Exception $e) - { - return false; - } - $this->delete_cache(); - - return true; - } - - /** - * Set the basket read for the user - * @return boolean - */ - public function set_read() - { - if (!$this->noview) - - return true; - $session = $this->appbox->get_session(); - - try - { - $sql = 'DELETE FROM sselnew WHERE ssel_id = :ssel_id AND usr_id = :usr_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id, ':usr_id' => $session->get_usr_id())); - $stmt->closeCursor(); - - $this->noview = false; - } - catch (Exception $e) - { - return false; - } - $this->delete_cache(); - - return true; - } - - /** - * Add users to the validation process - * - * @param Integer $usr_id - * @param boolean $can_agree - * @param boolean $can_see_others - * @param boolean $can_hd - * @param DateTime $expire - */ - public function validation_to_users(User_Adapter $user, $can_agree, $can_see_others, $can_hd, DateTime $expire = null) - { - try - { - $sql = 'REPLACE INTO validate (id, ssel_id, created_on, updated_on, expires_on, - last_reminder, usr_id, confirmed, can_agree, can_see_others) - VALUES - (null, :ssel_id, NOW(), NOW(), :expire, - null, :usr_id, 0, :can_agree, :can_see_others)'; - - $stmt = $this->appbox->get_connection()->prepare($sql); - - $params = array( - ':ssel_id' => $this->ssel_id - , ':expire' => (is_null($expire) ? null : $expire->format(DATE_ISO8601)) - , ':usr_id' => $user->get_id() - , ':can_agree' => ($can_agree ? '1' : '0') - , ':can_see_others' => ($can_see_others ? '1' : '0') - ); - - $stmt->execute($params); - $insert_id = $this->appbox->get_connection()->lastInsertId(); - $stmt->closeCursor(); - - $me = User_Adapter::getInstance($this->appbox->get_session()->get_usr_id(), $this->appbox); - - foreach ($this->get_elements() as $basket_element) - { - $basket_element->validate($me, $user, $insert_id, $can_hd); - - if ($can_hd && $me->ACL()->has_hd_grant($basket_element->get_record())) - $user->ACL()->grant_hd_on($basket_element->get_record(), $me, 'validate'); - else - $user->ACL()->grant_preview_on($basket_element->get_record(), $me, 'validate'); - } - - $this->valid = 'myvalid'; - - $this->set_unread($user->get_id()); - $this->delete_data_from_cache(self::CACHE_VALIDATING_USERS); - } - catch (Exception $e) - { - return false; - } - - $this->delete_cache(); - - return true; - } - - /** - * - * @param databox_descriptionStructure $meta_struct - * @return - */ - public function searchRegFields(databox_descriptionStructure $meta_struct) - { - $fields = null; - $fields["regname"] = ""; - $fields["regdesc"] = ""; - $fields["regdate"] = ""; - - foreach ($meta_struct as $meta) - { - if ($meta->is_regname()) - $fields["regname"] = $meta->get_id(); - elseif ($meta->is_regdesc()) - $fields["regdesc"] = $meta->get_id(); - elseif ($meta->is_regdate()) - $fields['regdate'] = $meta->get_id(); - } - - return $fields; - } - - /** - * - * @return string - */ - public function get_validation_infos() - { - if ($this->is_mine) - { - if ($this->is_validation_finished()) - - return sprintf(_('Vous aviez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1)); - else - - return sprintf(_('Vous avez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1)); - } - else - { - if ($this->validation_see_others) - - return sprintf(_('Processus de validation recu de %s et concernant %d utilisateurs'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name(), (count($this->validating_users) - 1)); - else - - return sprintf(_('Processus de validation recu de %s'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name()); - } - } - - /** - * - * @return basket_adapter - */ - public function set_released() - { - if (!$this->is_valid()) - throw new Exception('Not a validation basket'); - - $session = $this->appbox->get_session(); - - $sql = 'UPDATE validate SET confirmed="1" - WHERE ssel_id = :ssel_id AND usr_id = :usr_id'; - - $params = array( - ':ssel_id' => $this->get_ssel_id() - , ':usr_id' => $session->get_usr_id() - ); - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - $evt_mngr = eventsmanager_broker::getInstance($this->appbox); - - $sql = 'SELECT s.usr_id FROM validate v, ssel s - WHERE s.ssel_id = v.ssel_id - AND v.usr_id = :usr_id AND v.ssel_id = :ssel_id'; - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $expires = new DateTime('+10 days'); - $url = $this->appbox->get_registry()->get('GV_ServerName') - . 'lightbox/index.php?LOG=' . random::getUrlToken( - 'validate' - , $row['usr_id'] - , $expires - , $this->get_ssel_id() - ); - - - $to = $row['usr_id']; - $params = array( - 'ssel_id' => $this->ssel_id, - 'from' => $session->get_usr_id(), - 'url' => $url, - 'to' => $to - ); - - - - $evt_mngr->trigger('__VALIDATION_DONE__', $params); - } - - return $this; - } - - /** - * get databox reg fields - * - * @todo change this shit - * @return array - */ - public static function load_regfields() - { - $appbox = appbox::get_instance(); - self::$_regfields = array(); - foreach ($appbox->get_databoxes() as $databox) - { - self::$_regfields[$databox->get_sbas_id()] = self::searchRegFields($databox->get_meta_structure()); - } - - return self::$_regfields; - } - - /** - * - * @param appbox $appbox - * @param $ssel_id - * @param $usr_id - * @return basket_adapter - */ - public static function getInstance(appbox &$appbox, $ssel_id, $usr_id) - { - $instance_key = 'basket_' . $usr_id . '_' . $ssel_id; - if (!isset(self::$_instance[$instance_key])) - { - self::$_instance[$instance_key] = new self($appbox, $ssel_id, $usr_id); - } - - return array_key_exists($instance_key, self::$_instance) ? self::$_instance[$instance_key] : false; - } - - /** - * @todo ameliorer les tests connbas - * @return basket_adapter - */ - protected function load_elements() - { - if (!is_null($this->elements)) - - return; - - $this->elements = array(); - - $user = User_Adapter::getInstance($this->usr_id, $this->appbox); - - $rs = array(); - - try - { - $rs = $this->get_data_from_cache(self::CACHE_ELEMENTS); - } - catch (Exception $e) - { - - try - { - $sql = 'SELECT sselcont_id FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->ssel_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $this->set_data_to_cache($rs, self::CACHE_ELEMENTS); - $stmt->closeCursor(); - } - catch (Exception $e) - { - - } - } - - foreach ($rs as $row) - { - try - { - $this->add_element(basket_element_adapter::getInstance($row['sselcont_id'])); - } - catch (Exception $e) - { - /** - * @todo - * manage case where record has been deleted and not removed from basket - */ - } - } - - return $this; - } - - public function set_name($name) - { - $sql = 'UPDATE ssel SET name = :name WHERE ssel_id = :ssel_id'; - - $name = trim(strip_tags($name)); - if ($name === '') - throw new Exception_InvalidArgument (); - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':name' => $name, ':ssel_id' => $this->get_ssel_id())); - $stmt->closeCursor(); - - $this->name = $name; - - $this->delete_data_from_cache(); - - return $this; - } - - public function set_description($desc) - { - - $sql = 'UPDATE ssel SET descript = :description WHERE ssel_id = :ssel_id'; - - $desc = trim(strip_tags($desc)); - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':description' => $desc, ':ssel_id' => $this->get_ssel_id())); - $stmt->closeCursor(); - - $this->desc = $desc; - - $this->delete_data_from_cache(); - - return $this; - } - - /** - * Add an element to the basket - * - * @param basket_element_adapter $basket_element - * @return basket_adapter - */ - protected function add_element(basket_element_adapter &$basket_element) - { - $this->elements[$basket_element->get_sselcont_id()] = $basket_element; - $this->elements[$basket_element->get_sselcont_id()]->set_order(count($this->elements) + 1); - - return $this; - } - - /** - * - * @param $sselcont_id - * @return - */ - protected function remove_basket_elements($sselcont_id) - { - try - { - $sql = 'DELETE FROM sselcont - WHERE sselcont_id = :sselcont_id AND ssel_id = :ssel_id'; - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':sselcont_id' => $sselcont_id, ':ssel_id' => $this->ssel_id)); - - $sql = 'DELETE FROM validate_datas WHERE sselcont_id = :sselcont_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':sselcont_id' => $sselcont_id)); - - $this->delete_data_from_cache(self::CACHE_ELEMENTS); - - return array('error' => false, 'status' => 1); - } - catch (Exception $e) - { - - } - - return array('error' => true, 'status' => 0); - } - - /** - * - * @param $sselcont_id - * @return - */ - protected function remove_grouping_elements($sselcont_id) - { - $session = $this->appbox->get_session(); - - $sbas_id = $parent_record_id = $collid = $base_id = $record_id = null; - - $ssel_id = $this->ssel_id; - - try - { - $sql = 'SELECT s.sbas_id, s.ssel_id, s.rid, c.record_id, c.base_id - FROM ssel s, sselcont c - WHERE c.sselcont_id = :sselcont_id - AND c.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':sselcont_id' => $sselcont_id, ':ssel_id' => $this->ssel_id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $parent_record_id = $row["rid"]; - $base_id = $row['base_id']; - $sbas_id = $row['sbas_id']; - $record_id = $row['record_id']; - } - } - catch (Exception $e) - { - - } - - $ret = array('error' => false, 'status' => 0); - - try - { - $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); - - if (!$user->ACL()->has_right_on_base($base_id, 'canmodifrecord')) - throw new Exception('Not enough rights'); - $connbas = connection::getPDOConnection($sbas_id); - - $sql = "DELETE FROM regroup WHERE rid_parent = :parent_record_id - AND rid_child = :record_id"; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':parent_record_id' => $parent_record_id, ':record_id' => $record_id)); - $stmt->closeCursor(); - - $sql = 'SELECT sselcont_id, s.ssel_id, s.usr_id FROM ssel s, sselcont c - WHERE s.rid = :parent_record_id AND s.sbas_id = :sbas_id - AND temporaryType="1" AND c.ssel_id = s.ssel_id - AND c.base_id = :base_id AND c.record_id = :record_id'; - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute( - array( - ':parent_record_id' => $parent_record_id - , ':sbas_id' => $sbas_id - , ':base_id' => $base_id - , ':record_id' => $record_id - ) - ); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - $first = true; - $good = false; - - foreach ($rs as $row) - { - $sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id'; - $stmt = $this->appbox->get_connection()->prepare($sql); - if ($first) - $good = true; - $first = false; - try - { - $stmt->execute(array(':sselcont_id' => $row['sselcont_id'])); - - $basket_usr = self::getInstance($this->appbox, $row['ssel_id'], $row['usr_id']); - $basket_usr->set_unread(); - $stmt->closeCursor(); - } - catch (Exception $e) - { - $good = false; - } - } - - if (!$good) - $ret = array('error' => _('panier:: erreur lors de la suppression'), 'status' => 0); - else - $ret = array('error' => false, 'status' => 1); - $this->delete_data_from_cache(self::CACHE_ELEMENTS); - } - catch (Exception $e) - { - - $ret = array( - 'error' => _('phraseanet :: droits insuffisants, vous devez avoir les doits d\'edition sur le regroupement '), - 'status' => 0); - } - - return $ret; - } - - /** - * Flattent a basket - * Remove groupings from the basket and and their contents - * - * @return basket_adapter - */ - public function flatten() - { - foreach ($this->get_elements() as $basket_element) - { - $record = $basket_element->get_record(); - if ($record->is_grouping()) - { - $lst = array(); - foreach ($record->get_children() as $tmp_record) - { - $lst[] = sprintf("%s_%s", $tmp_record->get_base_id(), $tmp_record->get_record_id()); - } - - $this->push_list($lst, true); - $this->remove_from_ssel($basket_element); - } - unset($record); - } - - return $this; - } - - /** - * - * @param $sselcont_id - * @return - */ - public function remove_from_ssel($sselcont_id) - { - if (!$this->is_mine) - - return array('error' => 'error', 'status' => 0); - - if ($this->is_grouping) - - return $this->remove_grouping_elements($sselcont_id); - else - - return $this->remove_basket_elements($sselcont_id); - } - - /** - * - * @return basket_adapter - */ - public function delete_cache() - { - $keys = array(); - - if ($this->is_valid()) - { - foreach ($this->get_validating_users() as $user_data) - { - $keys[] = 'basket_' . $user_data['usr_id'] . '_' . $this->get_ssel_id(); - $keys[] = 'basket_' . $user_data['usr_id'] . '_' . $this->get_ssel_id() . '_' . self::CACHE_ELEMENTS; - $keys[] = 'basket_' . $user_data['usr_id'] . '_' . $this->get_ssel_id() . '_' . self::CACHE_VALIDATING_USERS; - } - } - - $keys[] = 'basket_' . $this->usr_id . '_' . $this->get_ssel_id(); - $keys[] = 'basket_' . $this->usr_id . '_' . $this->get_ssel_id() . '_' . self::CACHE_ELEMENTS; - $keys[] = 'basket_' . $this->usr_id . '_' . $this->get_ssel_id() . '_' . self::CACHE_VALIDATING_USERS; - - $this->appbox->delete_data_from_cache($keys); - - return $this; - } - - /** - * - * @param $lst - * @return - */ - public static function fix_grouping($lst) - { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $usr_id = $session->get_usr_id(); - $registry = $appbox->get_registry(); - - $retour = array(); - - if (!is_array($lst)) - $lst = explode(";", $lst); - - foreach ($lst as $basrec) - { - $basrec = explode('_', $basrec); - $record_id = (int) $basrec[1]; - $sbas_id = (int) $basrec[0]; - - $record = new record_adapter($sbas_id, $record_id); - $base_id = $record->get_base_id(); - - $regfield = self::getRegFields($sbas_id, $record->get_caption()); - $connbas = connection::getPDOConnection($sbas_id); - - $sql = 'SELECT moddate FROM record WHERE record_id = :record_id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $record_id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - $moddate = $row ? $row['moddate'] : ''; - - $sql = 'SELECT ssel_id FROM ssel - WHERE usr_id = :usr_id - AND temporaryType=1 AND rid = :record_id AND sbas_id = :base_id'; - - $params = array( - ':usr_id' => $usr_id - , ':record_id' => $record_id - , ':base_id' => $record->get_sbas_id() - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if (!$row) - { - $sql = 'INSERT INTO ssel (ssel_id, usr_id, date,temporaryType , rid , sbas_id, updater,name,descript ) - VALUES (null, :usr_id, :date, "1" , :record_id ,:sbas_id, :moddate, :name, :desc )'; - - $params = array( - ':usr_id' => $usr_id - , ':date' => $regfield['regdate'] - , ':record_id' => $record_id - , ':sbas_id' => $sbas_id - , ':moddate' => $moddate - , ':name' => $regfield['regname'] - , ':desc' => $regfield['regdesc'] - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - $id = $appbox->get_connection()->lastInsertId(); - $basket = self::getInstance($appbox, $id, $usr_id); - - $lst = $record->get_children(); - $lst = $lst->serialize_list(); - $basket->push_list($lst, true); - $retour[] = $id; - } - else - { - $retour[] = $row['ssel_id']; - } - } - - return p4string::jsonencode($retour); - } - - /** - * - * @param $sselid - * @return boolean - */ - public static function unfix_grouping($sselid) - { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - - try - { - $appbox->get_connection()->beginTransaction(); - $sql = 'DELETE FROM ssel WHERE ssel_id = :ssel_id AND usr_id = :usr_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $sselid, ':usr_id' => $session->get_usr_id())); - $stmt->closeCursor(); - - $sql = 'DELETE FROM sselcont WHERE ssel_id = :ssel_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $sselid)); - $stmt->closeCursor(); - $ret = true; - $appbox->get_connection()->commit(); - } - catch (Exception $e) - { - $appbox->get_connection()->rollBack(); - $ret = false; - } - - return $ret; - } - - /** - * - * @param $sbas_id - * @param caption_record $desc - * @return - */ - public static function getRegFields($sbas_id, caption_record $desc) - { - if (!self::$_regfields) - self::load_regfields(); - - $arrayRegFields = self::$_regfields[$sbas_id]; - - $array = array(); - - foreach ($arrayRegFields as $k => $f) - { - $array[$f] = $k; - } - - $fields = array(); - $fields["regname"] = ""; - $fields["regdesc"] = ""; - $fields["regdate"] = ""; - - foreach ($desc->get_fields() as $caption_field) - { - $meta_struct_id = $caption_field->get_meta_struct_id(); - if (array_key_exists($meta_struct_id, $array)) - $fields[$array[$meta_struct_id]] = $caption_field->get_value(); - } - - return $fields; - } - - /** - * - * @param appbox $appbox - * @param $name - * @param User_Interface $user - * @param $desc - * @param User_Adapter $pusher - * @param $base_id - * @return - */ - public static function create(appbox $appbox, $name, User_Interface $user, $desc = '', User_Adapter $pusher=null, $base_id = null) - { - $conn = $appbox->get_connection(); - - $record = false; - - $desc = trim(strip_tags(str_replace('
', "\n", $desc))); - $name = trim(strip_tags($name)); - - - if ($base_id) - { - $databox = $appbox->get_databox(phrasea::sbasFromBas($base_id)); - $meta_struct = $databox->get_meta_structure(); - - try - { - if (!$user->ACL()->has_right_on_base($base_id, 'canaddrecord')) - throw new Exception('No rights'); - - $ret = FALSE; - - $registry = $appbox->get_registry(); - $collection = collection::get_from_base_id($base_id); - - $record = record_adapter::create( - $collection - , new system_file($registry->get('GV_RootPath') . 'www/skins/icons/substitution/regroup_doc.png') - , false - , true - ); - - - $record_id = $record->get_record_id(); - - $metadatas = array(); - - foreach ($meta_struct as $meta) - { - if ($meta->is_regname()) - $value = $name; - elseif ($meta->is_regdesc()) - $value = $desc; - else - continue; - - $metadatas[] = array( - 'meta_struct_id' => $meta->get_id() - , 'meta_id' => null - , 'value' => array($value) - ); - } - - $record->set_metadatas($metadatas, true) - ->rebuild_subdefs(); - - $ret = true; - } - catch (Exception $e) - { - $ret = false; - } - } - - $sql = 'INSERT INTO ssel (ssel_id, name, descript, usr_id, pushFrom, date, updater, temporaryType, rid, sbas_id) - VALUES (null, :name, :description, :usr_id, :pushFrom, NOW(), NOW(), :temporaryType, :record_id, :sbas_id)'; - - $stmt = $conn->prepare($sql); - - $params = array( - ':name' => $name - , ':usr_id' => $user->get_id() - , ':description' => $desc - , ':pushFrom' => ($pusher instanceof User_Interface ? $pusher->get_id() : '0') - , ':temporaryType' => ($record instanceof record_adapter ? '1' : '0') - , ':record_id' => ($record instanceof record_adapter ? $record->get_record_id() : '0') - , ':sbas_id' => ($record instanceof record_adapter ? $record->get_sbas_id() : '0') - ); - - if (!$stmt->execute($params)) - { - throw new Exception('Error while creating basket'); - } - $ssel_id = $conn->lastInsertId(); - - return self::getInstance($appbox, $ssel_id, $user->get_id()); - } - - /** - * Revoke cache when user documents have their collection changed or status - * - do not cache datas which are now forbidden - * - * @param $usr_id - * @return boolean - */ - public static function revoke_baskets_record(record_adapter &$record, appbox &$appbox) - { - $keys = array(); - - $sql = 'SELECT s.ssel_id, s.usr_id FROM ssel s, sselcont c - WHERE base_id = "' . $record->get_base_id() . '" - AND record_id="' . $record->get_record_id() . '" - AND c.ssel_id = s.ssel_id'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $keys[] = 'basket_' . $row['usr_id'] . '_' . $row['ssel_id']; - } - - return $appbox->delete_data_from_cache($keys); - } - - /** - * - * @param User_Interface $user - * @return - */ - public static function revoke_baskets_usr(User_Interface $user) - { - $ssel_ids = array(); - $appbox = appbox::get_instance(); - try - { - $sql = 'SELECT distinct s.ssel_id FROM ssel s, validate v - WHERE s.usr_id=:usr_id - OR (v.usr_id=:other_usr_id AND v.ssel_id = s.ssel_id)'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_id' => $user->get_id(), ':other_usr_id' => $user->get_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - foreach ($rs as $row) - { - $ssel_ids[] = 'basket_' . $user->get_id() . '_' . $row['ssel_id']; - } - } - catch (Exception $e) - { - - } - - return $appbox->delete_data_from_cache($ssel_ids); - } - - /** - * Load users in current validation process - * @return void - */ - protected function load_validation_users() - { - try - { - $datas = $this->get_data_from_cache(self::CACHE_VALIDATING_USERS); - $this->validating_users = $datas; - - foreach ($this->validating_users as $row) - { - $user = User_Adapter::getInstance($row['usr_id'], $this->appbox); - $name = $user->get_display_name(); - $this->validating_users[$row['usr_id']]['usr_name'] = $name; - } - - return $this; - } - catch (Exception $e) - { - - } - - $sql = 'SELECT id, usr_id, confirmed, can_agree, can_see_others - FROM validate WHERE ssel_id = :ssel_id'; - - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->get_ssel_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $this->validating_users[$row['usr_id']] = array( - 'usr_id' => $row['usr_id'], - 'usr_name' => User_Adapter::getInstance($row['usr_id'], $this->appbox)->get_display_name(), - 'confirmed' => $row['confirmed'], - 'can_agree' => $row['can_agree'], - 'can_see_others' => $row['can_see_others'] - ); - } - - $this->set_data_to_cache($this->validating_users, self::CACHE_VALIDATING_USERS); - - return $this; - } - - /** - * - * @param $a - * @param $b - * @return - */ - protected function order_validation_asc($a, $b) - { - if (is_null($a->get_avrDisAgree()) || is_null($b->get_avrDisAgree())) - { - return 0; - } - $comp = $a->get_avrDisAgree() - $b->get_avrDisAgree(); - - if ($comp == 0) - { - $comp = $b->get_avrAgree() - $a->get_avrAgree(); - if ($comp == 0) - { - return 0; - } - } - - return $comp > 0 ? -1 : 1; - } - - /** - * - * @param $a - * @param $b - * @return - */ - protected function order_validation_desc($a, $b) - { - if (is_null($a->get_avrAgree()) || is_null($b->get_avrAgree())) - { - return 0; - } - $comp = $a->get_avrAgree() - $b->get_avrAgree(); - - if ($comp == 0) - { - $comp = $b->get_avrDisAgree() - $a->get_avrDisAgree(); - if ($comp == 0) - { - return 0; - } - } - - return $comp > 0 ? -1 : 1; - } - -} diff --git a/lib/classes/basket/element/adapter.class.php b/lib/classes/basket/element/adapter.class.php deleted file mode 100644 index ce97b34cd0..0000000000 --- a/lib/classes/basket/element/adapter.class.php +++ /dev/null @@ -1,859 +0,0 @@ -get_session(); - $this->usr_id = $session->get_usr_id(); - $this->sselcont_id = (int) $sselcont_id; - - $this->load(); - - return $this; - } - - protected function load() - { - - try - { - $datas = $this->get_data_from_cache(); - - $this->ssel_id = $datas['ssel_id']; - $this->order = $datas['order']; - $this->record = new record_adapter($datas['sbas_id'], $datas['record_id'], $this->order); - $this->avrDisAgree = $datas['avrDisAgree']; - $this->avrAgree = $datas['avrAgree']; - $this->is_validation_item = $datas['is_validation_item']; - $this->my_agreement = $datas['my_agreement']; - $this->my_note = $datas['my_note']; - $this->validate_id = $datas['validate_id']; - $this->choices = $datas['choices']; - $this->avrAgree = $datas['avrAgree']; - $this->avrDisAgree = $datas['avrDisAgree']; - - return $this; - } - catch (Exception $e) - { - - } - - $sql = 'SELECT s.usr_id as owner, v.id as validate_id, v.can_see_others, - c.base_id, c.record_id, c.ord, c.ssel_id, v.usr_id, - d.agreement, d.note, d.updated_on - FROM (sselcont c, ssel s) - LEFT JOIN (validate v, validate_datas d) - ON (d.sselcont_id = c.sselcont_id AND d.validate_id = v.id ) - WHERE s.ssel_id = c.ssel_id - AND c.sselcont_id = :sselcont_id'; - - try - { - $conn = connection::getPDOConnection(); - $stmt = $conn->prepare($sql); - $stmt->execute(array(':sselcont_id' => $this->sselcont_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - } - catch (Exception $e) - { - - } - - $first = true; - - - foreach ($rs as $row) - { - if ($row['validate_id']) - { - $this->is_validation_item = true; - - if ($row['owner'] == $this->usr_id) - $see_others = true; - else - $see_others = ($row['can_see_others'] == '1'); - - if (!$see_others) - { - if ($row['usr_id'] != $this->usr_id) - continue; - } - } - - if ($first) - { - $sbas_id = (int) phrasea::sbasFromBas($row['base_id']); - $record_id = (int) $row['record_id']; - $this->ssel_id = (int) $row['ssel_id']; - $this->order = $number = (int) $row['ord']; - - $this->record = new record_adapter($sbas_id, $record_id, $number); - - if ($this->is_validation_item) - { - $this->choices = array(); - $this->avrAgree = 0; - $this->avrDisAgree = 0; - } - - $first = false; - } - - if ($this->is_validation_item) - { - if ($row['usr_id'] == $this->usr_id) - { - $this->my_agreement = (int) $row['agreement']; - $this->my_note = $row['note']; - $this->validate_id = (int) $row['validate_id']; - } - $this->choices[$row['usr_id']] = array( - 'usr_id' => $row['usr_id'], - 'usr_name' => User_Adapter::getInstance($row['usr_id'], appbox::get_instance())->get_display_name(), - 'is_mine' => ($row['usr_id'] == $this->usr_id), - 'agreement' => $row['agreement'], - 'updated_on' => $row['updated_on'], - 'note' => $row['note'] - ); - $this->avrAgree += $row["agreement"] > 0 ? 1 : 0; - $this->avrDisAgree += $row["agreement"] < 0 ? 1 : 0; - } - } - - $datas = array( - 'ssel_id' => $this->ssel_id - , 'sbas_id' => (int) $sbas_id - , 'record_id' => $record_id - , 'order' => $this->order - , 'is_validation_item' => $this->is_validation_item - , 'my_agreement' => $this->my_agreement - , 'my_note' => $this->my_note - , 'validate_id' => $this->validate_id - , 'choices' => $this->choices - , 'avrAgree' => $this->avrAgree - , 'avrDisAgree' => $this->avrDisAgree - ); - - $this->set_data_to_cache($datas); - - return $this; - } - - public function get_record() - { - return $this->record; - } - - /** - * - * @return int - */ - public function get_order() - { - return $this->order; - } - - /** - * - * @param int $number - * @return basket_element_adapter - */ - public function set_order($order) - { - $this->order = (int) $order; - - return $this; - } - - /** - * @return basket_element_adapter - */ - public static function getInstance($sselcont_id) - { - if (!isset(self::$_instance[$sselcont_id])) - { - self::$_instance[$sselcont_id] = new self($sselcont_id); - } - - return array_key_exists($sselcont_id, self::$_instance) ? self::$_instance[$sselcont_id] : false; - } - - /** - * - * @param basket_adapter $basket - * @param int $base_id - * @param int $record_id - * @param int $parent_record_id - * @param string $adjust_validation_datas - * @param boolean $fixing - * @return basket_element_adapter - */ - public static function create(basket_adapter $basket, $base_id, $record_id, $parent_record_id, $adjust_validation_datas, $fixing) - { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $sbas_id = phrasea::sbasFromBas($base_id); - $record = new record_adapter($sbas_id, $record_id); - - $ssel_id = $basket->get_ssel_id(); - - if (!$user->ACL()->has_right_on_base($base_id, 'canputinalbum')) - throw new Exception('You do not have rights' . - ' to use this document in basket.'); - - $exists = false; - - $sql = 'SELECT sselcont_id FROM sselcont - WHERE ssel_id = :ssel_id AND base_id = :base_id AND record_id = :record_id '; - $stmt = $appbox->get_connection()->prepare($sql); - $params = array( - ':ssel_id' => $basket->get_ssel_id() - , ':base_id' => $base_id - , ':record_id' => $record_id - ); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - return new self($row['sselcont_id']); - } - - $connbas = connection::getPDOConnection($sbas_id); - - if (!$sbas_id) - throw new Exception('Unknown database'); - - if ($parent_record_id && $fixing === false) - { - if (!$user->ACL()->has_right_on_base($base_id, 'canaddrecord')) - throw new Exception('You do not have the right'); - - if ($record->is_grouping()) - throw new Exception('Can\'t add grouping to grouping'); - - $ord = 0; - $sql = "SELECT (max(ord)+1) as ord - FROM regroup WHERE rid_parent = :parent_record_id"; - - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':parent_record_id' => $parent_record_id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $ord = is_null($row["ord"]) ? 0 : $row["ord"]; - } - else - { - $ord = 0; - } - - $sql = 'INSERT INTO regroup (id, rid_parent, rid_child, dateadd, ord) - VALUES (null, :parent_record_id, :record_id, NOW(), :ord)'; - - $params = array( - ':parent_record_id' => $parent_record_id - , ':record_id' => $record_id - , ':ord' => $ord - ); - - $stmt = $connbas->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - $sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :parent_record_id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':parent_record_id' => $parent_record_id)); - $stmt->closeCursor(); - } - - $sql = 'SELECT max(ord) as ord FROM sselcont WHERE ssel_id = :ssel_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $basket->get_ssel_id())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $ord = (int) $row['ord'] + 1; - } - else - { - $ord = 0; - } - - $sql = ' INSERT INTO sselcont - (sselcont_id, ssel_id, base_id, record_id, ord) - VALUES (null, :ssel_id, :base_id, :record_id, :ord) '; - - $stmt = $appbox->get_connection()->prepare($sql); - $params = array( - ':ssel_id' => $basket->get_ssel_id() - , ':base_id' => $base_id - , ':record_id' => $record_id - , ':ord' => $ord - ); - $stmt->execute($params); - $stmt->closeCursor(); - - $sselcont_id = $appbox->get_connection()->lastInsertId(); - - $ret['error'] = false; - $ret['datas'][] = $sselcont_id; - - $sql = 'UPDATE ssel SET updater=NOW() WHERE ssel_id = :ssel_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $basket->get_ssel_id())); - $stmt->closeCursor(); - - - if ($adjust_validation_datas == 'myvalid') - { - $sql = 'INSERT INTO validate_datas - (SELECT distinct null as id, id as validate_id - , :sselcont_id as sselcont_id - , null as updated_on, 0 as agreement, "" as note - FROM validate - WHERE ssel_id = :ssel_id)'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':sselcont_id' => $sselcont_id, ':ssel_id' => $basket->get_ssel_id())); - $stmt->closeCursor(); - - $sql = 'SELECT usr_id FROM validate WHERE ssel_id = :ssel_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $basket->get_ssel_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - if ($session->get_usr_id() != $row['usr_id']) - { - $basket->set_unread($row['usr_id']); - } - } - } - - if ($parent_record_id) - { - $sql = 'SELECT null as id, ssel_id, usr_id - FROM ssel - WHERE usr_id != :usr_id AND rid = :parent_record_id - AND sbas_id = :sbas_id AND temporaryType="1"'; - - $stmt = $appbox->get_connection()->prepare($sql); - $params = array( - ':usr_id' => $session->get_usr_id() - , ':parent_record_id' => $parent_record_id - , ':sbas_id' => $sbas_id - ); - $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $sql = 'SELECT max(ord) as ord FROM sselcont WHERE ssel_id = :ssel_id'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $row['ssel_id'])); - $row2 = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $ord = (int) $row2['ord'] + 1; - } - else - { - $ord = 0; - } - - $sqlUp = ' INSERT INTO sselcont - (sselcont_id, ssel_id, base_id, record_id,ord) - VALUES (null, :ssel_id, :base_id, :record_id, :ord) '; - - $stmt = $appbox->get_connection()->prepare($sql); - $params = array( - ':ssel_id' => $row['ssel_id'] - , ':base_id' => $base_id - , ':record_id' => $record_id - , ':ord' => $ord - ); - $stmt->execute($params); - $stmt->closeCursor(); - - $sql = 'UPDATE ssel SET updater=NOW() WHERE ssel_id = :ssel_id'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $row['ssel_id'])); - $stmt->closeCursor(); - - try - { - $basket_to_clean = basket_adapter::getInstance($appbox, $row['ssel_id'], $user->get_id()); - $basket_to_clean->set_unread($row['usr_id']); - } - catch (Exception $e) - { - - } - } - } - - $basket->delete_cache(); - - return new self($sselcont_id); - } - - /** - * - * @param string $note - * @return boolean - */ - function set_note($note) - { - if (!$this->is_validation_item) - { - throw new Exception('Element ' . $this->sselcont_id . ' is not a validation item'); - } - - $note = strip_tags($note); - - if (!$this->validate_id) - - return false; - - $appbox = appbox::get_instance(); - $usr_id = $appbox->get_session()->get_usr_id(); - - $sql = 'UPDATE validate_datas SET note = :note - WHERE sselcont_id = :sselcont_id AND validate_id = :validate_id '; - $stmt = $appbox->get_connection()->prepare($sql); - - $params = array( - ':note' => $note - , ':sselcont_id' => $this->sselcont_id - , ':validate_id' => $this->validate_id - ); - - $stmt->execute($params); - $stmt->closeCursor(); - - $this->my_note = $note; - foreach ($this->choices as $key => $values) - { - if ($values['is_mine']) - { - $this->choices[$key]['note'] = $note; - break; - } - } - - $this->delete_data_from_cache(); - - $sql = 'SELECT distinct v.usr_id FROM ssel s, validate v - WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->get_ssel_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach($rs as $row) - { - $appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id); - } - - try - { - $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id); - $basket->delete_cache(); - } - catch (Exception $e) - { - - } - - return $this; - } - - /** - * - * @return void - */ - function load_users_infos() - { - if (!$this->is_validation_item) - { - throw new Exception('Element is not a validation item'); - - return false; - } - - foreach ($this->choices as $key => $value) - { - $this->choices[$key]['usr_display'] = User_Adapter::getInstance($value['usr_id'], appbox::get_instance())->get_display_name(); - } - } - - /** - * - * @return int - */ - function get_note_count() - { - if (!$this->is_validation_item) - { - throw new Exception('Element is not a validation item'); - - return false; - } - - $n = 0; - foreach ($this->choices as $key => $value) - { - if (trim($value['note']) != '') - $n++; - } - - return $n; - } - - /** - * - * @param boolean $boolean - * @return string - */ - function set_agreement($boolean) - { - - if (!$this->is_validation_item) - { - throw new Exception('not a validation item'); - } - - if (!$this->validate_id) - throw new Exception('not a validation item'); - - $appbox = appbox::get_instance(); - $usr_id = $appbox->get_session()->get_usr_id(); - - $boolean = in_array($boolean, array('1', '-1')) ? $boolean : '0'; - - $sql = 'UPDATE validate_datas - SET agreement = :agreement - WHERE sselcont_id = :sselcont_id - AND validate_id = :validate_id'; - - $params = array( - ':agreement' => $boolean - , ':sselcont_id' => $this->sselcont_id - , ':validate_id' => $this->validate_id - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - $this->delete_data_from_cache(); - - $sql = 'SELECT distinct v.usr_id FROM ssel s, validate v - WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $this->get_ssel_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach($rs as $row) - { - $appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id); - } - - $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id); - $basket->delete_cache(); - - return $this; - } - - /** - * - * @return int - */ - public function get_sselcont_id() - { - return $this->sselcont_id; - } - - /** - * - * @return boolean - */ - public function is_validation_item() - { - return $this->is_validation_item; - } - - /** - * - * @return int - */ - public function get_my_agreement() - { - return $this->my_agreement; - } - - /** - * - * @return string - */ - public function get_my_note() - { - return $this->my_note; - } - - /** - * - * @return Array - */ - public function get_choices() - { - return $this->choices; - } - - /** - * - * @return int - */ - public function get_ssel_id() - { - return $this->ssel_id; - } - - public static function is_in_validation_session(record_Interface $record, User_Interface $user) - { - $conn = connection::getPDOConnection(); - $sql = 'SELECT v.id FROM sselcont c, validate v - WHERE c.base_id = :base_id AND c.record_id = :record_id - AND v.usr_id = :usr_id AND c.ssel_id = v.ssel_id'; - - $params = array( - ':base_id' => $record->get_base_id() - , ':record_id' => $record->get_record_id() - , ':usr_id' => $user->get_id() - ); - - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - return!!$row; - } - - public static function has_been_received(record_Interface $record, User_Interface $user) - { - $conn = connection::getPDOConnection(); - $sql = 'SELECT sselcont_id FROM sselcont c, ssel s - WHERE c.ssel_id=s.ssel_id AND c.record_id = :record_id - AND c.base_id = :base_id AND s.pushFrom > 0 - AND s.usr_id = :usr_id'; - - $params = array( - ':base_id' => $record->get_base_id() - , ':record_id' => $record->get_record_id() - , ':usr_id' => $user->get_id() - ); - - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - return!!$row; - } - - public function get_avrAgree() - { - return $this->avrAgree; - } - - public function get_avrDisAgree() - { - return $this->avrDisAgree; - } - - public function validate(user_adapter $from_user, User_Adapter $to_user, $validate_id, $can_hd) - { - $appbox = appbox::get_instance(); - - if ($can_hd) - $to_user->ACL()->grant_hd_on($this->get_record(), $from_user, 'validate'); - else - $to_user->ACL()->grant_preview_on($this->get_record(), $from_user, 'validate'); - - $sql = 'REPLACE INTO validate_datas - (id, validate_id, sselcont_id, updated_on, agreement) - VALUES - (null, :validate_id, :sselcont_id, null, 0)'; - $stmt = $appbox->get_connection()->prepare($sql); - - $params = array( - ':validate_id' => $validate_id - , ':sselcont_id' => $this->get_sselcont_id() - ); - $stmt->execute($params); - - $stmt->closeCursor(); - - if (!$this->is_validation_item) - { - $this->choices = array(); - $this->avrAgree = 0; - $this->avrDisAgree = 0; - } - - $this->is_validation_item = true; - $this->choices[$to_user->get_id()] = array( - 'usr_id' => $to_user->get_id(), - 'usr_name' => $to_user->get_display_name(), - 'is_mine' => ($to_user->get_id() == $this->usr_id), - 'agreement' => 0, - 'updated_on' => new DateTime(), - 'note' => '' - ); - if ($to_user->get_id() == $this->usr_id) - { - $this->validate_id = (int) $validate_id; - } - - $this->delete_data_from_cache(); - - return $this; - } - - public function get_cache_key($option = null) - { - return 'basket_element_' . $this->usr_id . '_' . $this->sselcont_id . ($option ? '_' . $option : ''); - } - - public function get_data_from_cache($option = null) - { - $appbox = appbox::get_instance(); - - return $appbox->get_data_from_cache($this->get_cache_key($option)); - } - - public function set_data_to_cache($value, $option = null, $duration = 0) - { - $appbox = appbox::get_instance(); - - return $appbox->set_data_to_cache($value, $this->get_cache_key($option), $duration); - } - - public function delete_data_from_cache($option = null) - { - $appbox = appbox::get_instance(); - - return $appbox->delete_data_from_cache($this->get_cache_key($option)); - } - -} diff --git a/lib/classes/basketCollection.class.php b/lib/classes/basketCollection.class.php deleted file mode 100644 index 6b170d7263..0000000000 --- a/lib/classes/basketCollection.class.php +++ /dev/null @@ -1,186 +0,0 @@ -format('U'); - - $sql = 'SELECT ssel_id FROM ssel WHERE usr_id = :usr_id - AND temporaryType="0"'; - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_id' => $usr_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if (count($rs) === 0) - { - $basket = basket_adapter::create($appbox, '', $user); - } - - $baskets = array(); - $baskets['baskets'] = $baskets['recept'] = $baskets['regroup'] = array(); - - $sql = 'SELECT s.ssel_id, s.usr_id as owner, v.id as validate_id, - s.temporaryType, s.pushFrom, v.expires_on FROM ssel s - LEFT JOIN validate v - ON (v.ssel_id = s.ssel_id AND v.usr_id = :usr_id_v) - WHERE (s.usr_id = :usr_id_o OR v.id IS NOT NULL)'; - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':usr_id_o' => $usr_id, ':usr_id_v' => $usr_id)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $is_mine = ($row['owner'] == $usr_id); - - $expires_on_obj = new DateTime($row['expires_on']); - $expires_on = $expires_on_obj->format('U'); - - if ($row['validate_id'] != null && !$is_mine && $expires_on < $current_timestamp) - continue; - - if ($row['temporaryType'] == '1') - $baskets['regroup'][] = basket_adapter::getInstance($appbox, $row['ssel_id'], $usr_id); - elseif (!is_null($row['validate_id'])) - $baskets['baskets'][] = basket_adapter::getInstance($appbox, $row['ssel_id'], $usr_id); - elseif ((int) $row['pushFrom'] > 0) - $baskets['recept'][] = basket_adapter::getInstance($appbox, $row['ssel_id'], $usr_id); - else - $baskets['baskets'][] = basket_adapter::getInstance($appbox, $row['ssel_id'], $usr_id); - } - - $to_remove = array_intersect(array('recept', 'regroup', 'baskets'), $except); - - foreach ($to_remove as $type) - $baskets[$type] = array(); - - if ($order == 'name asc') - { - uasort($baskets['baskets'], array('basketCollection', 'story_name_sort')); - uasort($baskets['regroup'], array('basketCollection', 'story_name_sort')); - uasort($baskets['recept'], array('basketCollection', 'story_name_sort')); - } - if ($order == 'date desc') - { - uasort($baskets['baskets'], array('basketCollection', 'story_date_sort')); - uasort($baskets['regroup'], array('basketCollection', 'story_date_sort')); - uasort($baskets['recept'], array('basketCollection', 'story_date_sort')); - } - - $this->baskets = $baskets; - - return $this; - } - - public function get_baskets() - { - return $this->baskets; - } - - function get_names() - { - $array_names = array(); - - foreach ($this->baskets as $type_name => $type) - { - foreach ($type as $basket) - { - - $array_names[] = array('ssel_id' => $basket->get_ssel_id(), 'name' => $basket->get_name(), 'type' => $type_name); - } - } - - return $array_names; - } - - function story_date_sort($a, $b) - { - if (!$a->create || !$b->create) - - return 0; - - $comp = strcasecmp($a->create, $b->create); - - if ($comp == 0) - - return 0; - - return $comp < 0 ? -1 : 1; - } - - function story_name_sort($a, $b) - { - if (!$a->get_name() || !$b->get_name()) - { - return 0; - } - $comp = strcasecmp($a->get_name(), $b->get_name()); - - if ($comp == 0) - - return 0; - - return $comp < 0 ? -1 : 1; - } - - public static function get_updated_baskets() - { - $appbox = appbox::get_instance(); - $conn = $appbox->get_connection(); - $session = $appbox->get_session(); - $sql = 'SELECT n.ssel_id FROM sselnew n - WHERE n.usr_id = :usr_id '; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $session->get_usr_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - $baskets = array(); - foreach($rs as $row) - { - try - { - $basket = basket_adapter::getInstance($appbox, $row['ssel_id'], $session->get_usr_id()); - - if ($basket->is_valid() && !$basket->is_my_valid() && $basket->is_validation_finished()) - throw new Exception('Finished'); - - $baskets[] = $basket; - - } - catch(Exception $e) - { - $sql = 'DELETE FROM sselnew WHERE ssel_id = :ssel_id AND usr_id = :usr_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $session->get_usr_id(), ':ssel_id' => $row['ssel_id'])); - $stmt->closeCursor(); - } - } - - return $baskets; - } - -} diff --git a/lib/classes/binaryAdapter/image/resize/gd.class.php b/lib/classes/binaryAdapter/image/resize/gd.class.php index eadad2c4a7..194d9f6308 100644 --- a/lib/classes/binaryAdapter/image/resize/gd.class.php +++ b/lib/classes/binaryAdapter/image/resize/gd.class.php @@ -93,13 +93,34 @@ class binaryAdapter_image_resize_gd extends binaryAdapter_processorAbstract $size = $this->options['size']; - if (!is_null($size) && !$origine->is_raw_image() - && $tech_datas[system_file::TC_DATAS_WIDTH] < $size && $tech_datas[system_file::TC_DATAS_HEIGHT] < $size) + if ( + !is_null($size) + && isset($tech_datas[system_file::TC_DATAS_WIDTH]) + && isset($tech_datas[system_file::TC_DATAS_HEIGHT]) + && !$origine->is_raw_image() + && $tech_datas[system_file::TC_DATAS_WIDTH] < $size + && $tech_datas[system_file::TC_DATAS_HEIGHT] < $size + ) { $size = max($tech_datas[system_file::TC_DATAS_WIDTH], $tech_datas[system_file::TC_DATAS_HEIGHT]); } - $imag_original = imagecreatefromjpeg($origine->getPathname()); + switch ($origine->get_mime()) + { + case "image/jpeg" : + $imag_original = imagecreatefromjpeg($origine->getPathname()); + break; + case "image/gif" : + $imag_original = imagecreatefromgif($origine->getPathname()); + break; + case "image/png" : + $imag_original = imagecreatefrompng($origine->getPathname()); + break; + default: + return $this; + break; + } + if ($imag_original) { @@ -119,8 +140,7 @@ class binaryAdapter_image_resize_gd extends binaryAdapter_processorAbstract $w_sub = (int) (($w_doc / $h_doc) * ($h_sub = $size)); $img_mini = imagecreatetruecolor($w_sub, $h_sub); - imagecopyresampled($img_mini, $imag_original, 0, 0, 0, 0, - $w_sub, $h_sub, $w_doc, $h_doc); + imagecopyresampled($img_mini, $imag_original, 0, 0, 0, 0, $w_sub, $h_sub, $w_doc, $h_doc); } if ($this->options['autorotate']) diff --git a/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php b/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php index 3fbf455407..5eac57d440 100644 --- a/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php +++ b/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php @@ -1,5 +1,5 @@ get('GV_RootPath') === false) + if (static::$core) { - $registry->set('GV_RootPath', dirname(__FILE__) . '/../../'); - $registry->set('GV_debug', true); + return static::$core; } - self::set_php_configuration(); + static::$core = new Core($env); - ini_set('error_log', $registry->get('GV_RootPath') . 'logs/php_error.log'); - - if ($registry->get('GV_debug')) + if (static::$core->getConfiguration()->isInstalled()) { - ini_set('display_errors', 'on'); - ini_set('display_startup_errors', 'on'); - } - else - { - ini_set('display_errors', 'off'); - ini_set('display_startup_errors', 'off'); + static::$core->enableEvents(); } - if ($registry->get('GV_log_errors')) + if (\setup::is_installed()) { - ini_set('log_errors', 'on'); - } - else - { - ini_set('log_errors', 'off'); + $gatekeeper = \gatekeeper::getInstance(static::$core); + $gatekeeper->check_directory(); } - self::register_autoloads(); - self::init_functions(); - - define('JETON_MAKE_SUBDEF', 0x01); - define('JETON_WRITE_META_DOC', 0x02); - define('JETON_WRITE_META_SUBDEF', 0x04); - define('JETON_WRITE_META', 0x06); - - $gatekeeper = gatekeeper::getInstance(); - $gatekeeper->check_directory(); + return static::$core; } - protected static function phrasea_autoload($class_name) + /** + * + * @return Alchemy\Phrasea\Core + */ + public static function getCore() { - if (file_exists(__CUSTOMDIR__ . '/classes/' - . str_replace('_', '/', $class_name) . '.class.php')) - { - require_once __CUSTOMDIR__ . '/classes/' - . str_replace('_', '/', $class_name) . '.class.php'; - } - elseif (file_exists(__LIBDIR__ . '/classes/' - . str_replace('_', '/', $class_name) . '.class.php')) - { - require_once __LIBDIR__ . '/classes/' - . str_replace('_', '/', $class_name) . '.class.php'; - } - } - - protected static function require_essentials() - { - require_once __LIBDIR__ . '/version.inc'; - require_once __LIBDIR__ . '/classes/cache/opcode/interface.class.php'; - require_once __LIBDIR__ . '/classes/cache/cacheableInterface.class.php'; - require_once __LIBDIR__ . '/classes/cache/opcode/adapter.class.php'; - require_once __LIBDIR__ . '/classes/registryInterface.class.php'; - require_once __LIBDIR__ . '/classes/registry.class.php'; - require_once __LIBDIR__ . '/classes/Session/Storage/Interface.class.php'; - require_once __LIBDIR__ . '/classes/Session/Storage/Abstract.class.php'; - require_once __LIBDIR__ . '/classes/Session/Storage/PHPSession.class.php'; - require_once __LIBDIR__ . '/classes/Session/Storage/CommandLine.class.php'; - require_once __LIBDIR__ . '/classes/base.class.php'; - require_once __LIBDIR__ . '/classes/appbox.class.php'; - require_once __LIBDIR__ . '/classes/Session/Handler.class.php'; - require_once __LIBDIR__ . '/classes/phrasea.class.php'; - require_once __LIBDIR__ . '/classes/User/Interface.class.php'; - require_once __LIBDIR__ . '/classes/User/Adapter.class.php'; - require_once __LIBDIR__ . '/classes/eventsmanager/eventAbstract.class.php'; - require_once __LIBDIR__ . '/classes/eventsmanager/notifyAbstract.class.php'; - require_once __LIBDIR__ . '/classes/eventsmanager/broker.class.php'; - require_once __LIBDIR__ . '/classes/gatekeeper.class.php'; - require_once __LIBDIR__ . '/classes/http/request.class.php'; - require_once __LIBDIR__ . '/classes/p4string.class.php'; - - require_once __LIBDIR__ . '/classes/connection/interface.class.php'; - require_once __LIBDIR__ . '/classes/connection/abstract.class.php'; - require_once __LIBDIR__ . '/classes/connection/pdo.class.php'; - require_once __LIBDIR__ . '/classes/connection/pdoStatementDebugger.class.php'; - require_once __LIBDIR__ . '/classes/connection.class.php'; + return static::$core; } public static function register_autoloads() { - self::define_dirs(); - - spl_autoload_register(array('bootstrap', 'phrasea_autoload')); - - require_once __LIBDIR__ . '/vendor/Twig/lib/Twig/Autoloader.php'; - require_once __LIBDIR__ . '/vendor/Twig-extensions/lib/Twig/Extensions/Autoloader.php'; - require_once __LIBDIR__ . '/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - - Twig_Autoloader::register(); - Twig_Extensions_Autoloader::register(); - - /** - * Load symfony components needed - */ - $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); - $loader->registerNamespaces(array( - 'Symfony\\Component\\Yaml' => __LIBDIR__ . '/vendor/symfony/src', - 'Symfony\\Component\\Console' => __LIBDIR__ . '/vendor/symfony/src', - 'Symfony\\Component\\BrowserKit' => __LIBDIR__ . '/vendor/symfony/src', - )); - $loader->register(); - - require_once __LIBDIR__ . '/vendor/Silex/autoload.php'; - } - - protected static function init_functions() - { - $registry = registry::get_instance(); - if ($registry->is_set('GV_timezone')) - date_default_timezone_set($registry->get('GV_timezone')); - else - date_default_timezone_set('Europe/Berlin'); - - phrasea::start(); - User_Adapter::detectlanguage($registry); - - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - - if (Session_Handler::get_cookie('locale') !== Session_Handler::get_locale()) - { - $avLanguages = User_Adapter::detectlanguage($registry, Session_Handler::get_cookie('locale')); - } - - mb_internal_encoding("UTF-8"); - phrasea::use_i18n(Session_Handler::get_locale()); - phrasea::load_events(); + return Core::initAutoloads(); } } diff --git a/lib/classes/cache/adapter.class.php b/lib/classes/cache/adapter.class.php deleted file mode 100644 index a6d7309cb5..0000000000 --- a/lib/classes/cache/adapter.class.php +++ /dev/null @@ -1,267 +0,0 @@ - array( - 'cache_nocache' - ), - 'memcached' => array( - 'cache_memcached' - , 'cache_memcache' - ), - 'redis' => array( - 'cache_redis' - ) - ); - - /** - * - * @var cache_interface - */ - protected $cache; - - /** - * - * @var cache - */ - protected static $_instance; - - /** - * - * @var boolean - */ - protected static $_loaded; - - /** - * - * @var string - */ - protected $current_adapter; - - /** - * - * @var string - */ - protected $prefix; - - /** - * - * @param registryInterface $registry - * @param string $type - * @return cache_adapter - */ - protected function __construct(registryInterface $registry) - { - $type = $registry->get('GV_cache_server_type'); - - if (trim($type) === '') - $type = 'nocache'; - - $this->prefix = $registry->get('GV_sit'); - - if (self::$_loaded === true) - throw new Exception('Already tried to load, no adapters'); - - if (!isset($this->adapters[$type])) - throw new Exception(sprintf('Unknow cache type %s', $type)); - - $loaded = false; - $n = 0; - - while (!$loaded && $n < count($this->adapters[$type])) - { - try - { - $this->cache = new $this->adapters[$type][$n]($registry); - $this->current_adapter = $this->adapters[$type][$n]; - $this->cache->ping(); - $loaded = true; - } - catch (Exception $e) - { - $this->cache = $this->current_adapter = null; - $n++; - unset($e); - } - } - - if (!($this->cache instanceof cache_interface)) - { - $this->current_adapter = 'nocache'; - $this->cache = new cache_nocache($registry); - } - - self::$_loaded = true; - - return $this; - } - - /** - * - * @param registryInterface $registry - * @param string $type - * @return cache_adapter - */ - public static function get_instance(registryInterface $registry) - { - if (!self::$_instance instanceof self) - self::$_instance = new self($registry); - - return self::$_instance; - } - - /** - * - * @return string - */ - public function get_current_adpapter() - { - return $this->current_adapter; - } - - /** - * - * @param $key - * @param $value - * @param $expiration - * @return boolean - */ - public function set($key, $value, $expiration = 0) - { - try - { - return $this->cache->set($this->generate_key($key), $value, $expiration); - return true; - } - catch (Exception $e) - { - unset($e); - - return false; - } - } - - protected function generate_key($key) - { - if (is_string($key)) - { - return md5($this->prefix . ' ' . $key); - } - if (is_array($key)) - { - $ret = array(); - foreach ($key as $k => $v) - { - $ret[$k] = md5($this->prefix . ' ' . $v); - } - - return $ret; - } - } - - /** - * - * @param $key - * @return - */ - public function get($key) - { - $tmp = $this->cache->get($this->generate_key($key)); - - return $tmp; - } - - /** - * - * @param $key - * @return - */ - public function delete($key) - { - return $this->cache->delete($this->generate_key($key)); - } - - /** - * - * @param array $array_keys - * @return - */ - public function deleteMulti(Array $array_keys) - { - return $this->cache->deleteMulti($this->generate_key($array_keys)); - } - - /** - * - * @return - */ - public function getStats() - { - return $this->cache->getStats(); - } - - /** - * - * @return - */ - public function flush() - { - return $this->cache->flush(); - } - - /** - * - * @return - */ - public function get_version() - { - return $this->cache->getVersion(); - } - - /** - * - * @return boolean - */ - public function ping() - { - return $this->cache->ping(); - } - - /** - * - * @param string $message - * @return cache_adapter - */ - protected function log($message) - { - $registry = registry::get_instance(); - $date = new DateTime(); - $message = $date->format(DATE_ATOM) . " $message \n"; - $filename = $registry->get('GV_RootPath') . 'logs/cache.log'; - file_put_contents($filename, $message, FILE_APPEND); - - return $this; - } - -} diff --git a/lib/classes/cache/databox.class.php b/lib/classes/cache/databox.class.php index 6535e19b66..c23a06ad21 100644 --- a/lib/classes/cache/databox.class.php +++ b/lib/classes/cache/databox.class.php @@ -17,7 +17,7 @@ */ class cache_databox { - + protected static $refreshing = false; /** * * @param int $sbas_id @@ -25,21 +25,26 @@ class cache_databox */ public static function refresh($sbas_id) { + if(self::$refreshing) + { + return; + } + + self::$refreshing = true; + $databox = \databox::get_instance((int) $sbas_id); - $date = new \DateTime('-30 seconds'); + $date = new \DateTime('-3 seconds'); - $appbox = \appbox::get_instance(); + $appbox = \appbox::get_instance(\bootstrap::getCore()); $registry = \registry::get_instance(); - $cache_appbox = $appbox->get_cache(); - $last_update = null; try { - $last_update = $cache_appbox->get('memcached_update'); + $last_update = $appbox->get_data_from_cache('memcached_update_' . $sbas_id); } catch (\Exception $e) { @@ -51,8 +56,10 @@ class cache_databox else $last_update = new \DateTime('-10 years'); - if ($date <= $last_update || !$cache_appbox->ping()) + if ($date <= $last_update) { + self::$refreshing = false; + return; } @@ -97,10 +104,24 @@ class cache_databox $stmt = $connsbas->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); + + $record = new \record_adapter($sbas_id, $row['value']); + $record->get_caption()->delete_data_from_cache(); + + foreach ($record->get_caption()->get_fields() as $field) + { + $field->delete_data_from_cache(); + } + + foreach($record->get_subdefs() as $subdef) + { + $subdef->delete_data_from_cache(); + } + break; case 'structure': - $cache_appbox->delete(\appbox::CACHE_LIST_BASES); - $cache_appbox->delete(\appbox::CACHE_SBAS_IDS); + $appbox->delete_data_from_cache(\appbox::CACHE_LIST_BASES); + $appbox->delete_data_from_cache(\appbox::CACHE_SBAS_IDS); $sql = 'DELETE FROM memcached WHERE site_id = :site_id AND type="structure" AND value = :value'; @@ -120,7 +141,7 @@ class cache_databox $date = new \DateTime(); $now = $date->format(DATE_ISO8601); - $cache_appbox->set('memcached_update', $now); + $appbox->set_data_to_cache($now, 'memcached_update_' . $sbas_id); $conn = \connection::getPDOConnection(); @@ -129,6 +150,8 @@ class cache_databox $stmt->execute(array(':date' => $now)); $stmt->closeCursor(); + self::$refreshing = false; + return; } diff --git a/lib/classes/cache/memcache.class.php b/lib/classes/cache/memcache.class.php deleted file mode 100644 index ab7bb9b5a7..0000000000 --- a/lib/classes/cache/memcache.class.php +++ /dev/null @@ -1,158 +0,0 @@ -memcache = new Memcache(); - - $this->host = $registry->get('GV_cache_server_host'); - $this->port = $registry->get('GV_cache_server_port'); - - $this->memcache->addServer($this->host, $this->port); - - if (!$this->memcache->getServerStatus($this->host, $this->port)) - throw new Exception('Unable to connect'); - - $this->online = true; - - return $this; - } - - /** - * - * @param string $key - * @param mixed $value - * @param int $expiration - * @return cache_memcache - */ - public function set($key, $value, $expiration) - { - $this->memcache->set($key, $value, 0, $expiration); - - return $this; - } - - /** - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = $this->memcache->get($key); - - if ($value === false) - { - throw new Exception('Unable to retrieve the value'); - } - - return $value; - } - - /** - * - * @param string $key - * @return cache_memcache - */ - public function delete($key) - { - $this->memcache->delete($key); - - return $this; - } - - /** - * - * @param array $array_keys - * @return cache_memcache - */ - public function deleteMulti(Array $array_keys) - { - foreach ($array_keys as $key) - $this->memcache->delete($key); - - return $this; - } - - /** - * - * @return array - */ - public function getStats() - { - return array( - $this->host . ':' . $this->port => $this->memcache->getStats() - ); - } - - /** - * - * @return cache_memcache - */ - public function flush() - { - $this->memcache->flush(); - - return $this; - } - - /** - * - * @return string - */ - public function get_version() - { - return $this->memcache->getVersion(); - } - - /** - * - * @return boolean - */ - public function ping() - { - return!!$this->online; - } - -} diff --git a/lib/classes/cache/memcached.class.php b/lib/classes/cache/memcached.class.php deleted file mode 100644 index 1a6e53cd0a..0000000000 --- a/lib/classes/cache/memcached.class.php +++ /dev/null @@ -1,170 +0,0 @@ -memcached = new Memcached(); - - $host = $registry->get('GV_cache_server_host'); - $port = $registry->get('GV_cache_server_port'); - - /** - * We do not activate binary protocol because if some issues - * - * https://code.google.com/p/memcached/issues/detail?id=106 - * - */ - -// $this->memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); - - $this->memcached->setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); - $this->memcached->setOption(Memcached::OPT_SEND_TIMEOUT, 500); - $this->memcached->setOption(Memcached::OPT_RECV_TIMEOUT, 500); - $this->memcached->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); - $this->memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); -// @$this->memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY); - - $this->memcached->addServer($host, $port); - - $this->memcached->getVersion(); - if ($this->memcached->getResultCode() !== Memcached::RES_SUCCESS) - throw new Exception('Unable to connect'); - - $this->online = true; - - return $this; - } - - /** - * - * @param string $key - * @param mixed $value - * @param int $expiration - * @return cache_memcached - */ - public function set($key, $value, $expiration) - { - $this->memcached->set($key, $value, $expiration); - - return $this; - } - - /** - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = $this->memcached->get($key); - - if ($this->memcached->getResultCode() !== Memcached::RES_SUCCESS) - { - throw new Exception('Unable to retrieve the value'); - } - - return $value; - } - - /** - * - * @param string $key - * @return cache_memcached - */ - public function delete($key) - { - $this->memcached->delete($key); - - return $this; - } - - /** - * - * @param array $array_keys - * @return cache_memcached - */ - public function deleteMulti(Array $array_keys) - { - foreach ($array_keys as $key) - $this->memcached->delete($key); - - return $this; - } - - /** - * - * @return array - */ - public function getStats() - { - return $this->memcached->getStats(); - } - - /** - * - * @return cache_memcached - */ - public function flush() - { - $this->memcached->flush(); - - return $this; - } - - /** - * - * @return string - */ - public function get_version() - { - return $this->memcached->getVersion(); - } - - /** - * - * @return boolean - */ - public function ping() - { - return $this->online; - } - -} diff --git a/lib/classes/cache/nocache.class.php b/lib/classes/cache/nocache.class.php deleted file mode 100644 index 6bf10c01a3..0000000000 --- a/lib/classes/cache/nocache.class.php +++ /dev/null @@ -1,138 +0,0 @@ -datas[$key] = $value; - - return $this; - } - - /** - * - * @param string $key - * @return mixed - */ - public function get($key) - { - if (!isset($this->datas[$key])) - throw new Exception('Unable to retrieve the value'); - - return $this->datas[$key]; - } - - /** - * - * @param string $key - * @return cache_nocache - */ - public function delete($key) - { - if (isset($this->datas[$key])) - unset($this->datas[$key]); - - return $this; - } - - /** - * - * @param array $array_keys - * @return cache_nocache - */ - public function deleteMulti(Array $array_keys) - { - foreach ($array_keys as $key) - $this->delete($key); - - return $this; - } - - /** - * - * @return array - */ - public function getStats() - { - return array(); - } - - /** - * - * @return cache_nocache - */ - public function flush() - { - $this->datas = array(); - - return $this; - } - - /** - * - * @return string - */ - public function get_version() - { - return ''; - } - - /** - * - * @return boolean - */ - public function ping() - { - return true; - } - -} diff --git a/lib/classes/cache/opcode/adapter.class.php b/lib/classes/cache/opcode/adapter.class.php deleted file mode 100644 index 45d9e385a1..0000000000 --- a/lib/classes/cache/opcode/adapter.class.php +++ /dev/null @@ -1,174 +0,0 @@ -cache_method = self::APC; - elseif (!http_request::is_command_line() && function_exists('xcache_set')) - $this->cache_method = self::XCACHE; - else - $this->cache_method = self::NOCACHE; - - $this->prefix = $prefix; - - return $this; - } - - /** - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $key = sprintf('%s_%s', $this->prefix, $key); - switch ($this->cache_method) - { - case self::APC: - return apc_fetch($key); - break; - case self::XCACHE: - return xcache_get($key); - break; - default: - return isset(self::$_static_cache[$key]) ? self::$_static_cache[$key] : null; - break; - } - } - - /** - * - * @param string $key - * @param mixed $var - * @return cache_opcode_adapter - */ - public function set($key, $var) - { - $key = sprintf('%s_%s', $this->prefix, $key); - switch ($this->cache_method) - { - case self::APC: - if ($this->is_set($key)) - apc_delete($key); - apc_store($key, $var); - break; - case self::XCACHE: - if ($this->is_set($key)) - $this->un_set ($key); - xcache_set($key, $var); - break; - default: - self::$_static_cache[$key] = $var; - break; - } - - return $this; - } - - /** - * - * @param string $key - * @return boolean - */ - public function is_set($key) - { - $key = sprintf('%s_%s', $this->prefix, $key); - switch ($this->cache_method) - { - case self::APC: - if (function_exists('apc_exists')) - { - return apc_exists($key); - } - else - { - apc_fetch($key, $succes); - - return $succes; - } - break; - case self::XCACHE: - return xcache_isset($key); - break; - default: - return isset(self::$_static_cache[$key]); - break; - } - } - - /** - * - * @param string $key - * @return cache_opcode_adapter - */ - public function un_set($key) - { - $key = sprintf('%s_%s', $this->prefix, $key); - switch ($this->cache_method) - { - case self::APC: - apc_delete($key); - break; - case self::XCACHE: - xcache_unset($key); - break; - default: - if (isset(self::$_static_cache[$key])) - unset(self::$_static_cache[$key]); - break; - } - - return $this; - } - -} diff --git a/lib/classes/cache/redis.class.php b/lib/classes/cache/redis.class.php deleted file mode 100644 index abcf49cb05..0000000000 --- a/lib/classes/cache/redis.class.php +++ /dev/null @@ -1,151 +0,0 @@ -redis = new Redis(); - $this->redis->connect($registry->get('GV_cache_server_host'), $registry->get('GV_cache_server_port')); - if (!$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY)) - { - $this->igbinary = false; - $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); - } - - return $this; - } - - /** - * - * @param string $key - * @param mixed $value - * @param int $expiration - * @return cache_redis - */ - public function set($key, $value, $expiration) - { - if ($expiration != 0) - $this->redis->setex($key, $expiration, $value); - else - $this->redis->set($key, $value); - - return $this; - } - - /** - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $tmp = $this->redis->get($key); - if ($tmp === false && $this->redis->exists($key) === false) - throw new Exception('Unable to retrieve the value ' . $key); - - return $tmp; - } - - /** - * - * @param string $key - * @return cache_redis - */ - public function delete($key) - { - $this->redis->delete($key); - - return $this; - } - - /** - * - * @param array $array_keys - * @return cache_redis - */ - public function deleteMulti(Array $array_keys) - { - $this->redis->delete($array_keys); - - return $this; - } - - /** - * - * @return array - */ - public function getStats() - { - return array('Redis Server ('.($this->igbinary ? 'YES':'NO').' Igbinary)' => $this->redis->info()); - } - - /** - * - * @return cache_redis - */ - public function flush() - { - $this->redis->flushAll(); - - return $this; - } - - /** - * - * @return string - */ - public function get_version() - { - $infos = $this->getStats(); - - if (isset($infos['redis_version'])) - - return $infos['redis_version']; - - return false; - } - - /** - * - * @return boolean - */ - public function ping() - { - return ($this->redis->ping() === '+PONG'); - } - -} diff --git a/lib/classes/caption/Field/Value.class.php b/lib/classes/caption/Field/Value.class.php new file mode 100644 index 0000000000..0131c20483 --- /dev/null +++ b/lib/classes/caption/Field/Value.class.php @@ -0,0 +1,497 @@ +id = (int) $id; + $this->databox_field = $databox_field; + $this->record = $record; + + $connbas = $databox_field->get_databox()->get_connection(); + + $sql = 'SELECT record_id, value, VocabularyType, VocabularyId + FROM metadatas WHERE id = :id'; + + $stmt = $connbas->prepare($sql); + $stmt->execute(array(':id' => $id)); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $this->value = $row ? $row['value'] : null; + + try + { + $this->VocabularyType = $row['VocabularyType'] ? Vocabulary\Controller::get($row['VocabularyType']) : null; + $this->VocabularyId = $row['VocabularyId']; + } + catch (\Exception $e) + { + + } + + + if ($this->VocabularyType) + { + /** + * Vocabulary Control has been deactivated + */ + if (!$this->databox_field->getVocabularyControl()) + { + $this->removeVocabulary(); + } + /** + * Vocabulary Control has changed + */ + elseif ($this->databox_field->getVocabularyControl()->getType() !== $this->VocabularyType->getType()) + { + $this->removeVocabulary(); + } + /** + * Current Id is not available anymore + */ + elseif (!$this->VocabularyType->validate($this->VocabularyId)) + { + $this->removeVocabulary(); + } + /** + * String equivalence has changed + */ + elseif ($this->VocabularyType->getValue($this->VocabularyId) !== $this->value) + { + $this->set_value($this->VocabularyType->getValue($this->VocabularyId)); + } + } + + return $this; + } + + public function getVocabularyType() + { + return $this->VocabularyType; + } + + public function getVocabularyId() + { + return $this->VocabularyId; + } + + public function getId() + { + return $this->id; + } + + public function getValue() + { + return $this->value; + } + + public function getRessource() + { + return $this->VocabularyType ? $this->VocabularyType->getRessource($this->VocabularyId) : null; + } + + public function getDatabox_field() + { + return $this->databox_field; + } + + public function getRecord() + { + return $this->record; + } + + public function delete() + { + $connbas = $this->databox_field->get_connection(); + + $sql = 'DELETE FROM metadatas WHERE id = :id'; + $stmt = $connbas->prepare($sql); + $stmt->execute(array(':id' => $this->id)); + $stmt->closeCursor(); + + $sbas_id = $this->record->get_sbas_id(); + $this->record->get_caption()->delete_data_from_cache(); + + try + { + $registry = registry::get_instance(); + $sphinx_rt = sphinxrt::get_instance($registry); + + $sbas_params = phrasea::sbas_params(); + + if (isset($sbas_params[$sbas_id])) + { + $params = $sbas_params[$sbas_id]; + $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); + $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "metas_realtime" . $sbas_crc, $this->id); + $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "docs_realtime" . $sbas_crc, $this->record->get_record_id()); + } + } + catch (Exception $e) + { + unset($e); + } + + return $this; + } + + public function removeVocabulary() + { + $connbas = $this->databox_field->get_connection(); + + $params = array( + ':VocabType' => null + , ':VocabularyId' => null + , ':meta_id' => $this->getId() + ); + + $sql_up = 'UPDATE metadatas + SET VocabularyType = :VocabType, VocabularyId = :VocabularyId + WHERE id = :meta_id'; + $stmt_up = $connbas->prepare($sql_up); + $stmt_up->execute($params); + $stmt_up->closeCursor(); + + $this->VocabularyId = $this->VocabularyType = null; + + return $this; + } + + public function setVocab(Vocabulary\ControlProvider\ControlProviderInterface $vocabulary, $vocab_id) + { + $connbas = $this->databox_field->get_connection(); + + $params = array( + ':VocabType' => $vocabulary->getType() + , ':VocabularyId' => $vocab_id + , ':meta_id' => $this->getId() + ); + + $sql_up = 'UPDATE metadatas + SET VocabularyType = :VocabType, VocabularyId = :VocabularyId + WHERE id = :meta_id'; + $stmt_up = $connbas->prepare($sql_up); + $stmt_up->execute($params); + $stmt_up->closeCursor(); + + $this->set_value($vocabulary->getValue($vocab_id)); + + return $this; + } + + public function set_value($value) + { + $this->value = $value; + + $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); + $connbas = $this->databox_field->get_connection(); + + $params = array( + ':meta_id' => $this->id + , ':value' => $value + ); + + $sql_up = 'UPDATE metadatas SET value = :value WHERE id = :meta_id'; + $stmt_up = $connbas->prepare($sql_up); + $stmt_up->execute($params); + $stmt_up->closeCursor(); + + try + { + $registry = registry::get_instance(); + $sphinx_rt = sphinxrt::get_instance($registry); + + $sbas_params = phrasea::sbas_params(); + + if (isset($sbas_params[$sbas_id])) + { + $params = $sbas_params[$sbas_id]; + $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); + $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "", $this->id); + $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "", $this->record->get_record_id()); + } + } + catch (Exception $e) + { + + } + + $this->update_cache_value($value); + + return $this; + } + + /** + * + * @param array $value + * @return caption_field + */ + public function update_cache_value($value) + { + $this->record->get_caption()->delete_data_from_cache(); + $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); + try + { + $registry = registry::get_instance(); + + $sbas_params = phrasea::sbas_params(); + + if (isset($sbas_params[$sbas_id])) + { + $params = $sbas_params[$sbas_id]; + $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); + + $sphinx_rt = sphinxrt::get_instance($registry); + $sphinx_rt->replace_in_metas( + "metas_realtime" . $sbas_crc, $this->id, $this->databox_field->get_id(), $this->record->get_record_id(), $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $value, $this->record->get_creation_date() + ); + + $all_datas = array(); + foreach ($this->record->get_caption()->get_fields() as $field) + { + if (!$field->is_indexable()) + continue; + $all_datas[] = $field->get_serialized_values(); + } + $all_datas = implode(' ', $all_datas); + + $sphinx_rt->replace_in_documents( + "docs_realtime" . $sbas_crc, //$this->id, + $this->record->get_record_id(), $all_datas, $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $this->record->get_creation_date() + ); + } + } + catch (Exception $e) + { + unset($e); + } + + return $this; + } + + public static function create(databox_field &$databox_field, record_Interface $record, $value, Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null, $vocabularyId = null) + { + $connbas = $databox_field->get_connection(); + + $sql_ins = 'INSERT INTO metadatas + (id, record_id, meta_struct_id, value, VocabularyType, VocabularyId) + VALUES + (null, :record_id, :field, :value, :VocabType, :VocabId)'; + + $params = array( + ':record_id' => $record->get_record_id(), + ':field' => $databox_field->get_id(), + ':value' => $value, + ':VocabType' => $vocabulary ? $vocabulary->getType() : null, + ':VocabId' => $vocabulary ? $vocabularyId : null, + ); + + $stmt_ins = $connbas->prepare($sql_ins); + $stmt_ins->execute($params); + + $stmt_ins->closeCursor(); + $meta_id = $connbas->lastInsertId(); + + $caption_field_value = new self($databox_field, $record, $meta_id); + $caption_field_value->update_cache_value($value); + + $record->get_caption()->delete_data_from_cache(); + + return $caption_field_value; + } + + /** + * + * @return string + */ + public function highlight_thesaurus() + { + $value = $this->getValue(); + + $databox = $this->databox_field->get_databox(); + $XPATH_thesaurus = $databox->get_xpath_thesaurus(); + + $tbranch = $this->databox_field->get_tbranch(); + + if (!$tbranch || !$XPATH_thesaurus) + { + return $value; + } + + $appbox = appbox::get_instance(\bootstrap::getCore()); + $session = $appbox->get_session(); + $unicode = new unicode(); + + $DOM_branchs = $XPATH_thesaurus->query($tbranch); + + $fvalue = $value; + + $cleanvalue = str_replace(array("", "", "'"), array("", "", "'"), $fvalue); + + list($term_noacc, $context_noacc) = $this->splitTermAndContext($cleanvalue); + $term_noacc = $unicode->remove_indexer_chars($term_noacc); + $context_noacc = $unicode->remove_indexer_chars($context_noacc); + if ($context_noacc) + { + $q = "//sy[@w='" . $term_noacc . "' and @k='" . $context_noacc . "']"; + } + else + { + $q = "//sy[@w='" . $term_noacc . "' and not(@k)]"; + } + $qjs = $link = ""; + foreach ($DOM_branchs as $DOM_branch) + { + $nodes = $XPATH_thesaurus->cache_query($q, $DOM_branch); + if ($nodes->length > 0) + { + $lngfound = false; + foreach ($nodes as $node) + { + if ($node->getAttribute("lng") == $session->get_I18n()) + { + // le terme est dans la bonne langue, on le rend cliquable + list($term, $context) = $this->splitTermAndContext($fvalue); + $term = str_replace(array("", ""), array("", ""), $term); + $context = str_replace(array("", ""), array("", ""), $context); + $qjs = $term; + if ($context) + { + $qjs .= " [" . $context . "]"; + } + $link = $fvalue; + + $lngfound = true; + break; + } + + $synonyms = $XPATH_thesaurus->query("sy[@lng='" . $session->usr_i18 . "']", $node->parentNode); + foreach ($synonyms as $synonym) + { + $k = $synonym->getAttribute("k"); + if ($synonym->getAttribute("w") != $term_noacc || $k != $context_noacc) + { + $link = $qjs = $synonym->getAttribute("v"); + if ($k) + { + $link .= " (" . $k . ")"; + $qjs .= " [" . $k . "]"; + } + + $lngfound = true; + break; + } + } + } + if (!$lngfound) + { + list($term, $context) = $this->splitTermAndContext($fvalue); + $term = str_replace(array("", ""), array("", ""), $term); + $context = str_replace(array("", ""), array("", ""), $context); + $qjs = $term; + if ($context) + { + $qjs .= " [" . $context . "]"; + } + $link = $fvalue; + } + } + } + if ($qjs) + { + $value = "get_sbas_id() . "','" + . str_replace("'", "\'", $qjs) + . "', '" + . str_replace("'", "\'", $this->databox_field->get_name()) + . "');return(false);\">" + . $link + . ""; + } + + return $value; + } + + /** + * + * @param string $word + * @return array + */ + protected function splitTermAndContext($word) + { + $term = trim($word); + $context = ""; + if (($po = strpos($term, "(")) !== false) + { + if (($pc = strpos($term, ")", $po)) !== false) + { + $context = trim(substr($term, $po + 1, $pc - $po - 1)); + $term = trim(substr($term, 0, $po)); + } + } + + return array($term, $context); + } + +} diff --git a/lib/classes/caption/field.class.php b/lib/classes/caption/field.class.php index d683df07fa..090a7850d2 100644 --- a/lib/classes/caption/field.class.php +++ b/lib/classes/caption/field.class.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class caption_field implements cache_cacheableInterface +class caption_field { /** @@ -28,13 +28,7 @@ class caption_field implements cache_cacheableInterface * * @var string */ - protected $value; - - /** - * - * @var int - */ - protected $id; + protected $values; /** * @@ -49,55 +43,74 @@ class caption_field implements cache_cacheableInterface * @param int $id * @return caption_field */ - public function __construct(databox_field &$databox_field, record_Interface $record, $id) + public function __construct(databox_field &$databox_field, record_Interface $record) { $this->record = $record; - $this->id = (int) $id; - - $row = false; - try - { - try - { - $row = $this->get_data_from_cache(); - } - catch (Exception $e) - { - - $connbas = $databox_field->get_connection(); - - $sql = 'SELECT record_id, value FROM metadatas WHERE id = :id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':id' => $id)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - $this->set_data_to_cache($row); - unset($e); - } - } - catch (Exception $e) - { - unset($e); - } - if (!$row) - throw new Exception('Unknown metadata'); - $this->databox_field = $databox_field; - $this->value = $row['value']; + $this->values = array(); + + $connbas = $databox_field->get_connection(); + + $sql = 'SELECT id FROM metadatas + WHERE record_id = :record_id + AND meta_struct_id = :meta_struct_id'; + + $params = array( + ':record_id' => $record->get_record_id() + , ':meta_struct_id' => $databox_field->get_id() + ); + + $stmt = $connbas->prepare($sql); + $stmt->execute($params); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + if (!$databox_field->is_multi() && count($rs) > 1) + { + /** + * TRIGG CORRECTION; + */ + } + + foreach ($rs as $row) + { + $this->values[$row['id']] = new caption_Field_Value($databox_field, $record, $row['id']); + } return $this; } + /** + * + * @return record_adapter + */ + public function get_record() + { + return $this->record; + } + + /** + * + * @return boolean + */ public function is_required() { return $this->databox_field->is_required(); } + /** + * + * @return boolean + */ public function is_multi() { return $this->databox_field->is_multi(); } + /** + * + * @return boolean + */ public function is_readonly() { return $this->databox_field->is_readonly(); @@ -109,104 +122,24 @@ class caption_field implements cache_cacheableInterface */ public function delete() { - $connbas = $this->databox_field->get_connection(); - $sql = 'DELETE FROM metadatas WHERE id = :id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':id' => $this->id)); - $stmt->closeCursor(); - $this->delete_data_from_cache(); - - $sbas_id = $this->record->get_sbas_id(); - $this->record->get_caption()->delete_data_from_cache(); - - try + foreach ($this->get_values() as $value) { - $registry = registry::get_instance(); - $sphinx_rt = sphinxrt::get_instance($registry); - - $sbas_params = phrasea::sbas_params(); - - if (isset($sbas_params[$sbas_id])) - { - $params = $sbas_params[$sbas_id]; - $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); - $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "metas_realtime" . $sbas_crc, $this->id); - $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "docs_realtime" . $sbas_crc, $this->record->get_record_id()); - } - } - catch (Exception $e) - { - unset($e); + $value->delete(); } return $this; } /** - * Part of the cache_cacheableInterface * - * @param string $option + * @param array $values + * @param string $separator * @return string */ - public function get_cache_key($option = null) + protected static function serialize_value(Array $values, $separator, $highlight = false) { - return 'captionfield_' . $this->record->get_serialize_key() - . $this->id . ($option ? '_' . $option : ''); - } - - /** - * Part of the cache_cacheableInterface - * - * @param string $option - * @return mixed - */ - public function get_data_from_cache($option = null) - { - $databox = databox::get_instance($this->record->get_sbas_id()); - - return $databox->get_data_from_cache($this->get_cache_key($option)); - } - - /** - * Part of the cache_cacheableInterface - * - * @param mixed $value - * @param string $option - * @param int $duration - * @return caption_field - */ - public function set_data_to_cache($value, $option = null, $duration = 0) - { - $databox = databox::get_instance($this->record->get_sbas_id()); - $databox->set_data_to_cache($value, $this->get_cache_key($option), $duration); - - return $this; - } - - /** - * Part of the cache_cacheableInterface - * - * @param string $option - * @return caption_field - */ - public function delete_data_from_cache($option = null) - { - $databox = databox::get_instance($this->record->get_sbas_id()); - $databox->delete_data_from_cache($this->get_cache_key($option)); - - return $this; - } - - /** - * - * @param array $value - * @param databox_field $databox_field - * @return string - */ - protected static function serialize_value(Array $value, $separator) - { - if(strlen($separator) > 1) + if (strlen($separator) > 1) $separator = $separator[0]; if (trim($separator) === '') @@ -214,158 +147,65 @@ class caption_field implements cache_cacheableInterface else $separator = ' ' . $separator . ' '; - return implode($separator, $value); + $array_values = array(); + + foreach ($values as $value) + { + if ($highlight) + $array_values[] = $value->highlight_thesaurus(); + else + $array_values[] = $value->getValue(); + } + + return implode($separator, $array_values); } /** * - * @param array $value - * @return caption_field + * @return array */ - public function set_value(Array $value) + public function get_values() { - $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); - $connbas = $this->databox_field->get_connection(); - - $sql_up = 'UPDATE metadatas SET value = :value WHERE id = :meta_id'; - $stmt_up = $connbas->prepare($sql_up); - $stmt_up->execute(array(':meta_id' => $this->get_meta_id(), ':value' => self::serialize_value($value, $this->databox_field->get_separator()))); - $stmt_up->closeCursor(); - - try - { - $registry = registry::get_instance(); - $sphinx_rt = sphinxrt::get_instance($registry); - - $sbas_params = phrasea::sbas_params(); - - if (isset($sbas_params[$sbas_id])) - { - $params = $sbas_params[$sbas_id]; - $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); - $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "", $this->get_meta_id()); - $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "", $this->record->get_record_id()); - } - } - catch (Exception $e) - { - - } - - $this->update_cache_value($value); - - return $this; + return $this->values; } /** * - * @param array $value - * @return caption_field + * @param int $meta_id + * @return array */ - public function update_cache_value(Array $value) + public function get_value($meta_id) { - $this->delete_data_from_cache(); - $this->record->get_caption()->delete_data_from_cache(); - $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); - try - { - $registry = registry::get_instance(); - - $sbas_params = phrasea::sbas_params(); - - if (isset($sbas_params[$sbas_id])) - { - $params = $sbas_params[$sbas_id]; - $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname']))); - - $sphinx_rt = sphinxrt::get_instance($registry); - $sphinx_rt->replace_in_metas( - "metas_realtime" . $sbas_crc, $this->id, $this->databox_field->get_id(), $this->record->get_record_id(), $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $value, $this->record->get_creation_date() - ); - - $all_datas = array(); - foreach ($this->record->get_caption()->get_fields() as $field) - { - if (!$field->is_indexable()) - continue; - $all_datas[] = $field->get_value(true); - } - $all_datas = implode(' ', $all_datas); - - $sphinx_rt->replace_in_documents( - "docs_realtime" . $sbas_crc, //$this->id, - $this->record->get_record_id(), $all_datas, $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $this->record->get_creation_date() - ); - } - } - catch (Exception $e) - { - unset($e); - } - - return $this; + return $this->values[$meta_id]; } /** * - * @param databox_field $databox_field - * @param record_Interface $record - * @param array $value - * @return caption_field + * @param string $custom_separator + * @return mixed */ - public static function create(databox_field &$databox_field, record_Interface $record, Array $value) - { - - $sbas_id = $databox_field->get_databox()->get_sbas_id(); - $connbas = $databox_field->get_connection(); - $sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value) - VALUES - (null, :record_id, :field, :value)'; - $stmt_ins = $connbas->prepare($sql_ins); - $stmt_ins->execute( - array( - ':record_id' => $record->get_record_id(), - ':field' => $databox_field->get_id(), - ':value' => self::serialize_value($value, $databox_field->get_separator()) - ) - ); - $stmt_ins->closeCursor(); - $meta_id = $connbas->lastInsertId(); - - $caption_field = new self($databox_field, $record, $meta_id); - $caption_field->update_cache_value($value); - - $record->get_caption()->delete_data_from_cache(); - - return $caption_field; - } - - /** - * - * @return string - */ - public function get_value($as_string = false, $custom_separator = false) + public function get_serialized_values($custom_separator = false, $highlightTheso = false) { if ($this->databox_field->is_multi() === true) { - if ($as_string === true && $custom_separator === false) - { - return $this->value; - } - $separator = $this->databox_field->get_separator(); - $array_values = self::get_multi_values($this->value, $separator); - - if ($as_string === true && $custom_separator !== false) - - return self::serialize_value($array_values, $custom_separator); + if ($custom_separator !== false) + $separator = $custom_separator; else + $separator = $this->databox_field->get_separator(); - return $array_values; + return self::serialize_value($this->values, $separator, $highlightTheso); } else { - return $this->value; + foreach ($this->values as $value) + { + /* @var $value Caption_Field_Value */ + + return $value->highlight_thesaurus(); + } } + + return null; } /** @@ -395,15 +235,6 @@ class caption_field implements cache_cacheableInterface return $this->databox_field->is_indexable(); } - /** - * - * @return int - */ - public function get_meta_id() - { - return $this->id; - } - /** * * @return databox_field @@ -419,132 +250,11 @@ class caption_field implements cache_cacheableInterface */ public function highlight_thesaurus() { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - $unicode = new unicode(); - - $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); - - $value = $this->get_value(true); - - $databox = databox::get_instance($sbas_id); - $XPATH_thesaurus = $databox->get_xpath_thesaurus(); - - $tbranch = $this->databox_field->get_tbranch(); - if ($tbranch && $XPATH_thesaurus) - { - $DOM_branchs = $XPATH_thesaurus->query($tbranch); - - $fvalue = $value; - - $cleanvalue = str_replace(array("", "", "'"), array("", "", "'"), $fvalue); - - list($term_noacc, $context_noacc) = $this->splitTermAndContext($cleanvalue); - $term_noacc = $unicode->remove_indexer_chars($term_noacc); - $context_noacc = $unicode->remove_indexer_chars($context_noacc); - if ($context_noacc) - { - $q = "//sy[@w='" . $term_noacc . "' and @k='" . $context_noacc . "']"; - } - else - { - $q = "//sy[@w='" . $term_noacc . "' and not(@k)]"; - } - $qjs = $link = ""; - foreach ($DOM_branchs as $DOM_branch) - { - $nodes = $XPATH_thesaurus->cache_query($q, $DOM_branch); - if ($nodes->length > 0) - { - $lngfound = false; - foreach ($nodes as $node) - { - if ($node->getAttribute("lng") == $session->get_I18n()) - { - // le terme est dans la bonne langue, on le rend cliquable - list($term, $context) = $this->splitTermAndContext($fvalue); - $term = str_replace(array("", ""), array("", ""), $term); - $context = str_replace(array("", ""), array("", ""), $context); - $qjs = $term; - if ($context) - { - $qjs .= " [" . $context . "]"; - } - $link = $fvalue; - - $lngfound = true; - break; - } - - $synonyms = $XPATH_thesaurus->query("sy[@lng='" . $session->usr_i18 . "']", $node->parentNode); - foreach ($synonyms as $synonym) - { - $k = $synonym->getAttribute("k"); - if ($synonym->getAttribute("w") != $term_noacc || $k != $context_noacc) - { - $link = $qjs = $synonym->getAttribute("v"); - if ($k) - { - $link .= " (" . $k . ")"; - $qjs .= " [" . $k . "]"; - } - - $lngfound = true; - break; - } - } - } - if (!$lngfound) - { - list($term, $context) = $this->splitTermAndContext($fvalue); - $term = str_replace(array("", ""), array("", ""), $term); - $context = str_replace(array("", ""), array("", ""), $context); - $qjs = $term; - if ($context) - { - $qjs .= " [" . $context . "]"; - } - $link = $fvalue; - } - } - } - if ($qjs) - { - $value = "get_name()) - . "');return(false);\">" - . $link - . ""; - } - } + $value = $this->get_serialized_values(false, true); return $value; } - /** - * - * @param string $word - * @return array - */ - protected function splitTermAndContext($word) - { - $term = trim($word); - $context = ""; - if (($po = strpos($term, "(")) !== false) - { - if (($pc = strpos($term, ")", $po)) !== false) - { - $context = trim(substr($term, $po + 1, $pc - $po - 1)); - $term = trim(substr($term, 0, $po)); - } - } - - return array($term, $context); - } - /** * * @param string $serialized_value @@ -564,7 +274,7 @@ class caption_field implements cache_cacheableInterface // en regexp pour utiliser split $separator = preg_split('//', $separator, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $separator = '/\\' . implode('|\\', $separator) . '/'; - $values = preg_split($separator, $serialized_value); + $values = preg_split($separator, $serialized_value); } foreach ($values as $key => $value) @@ -575,20 +285,20 @@ class caption_field implements cache_cacheableInterface return $values; } - public static function delete_all_metadatas(databox_field $databox_field) + public static function rename_all_metadatas(databox_field $databox_field) { - $sql = 'SELECT count(id) as count_id FROM metadatas + $sql = 'SELECT count(id) as count_id FROM metadatas WHERE meta_struct_id = :meta_struct_id'; - $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); + $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); $params = array( - ':meta_struct_id' => $databox_field->get_id() + ':meta_struct_id' => $databox_field->get_id() ); $stmt->execute($params); $rowcount = $stmt->rowCount(); $stmt->closeCursor(); - $n = 0; + $n = 0; $increment = 500; while ($n < $rowcount) @@ -597,13 +307,13 @@ class caption_field implements cache_cacheableInterface WHERE meta_struct_id = :meta_struct_id LIMIT ' . $n . ', ' . $increment; $params = array( - ':meta_struct_id' => $databox_field->get_id() + ':meta_struct_id' => $databox_field->get_id() ); - $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); + $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); $stmt->execute($params); $rowcount = $stmt->rowCount(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); unset($stmt); @@ -612,8 +322,63 @@ class caption_field implements cache_cacheableInterface try { $record = $databox_field->get_databox()->get_record($row['record_id']); - $caption_field = new caption_field($databox_field, $record, $row['id']); + $record->set_metadatas(array()); + unset($record); + } + catch (Exception $e) + { + + } + } + + $n += $increment; + } + + return; + } + + public static function delete_all_metadatas(databox_field $databox_field) + { + $sql = 'SELECT count(id) as count_id FROM metadatas + WHERE meta_struct_id = :meta_struct_id'; + + $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); + $params = array( + ':meta_struct_id' => $databox_field->get_id() + ); + + $stmt->execute($params); + $rowcount = $stmt->rowCount(); + $stmt->closeCursor(); + + $n = 0; + $increment = 500; + + while ($n < $rowcount) + { + $sql = 'SELECT record_id, id FROM metadatas + WHERE meta_struct_id = :meta_struct_id + LIMIT ' . $n . ', ' . $increment; + + $params = array( + ':meta_struct_id' => $databox_field->get_id() + ); + + $stmt = $databox_field->get_databox()->get_connection()->prepare($sql); + $stmt->execute($params); + $rowcount = $stmt->rowCount(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + unset($stmt); + + foreach ($rs as $row) + { + try + { + $record = $databox_field->get_databox()->get_record($row['record_id']); + $caption_field = new caption_field($databox_field, $record); $caption_field->delete(); + $record->set_metadatas(array()); unset($caption_field); unset($record); } diff --git a/lib/classes/caption/record.class.php b/lib/classes/caption/record.class.php index 43ac0636c6..49a5b65670 100644 --- a/lib/classes/caption/record.class.php +++ b/lib/classes/caption/record.class.php @@ -50,18 +50,15 @@ class caption_record implements caption_interface, cache_cacheableInterface $this->record = $record; $this->databox = $databox; - - $this->retrieve_fields(); - - return $this; } protected function retrieve_fields() { if (is_array($this->fields)) - + { return $this->fields; + } $fields = array(); try @@ -70,12 +67,12 @@ class caption_record implements caption_interface, cache_cacheableInterface } catch (Exception $e) { - $sql = "SELECT m.id as meta_id, s.id as structure_id + $sql = "SELECT m.id as meta_id, s.id as structure_id FROM metadatas m, metadatas_structure s WHERE m.record_id = :record_id AND s.id = m.meta_struct_id"; $stmt = $this->databox->get_connection()->prepare($sql); $stmt->execute(array(':record_id' => $this->record->get_record_id())); - $fields = $stmt->fetchAll(PDO::FETCH_ASSOC); + $fields = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $this->set_data_to_cache($fields); } @@ -86,10 +83,10 @@ class caption_record implements caption_interface, cache_cacheableInterface try { $databox_meta_struct = databox_field::get_instance($this->databox, $row['structure_id']); - $metadata = new caption_field($databox_meta_struct, $this->record, $row['meta_id']); + $metadata = new caption_field($databox_meta_struct, $this->record); $rec_fields[$databox_meta_struct->get_id()] = $metadata; - $dces_element = $metadata->get_databox_field()->get_dces_element(); + $dces_element = $metadata->get_databox_field()->get_dces_element(); if ($dces_element instanceof databox_Field_DCESAbstract) { $this->dces_elements[$dces_element->get_label()] = $databox_meta_struct->get_id(); @@ -125,6 +122,24 @@ class caption_record implements caption_interface, cache_cacheableInterface return $fields; } + /** + * + * @param type $fieldname + * @return \caption_field + * @throws \Exception + */ + public function get_field($fieldname) + { + foreach ($this->retrieve_fields() as $meta_struct_id => $field) + { + if ($field->get_name() == $fieldname) + + return $field; + } + + throw new \Exception('Field not found'); + } + /** * * @param type $label @@ -134,8 +149,10 @@ class caption_record implements caption_interface, cache_cacheableInterface { $fields = $this->retrieve_fields(); if (isset($this->dces_elements[$label])) - + { return $fields[$this->dces_elements[$label]]; + } + return null; } @@ -146,7 +163,7 @@ class caption_record implements caption_interface, cache_cacheableInterface * @param searchEngine_adapter $searchEngine * @return array */ - public function get_highlight_fields($highlight='', Array $grep_fields = null, searchEngine_adapter $searchEngine = null) + public function get_highlight_fields($highlight = '', Array $grep_fields = null, searchEngine_adapter $searchEngine = null) { return $this->highlight_fields($highlight, $grep_fields, $searchEngine); } @@ -158,23 +175,24 @@ class caption_record implements caption_interface, cache_cacheableInterface * @param searchEngine_adapter $searchEngine * @return array */ - protected function highlight_fields($highlight, Array $grep_fields = null, searchEngine_adapter $searchEngine =null) + protected function highlight_fields($highlight, Array $grep_fields = null, searchEngine_adapter $searchEngine = null) { $fields = array(); - foreach ($this->fields as $meta_struct_id => $field) + + foreach ($this->retrieve_fields() as $meta_struct_id => $field) { if (is_array($grep_fields) && !in_array($field->get_name(), $grep_fields)) continue; $value = preg_replace( - "(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))" - , '$1 $2  $7' - , $field->highlight_thesaurus() + "(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))" + , '$1 $2  $7' + , $field->highlight_thesaurus() ); $fields[$field->get_name()] = array( - 'value' => $value - , 'separator' => $field->get_databox_field()->get_separator() + 'value' => $value + , 'separator' => $field->get_databox_field()->get_separator() ); } @@ -188,7 +206,12 @@ class caption_record implements caption_interface, cache_cacheableInterface foreach ($fields as $key => $value) { + if(!isset($fields[$key])) + continue; + + //if(strpos($fields[$key]['value'], 'is_active = true; $this->delete_data_from_cache(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES); $this->databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); cache_databox::update($this->databox->get_sbas_id(), 'structure'); @@ -142,7 +142,7 @@ class collection implements cache_cacheableInterface $stmt->closeCursor(); $this->is_active = false; $this->delete_data_from_cache(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES); $this->databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); cache_databox::update($this->databox->get_sbas_id(), 'structure'); @@ -293,6 +293,7 @@ class collection implements cache_cacheableInterface $stmt = $this->get_connection()->prepare($sql); $stmt->execute(array(':coll_id' => $this->get_coll_id())); + while ($row2 = $stmt->fetch(PDO::FETCH_ASSOC)) { @unlink(p4string::addEndSlash($row2['path']) . 'watermark_' . $row2['file']); @@ -302,9 +303,36 @@ class collection implements cache_cacheableInterface return $this; } + public function reset_stamp($record_id = null) + { + + $sql = 'SELECT path, file FROM record r INNER JOIN subdef s USING(record_id) + WHERE r.coll_id = :coll_id + AND r.type="image" AND s.name IN ("preview", "document")'; + + $params = array(':coll_id' => $this->get_coll_id()); + + if($record_id) + { + $sql .= ' AND record_id = :record_id'; + $params[':record_id'] = $record_id; + } + + $stmt = $this->get_connection()->prepare($sql); + $stmt->execute($params); + + while ($row2 = $stmt->fetch(PDO::FETCH_ASSOC)) + { + @unlink(p4string::addEndSlash($row2['path']) . 'stamp_' . $row2['file']); + } + $stmt->closeCursor(); + + return $this; + } + public function delete() { - while($this->get_record_amount() > 0) + while ($this->get_record_amount() > 0) { $this->empty_collection(); } @@ -314,7 +342,7 @@ class collection implements cache_cacheableInterface $stmt->execute(array(':coll_id' => $this->get_coll_id())); $stmt->closeCursor(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $sql = "DELETE FROM bas WHERE base_id = :base_id"; $stmt = $appbox->get_connection()->prepare($sql); @@ -350,8 +378,10 @@ class collection implements cache_cacheableInterface { $coll_id = phrasea::collFromBas($base_id); $sbas_id = phrasea::sbasFromBas($base_id); - if(!$sbas_id || !$coll_id) - throw new Exception_Databox_CollectionNotFound(); + if (!$sbas_id || !$coll_id) + { + throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found")); + } $databox = databox::get_instance($sbas_id); return self::get_from_coll_id($databox, $coll_id); @@ -479,7 +509,7 @@ class collection implements cache_cacheableInterface $conn = $appbox->get_connection(); $new_bas = false; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $prefs = ' @@ -512,15 +542,15 @@ class collection implements cache_cacheableInterface $stmt->closeCursor(); $new_bas = $conn->lastInsertId(); - - phrasea::reset_baseDatas(); - self::set_admin($new_bas, $user); $databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); $appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES); cache_databox::update($sbas_id, 'structure'); + phrasea::reset_baseDatas(); + self::set_admin($new_bas, $user); + return self::get_from_coll_id($databox, $new_id); } @@ -553,7 +583,7 @@ class collection implements cache_cacheableInterface public static function mount_collection($sbas_id, $coll_id, User_Adapter $user) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $sql = "INSERT INTO bas (base_id, active, server_coll_id, sbas_id, aliases) diff --git a/lib/classes/connection.class.php b/lib/classes/connection.class.php index 921505f04d..df7ce474b3 100755 --- a/lib/classes/connection.class.php +++ b/lib/classes/connection.class.php @@ -23,11 +23,13 @@ class connection * @var Array */ private static $_PDO_instance = array(); + /** * * @var boolean */ private static $_selfinstance; + /** * * @var Array @@ -107,7 +109,7 @@ class connection * @param string $name * @return connection_pdo */ - public static function getPDOConnection($name = null) + public static function getPDOConnection($name = null, registryInterface $registry = null) { self::instantiate(); if (trim($name) == '') @@ -134,10 +136,19 @@ class connection } else { - if (!is_file(dirname(__FILE__) . '/../../config/connexion.inc')) - throw new Exception('Unable to load config file'); - require (dirname(__FILE__) . '/../../config/connexion.inc'); + $configuration = \Alchemy\Phrasea\Core\Configuration::build(); + + $choosenConnexion = $configuration->getPhraseanet()->get('database'); + + $connexion = $configuration->getConnexion($choosenConnexion); + + $hostname = $connexion->get('host'); + $port = $connexion->get('port'); + $user = $connexion->get('user'); + $password = $connexion->get('password'); + $dbname = $connexion->get('dbname'); } + if (isset($connection_params[$name])) { $hostname = $connection_params[$name]['host']; @@ -149,7 +160,7 @@ class connection try { - self::$_PDO_instance[$name] = new connection_pdo($name, $hostname, $port, $user, $password, $dbname); + self::$_PDO_instance[$name] = new connection_pdo($name, $hostname, $port, $user, $password, $dbname, array(), $registry); self::$_PDO_instance[$name]->query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'"); } catch (Exception $e) diff --git a/lib/classes/connection/abstract.class.php b/lib/classes/connection/abstract.class.php index bbec4a6638..66c2a8ff64 100644 --- a/lib/classes/connection/abstract.class.php +++ b/lib/classes/connection/abstract.class.php @@ -40,7 +40,9 @@ abstract class connection_abstract extends PDO public static function html_pdo_exception(PDOException $e) { $p = array('e' => $e); - $twig = new supertwig(); + + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); return $twig->render('common/pdo_exception.html', $p); } diff --git a/lib/classes/connection/pdo.class.php b/lib/classes/connection/pdo.class.php index 8450390eaf..310848391a 100644 --- a/lib/classes/connection/pdo.class.php +++ b/lib/classes/connection/pdo.class.php @@ -18,6 +18,7 @@ class connection_pdo extends connection_abstract implements connection_interface { + protected $registry; /** * * @param string $name @@ -29,8 +30,9 @@ class connection_pdo extends connection_abstract implements connection_interface * @param array $options * @return connection_pdo */ - public function __construct($name, $hostname, $port, $user, $passwd, $dbname=false, $options=array()) + public function __construct($name, $hostname, $port, $user, $passwd, $dbname=false, $options=array(), registryInterface $registry = null) { + $this->registry = $registry ? $registry : registry::get_instance(); $this->name = $name; if ($dbname) $dsn = 'mysql:dbname=' . $dbname . ';host=' . $hostname . ';port=' . $port . ';'; @@ -63,13 +65,12 @@ class connection_pdo extends connection_abstract implements connection_interface */ public function prepare($statement, $driver_options = array()) { - $registry = registry::get_instance(); - if ($registry->get('GV_debug')) + if ($this->registry->get('GV_debug')) return new connection_pdoStatementDebugger(parent::prepare($statement, $driver_options)); else - return parent::prepare($statement, $driver_options); + return parent::prepare($statement, $driver_options); } /** @@ -88,7 +89,7 @@ class connection_pdo extends connection_abstract implements connection_interface */ protected function log($message) { - file_put_contents(dirname(__FILE__) . '/../../../logs/sql_log.log', $message . "\n", FILE_APPEND); + file_put_contents(__DIR__ . '/../../../logs/sql_log.log', $message . "\n", FILE_APPEND); return $this; } diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 4777e5fcb1..4b25166763 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -113,7 +113,7 @@ class databox extends base { $this->registry = registry::get_instance(); $this->connection = connection::getPDOConnection($sbas_id); - $this->cache = cache_adapter::get_instance($this->registry); + $this->Core = \bootstrap::getCore(); $this->id = $sbas_id; $connection_params = phrasea::sbas_params(); @@ -518,7 +518,7 @@ class databox extends base public static function mount(appbox $appbox, $host, $port, $user, $password, $dbname, registry $registry) { $name = 'test'; - $connection = new connection_pdo($name, $host, $port, $user, $password, $dbname); + $connection = new connection_pdo($name, $host, $port, $user, $password, $dbname, array(), $registry); $conn = $appbox->get_connection(); $sql = 'SELECT MAX(ord) as ord FROM sbas'; @@ -668,7 +668,7 @@ class databox extends base public function delete() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $sql = 'DROP DATABASE `' . $this->get_dbname() . '`'; $stmt = $this->get_connection()->prepare($sql); @@ -726,7 +726,7 @@ class databox extends base public static function get_available_metadatas() { $available_fields = array(); - $dir = dirname(__FILE__) . '/metadata/description/'; + $dir = __DIR__ . '/metadata/description/'; $registry = registry::get_instance(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { @@ -859,7 +859,7 @@ class databox extends base $this->meta_struct = null; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES); $this->delete_data_from_cache(self::CACHE_STRUCTURE); $this->delete_data_from_cache(self::CACHE_META_STRUCT); @@ -991,13 +991,6 @@ class databox extends base { } - - if (isset($field['regname'])) - $meta_struct_field->set_regname(); - if (isset($field['regdate'])) - $meta_struct_field->set_regdate(); - if (isset($field['regdesc'])) - $meta_struct_field->set_regdesc(); } return $this; diff --git a/lib/classes/databox/cgu.class.php b/lib/classes/databox/cgu.class.php index 1c701dd382..2306d9d13c 100644 --- a/lib/classes/databox/cgu.class.php +++ b/lib/classes/databox/cgu.class.php @@ -31,8 +31,9 @@ class databox_cgu foreach ($terms as $name => $term) { if (trim($term['terms']) == '') + { continue; - + } $out .= ' - - - '; - } - - return $out; -} - -function sendHdOk($usr, $lst) -{ - - - $conn = connection::getPDOConnection(); - - $ret = array(); - - $bases = array(); - foreach ($lst as $basrec) - { - $basrec = explode('_', $basrec); - if (count($basrec) == 2) - { - $record = new record_adapter($basrec[0], $basrec[1]); - - $bases[] = $record->get_base_id(); - unset($record); - } - } - - $bases = implode(',', array_unique($bases)); - if ($bases != '') - { - $sql = 'SELECT base_id, candwnldhd FROM basusr WHERE usr_id = :usr_id - AND base_id IN (' . $bases . ') AND actif="1" AND candwnldhd="1" '; - - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $ret[] = $row['base_id']; - } - } - - return $ret; -} - -function whatCanIAdmin($usr) -{ - $conn = connection::getPDOConnection(); - - $canAdmin = array(); - - $sql = "SELECT bu.canAdmin,bu.base_id FROM basusr bu, bas b - WHERE bu.usr_id = :usr_id AND b.base_id=bu.base_id AND b.active='1'"; - - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - if ($row["canAdmin"] == "1") - $canAdmin[$row['base_id']] = phrasea::bas_names($row['base_id']); - } - - return $canAdmin; -} - -function getPushLanguage($usr, $lng) -{ - $ret = array(); - $str = array( - "selNameEmptyVal" - , "notInList" - , "userssel" - , "wrongmail" - , "noUsersSel" - , "selNameEmpty" - ); - - - $ret["selNameEmptyVal"] = _('push::alertjs: un panier doit etre cree pour votre envoi, merci de specifier un nom'); - $ret["notInList"] = _('push::alertjs: vous n\'etes pas dans la liste des personne validant, voulez vous etre ajoute ?'); - $ret["userssel"] = _('phraseanet::utilisateurs selectionnes'); - $ret["wrongmail"] = _('phraseanet:: email invalide'); - $ret["noUsersSel"] = _('push::alertjs: aucun utilisateur n\'est selectionne'); - $ret["selNameEmpty"] = _('push::alertjs: vous devez specifier un nom de panier'); - $ret['removeIlist'] = _('push:: supprimer la recherche'); - $ret['removeList'] = _('push:: supprimer la(es) liste(s) selectionnee(s)'); - - return p4string::jsonencode($ret); -} - -function createUserOnFly($usr, $arrayUsr, $arrayBases, $arrayPrev=array(), $arrayWm=array()) -{ - - - - $id = trim(stripslashes(urldecode($arrayUsr['ID']))); - $ident = trim(urldecode($arrayUsr['IDENT'])); - $mail = trim(urldecode($arrayUsr['MAIL'])); - $nom = trim(urldecode($arrayUsr['NOM'])); - $prenom = trim(urldecode($arrayUsr['PREN'])); - $societe = trim(urldecode($arrayUsr['SOCIE'])); - $fonction = trim(urldecode($arrayUsr['FUNC'])); - $activite = trim(urldecode($arrayUsr['ACTI'])); - $country = trim(urldecode($arrayUsr['COUNTRY'])); - $dateEnd = trim(urldecode($arrayUsr['DATE_END'])); - $sexe = $arrayUsr['CIV']; - - $conn = connection::getPDOConnection(); - - $n = 1; - if ($ident == "" && !is_numeric($id)) - { - if ($nom == "") - { - $ident = explode('@', $mail); - $ident = $ident[0]; - }else - $ident = $nom; - }else - $n = 0; - while ($n != 0) - { - $usr_id = User_Adapter::get_usr_id_from_login($ident); - if($usr_id) - { - $n = 1; - $ident.=rand(0, 9); - } - } - - if (is_numeric($id)) - { - $sql = 'SELECT usr_id FROM usr - WHERE usr_id = :usr_id AND usr_mail = :usr_mail - AND usr_login = :usr_login'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $id, ':usr_mail' => $mail, ':usr_login' => $ident)); - $num_rows = $stmt->rowCount(); - $stmt->closeCursor(); - - if ($num_rows == 0) - - return '-23'; - else - $id = $id; - -// verifier que jai bien le droit dediter ce mec - } - else - { -//verifier que ya tjrs pas d'user avec le meme mail - - if (count(newUserCheckMail($usr, '', $mail, '', 'PHP')) != 0) - { - return '-24'; - } - - try - { - $appbox = appbox::get_instance(); - $password = random::generatePassword(24); - $user = User_Adapter::create($appbox, $ident, $password, $mail, false, false); - - $user->set_company($societe) - ->set_job($activite) - ->set_position($fonction) - ->set_gender($sexe) - ->set_firstname($prenom) - ->set_lastname($nom); - - return $user->get_id(); - } - catch (Exception $e) - { - return '-2'; - } - } - - foreach ($arrayBases as $base) - { - if (is_numeric($base)) - { - $timeLimit = '0'; - $limitedTo = '0000-00-00 00:00:00'; - if ($dateEnd != '') - { - $timeLimit = '1'; - $limitedTo = $dateEnd; - } - $sql = "INSERT INTO basusr" . - " (base_id, usr_id, actif, creationdate,time_limited,limited_to )" . - " VALUES (:base_id, :usr_id, '1',now() ,:time_limited ,:time_limit_to)"; - - $params = array( - ':base_id' => $base - , ':usr_id' => $id - , ':time_limited' => $timeLimit - , ':time_limit_to' => $limitedTo - ); - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - $sql = "INSERT INTO sbasusr - (sbas_id, usr_id) - VALUES (:sbas_id, :usr_id)"; - - $params = array(':sbas_id' => phrasea::sbasFromBas($base), ':usr_id' => $id); - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - } - } - foreach ($arrayPrev as $base) - { - if (is_numeric($base) && in_array($base, $arrayBases)) - { - $sql = "UPDATE basusr SET candwnldpreview='1' - WHERE usr_id = :usr_id AND base_id = :base_id"; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $id, ':base_id' => $base)); - $stmt->closeCursor(); - } - } - foreach ($arrayWm as $base) - { - if (is_numeric($base) && in_array($base, $arrayBases)) - { - $sql = "UPDATE basusr SET nowatermark='0' - WHERE usr_id = :usr_id AND base_id = :base_id"; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $id, ':base_id' => $base)); - $stmt->closeCursor(); - } - } - - return $id; -} - -function whatCanIPush($usr, $lst) -{ - $newlst = array(); - - $user = User_Adapter::getInstance($usr, appbox::get_instance()); - - foreach ($lst as $basrec) - { - $basrec = explode('_', $basrec); - if (count($basrec) != 2) - continue; - - $sbas_id = $basrec[0]; - try - { - $record = new record_adapter($sbas_id, $basrec[1]); - } - catch(Exception $e) - { - continue; - } - $base_id = $record->get_base_id(); - - if (!$user->ACL()->has_right_on_base($base_id, 'canpush')) - continue; - - if ($record->is_grouping()) - { - foreach ($record->get_children() as $tmpl) - $newlst[] = sprintf("%s_%s", $tmpl->get_base_id(), $tmpl->get_record_id()); - } - else - { - $newlst[] = implode('_', $basrec); - } - unset($record); - } - - return $newlst; -} - -function loadUsers($usr, $token, $filters) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $conn = $appbox->get_connection(); - $out = array(); - - $datas = sqlFromFilters($usr, $filters); - - $sql = $datas['sql']; - $params = $datas['params']; - - $ret = 0; - - $push_datas = $session->storage()->get('push', array()); - if (isset($push_datas[$token])) - { - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $push_datas[$token]['usrs'][$row['usr_id']] = array('HD' => 0); - } - $session->storage()->set('push', $push_datas); - $ret = count($push_datas[$token]['usrs']); - } - - return $ret; -} - -function unloadUsers($usr, $token, $filters) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $out = array(); - - $ret = -1; - $push_datas = $session->storage()->get('push', array()); - if (isset($push_datas[$token])) - { - $push_datas[$token]['usrs'] = array(); - $session->storage()->set('push', $push_datas); - $ret = count($push_datas[$token]['usrs']); - } - - return $ret; -} - -function addUser($usr, $token, $usr_ids) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - - $ret = array('result' => array(), 'selected' => 0); - - $conn = $appbox->get_connection(); - - $datas = sqlFromFilters($usr, ''); - - $sql = $datas['sql']; - $params = $datas['params']; - - $push_datas = $session->storage()->get('push', array()); - if (isset($push_datas[$token])) - { - $usr_ids = json_decode(stripslashes($usr_ids)); - - $result = array(); - foreach ($usr_ids as $usr_id => $add) - { - $zsql = $sql . ' AND usr.usr_id = :extra_usr_id'; - - $params[':extra_usr_id'] = $usr_id; - - $stmt = $conn->prepare($zsql); - $stmt->execute($params); - $num_rows = $stmt->rowCount(); - $stmt->closeCursor(); - - if ($num_rows == 1) - { - if ($add->sel == '0') - { - unset($push_datas[$token]['usrs'][$usr_id]); - $result[$usr_id] = 0; - } - if ($add->sel == '1') - { - $hd_value = '0'; - if ($add->hd == '1') - $hd_value = '1'; - $push_datas[$token]['usrs'][$usr_id] = array('HD' => $hd_value); - $result[$usr_id] = 1; - } - } - } - $session->storage()->set('push', $push_datas); - $ret = array('result' => $result, 'selected' => count($push_datas[$token]['usrs'])); - } - - return p4string::jsonencode($ret); -} - -function sqlFromFilters($usr, $filters) -{ - $conn = connection::getPDOConnection(); - - $params = array(); - $baslist = array(); - - $sql = 'SELECT DISTINCT(b.base_id) FROM (bas b, basusr u)' . - ' WHERE u.usr_id = :usr_id' . - ' AND b.base_id =u.base_id' . - ' AND u.canpush="1"' . - ' AND u.actif="1"' . - ' AND b.active="1"'; - - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $baslist[] = $row['base_id']; - } - $baslist = implode(',', $baslist); - $precise = ''; - - $filters = $filters != '' ? json_decode(urldecode($filters)) : false; - if ($filters) - { - foreach ($filters->strings as $filter) - { - if (trim($filter->fieldsearch) == '') - continue; - $like = ' LIKE '; - - switch ($filter->operator) - { - case 'and': - $precise .= ' AND '; - break; - case 'or': - $precise .= ' OR '; - break; - case 'except': - $precise .= ' AND '; - $like = ' NOT LIKE '; - break; - } - switch ($filter->fieldlike) - { - case 'BEGIN': - $start = ''; - $end = '%'; - break; - case 'CONT': - $start = '%'; - $end = '%'; - break; - case 'END': - $start = '%'; - $end = ''; - break; - } - switch ($filter->field) - { - case "LOGIN" : - $precise.=" (usr_login " . $like . " :like1 COLLATE utf8_general_ci )"; - $params[':like1'] = $start . $filter->fieldsearch . $end; - break; - case "NAME" : - $precise.=" (usr_nom " . $like . " :like2 OR usr_prenom like :like2bis)"; - $params[':like2'] = $start . $filter->fieldsearch . $end; - $params[':like2bis'] = $start . $filter->fieldsearch . $end; - break; - case "COMPANY" : - $precise.=" (usr.societe " . $like . " :like3)"; - $params[':like3'] = $start . $filter->fieldsearch . $end; - break; - case "MAIL" : - $precise.=" (usr.usr_mail " . $like . " :like4)"; - $params[':like4'] = $start . $filter->fieldsearch . $end; - break; - case "FCT" : - $precise.=" (usr.fonction " . $like . " :like5)"; - $params[':like5'] = $start . $filter->fieldsearch . $end; - break; - case "ACT" : - $precise.=" (usr.activite " . $like . " :like6)"; - $params[':like6'] = $start . $filter->fieldsearch . $end; - break; - case "LASTMODEL" : - $precise.=" (usr.lastModel " . $like . " :like7)"; - $params[':like7'] = $start . $filter->fieldsearch . $end; - break; - } - } - if (count($filters->lists) > 0 && trim($filters->lists[0]) != '') - { - $precise.=' AND usr.usr_id IN - (SELECT ulu.usr_id FROM usrlistusers ulu, usrlist ul - WHERE ul.usr_id = :usr_id_list - AND ul.list_id IN (' . implode(',', $filters->lists) . ') - AND ul.list_id = ulu.list_id) '; - $params[':usr_id_list'] = $usr; - } - if (count($filters->countries) > 0 && trim($filters->countries[0]) != '') - { - $c = array(); - $n = 0; - foreach ($filters->countries as $country) - { - $c['country' . $n] = $country; - $n++; - } - $precise.=" AND usr.pays IN (:" . implode(", :", array_keys($c)) . ")"; - $params = array_merge($params, $c); - } - if (count($filters->activite) > 0 && trim($filters->activite[0]) != '') - { - $c = array(); - $n = 0; - foreach ($filters->activite as $activite) - { - $c['activite' . $n] = $activite; - $n++; - } - $precise.=" AND usr.activite IN (:" . implode(", :", array_keys($c)) . ")"; - $params = array_merge($params, $c); - } - if (count($filters->fonction) > 0 && trim($filters->fonction[0]) != '') - { - $c = array(); - $n = 0; - foreach ($filters->fonction as $fonction) - { - $c['fonction' . $n] = $fonction; - $n++; - } - $precise.=" AND usr.fonction IN (:" . implode(", :", array_keys($c)) . ")"; - $params = array_merge($params, $c); - } - if (count($filters->societe) > 0 && trim($filters->societe[0]) != '') - { - $c = array(); - $n = 0; - foreach ($filters->societe as $societe) - { - $c['societe' . $n] = $societe; - $n++; - } - $precise.=" AND usr.societe IN (:" . implode(", :", array_keys($c)) . ")"; - $params = array_merge($params, $c); - } - if (count($filters->template) > 0 && trim($filters->template[0]) != '') - { - $c = array(); - $n = 0; - foreach ($filters->template as $template) - { - $c['template' . $n] = $template; - $n++; - } - $precise.=" AND usr.lastModel IN (:" . implode(", :", array_keys($c)) . ")"; - $params = array_merge($params, $c); - } - } - $sqlGhost = ''; - if (count(whatCanIAdmin($usr)) > 0) - $sqlGhost = ' OR (isnull(b.base_id)) '; - - $sql = 'SELECT DISTINCT usr.usr_id,usr_login, usr_mail - ,CONCAT_WS(" ",usr_nom,usr_prenom) as usr_nomprenom,societe, - fonction,activite,pays,lastModel - FROM usr - LEFT JOIN basusr b ON b.usr_id=usr.usr_id - WHERE (b.base_id IN (' . $baslist . ') ' . $sqlGhost . ' ) - AND usr_login not like "(#deleted_%" - AND usr.model_of=0 ' . $precise . ' AND invite="0" - AND usr_login!="invite" AND usr_login!="autoregister"'; - - return array('sql' => $sql, 'params' => $params); -} - -function hd_user($usr, $token, $usrs, $value) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - - $push_datas = $session->storage()->get('push', array()); - if (isset($push_datas[$token])) - { - foreach ($usrs as $u) - { - if (isset($push_datas[$token]['usrs'][$u])) - { - $push_datas[$token]['usrs'][$u]['HD'] = $value; - } - } - $session->storage()->set('push', $push_datas); - } -} - -function whoCanIPush($usr, $lng, $token, $view, $filters, $page=1, $sort='LA', $perPage='') -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $ctry = getCountries($lng); - - $conn = $appbox->get_connection(); - - $out = ''; - - if ($view == 'current') - $filters = ''; - $datas = sqlFromFilters($usr, $filters); - $sql = $datas['sql']; - $params = $datas['params']; - - $push_datas = $session->storage()->get('push', array()); - if ($view == 'search' && count($push_datas[$token]['usrs'])) - { - $sql .= ' AND usr.usr_id NOT IN (' . implode(',', array_keys($push_datas[$token]['usrs'])) . ') '; - } - if ($view == 'current') - { - $sql .= ' AND usr.usr_id IN (' . implode(',', array_keys($push_datas[$token]['usrs'])) . ') '; - } - - - $nPage = $nresult = 0; - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $nresult = $stmt->rowCount(); - $stmt->closeCursor(); - - $nPage = ceil($nresult / $perPage); - - if ($page > $nPage) - $page = $nPage; - - if (!isset($push_datas[$token])) - - return; - - $orderBy = array(); - - $sort = $sort != '' ? json_decode(urldecode($sort)) : array(); - $lact = $lsort = $nact = $nsort = $mact = $msort = $sact = $ssort = $jact = $jsort = $aact = $asort = $cact = $csort = $tact = $tsort = ''; - - - foreach ($sort as $s) - { - switch ($s) - { - case 'MA'; - $orderBy[] = 'usr_mail ASC'; - $mact = 'active'; - $msort = 'SortUp'; - break; - case 'MD'; - $orderBy[] = 'usr_mail DESC'; - $mact = 'active'; - $msort = 'SortDown'; - break; - case 'NA'; - $orderBy[] = 'usr_nomprenom ASC'; - $nact = 'active'; - $nsort = 'SortUp'; - break; - case 'ND'; - $orderBy[] = 'usr_nomprenom DESC'; - $nact = 'active'; - $nlsort = 'SortDown'; - break; - case 'LA'; - $orderBy[] = 'usr_login ASC'; - $lact = 'active'; - $lsort = 'SortUp'; - break; - case 'LD'; - $orderBy[] = 'usr_login DESC'; - $lact = 'active'; - $lsort = 'SortDown'; - break; - case 'SA'; - $orderBy[] = 'societe ASC'; - $sact = 'active'; - $ssort = 'SortUp'; - break; - case 'SD'; - $orderBy[] = 'societe DESC'; - $sact = 'active'; - $ssort = 'SortDown'; - break; - case 'JA'; - $orderBy[] = 'fonction ASC'; - $jact = 'active'; - $jsort = 'SortUp'; - break; - case 'JD'; - $orderBy[] = 'fonction DESC'; - $jact = 'active'; - $jsort = 'SortDown'; - break; - case 'AA'; - $orderBy[] = 'activite ASC'; - $aact = 'active'; - $asort = 'SortUp'; - break; - case 'AD'; - $orderBy[] = 'activite DESC'; - $aact = 'active'; - $asort = 'SortDown'; - break; - case 'CA'; - $orderBy[] = 'pays ASC'; - $cact = 'active'; - $csort = 'SortUp'; - break; - case 'CD'; - $orderBy[] = 'pays DESC'; - $cact = 'active'; - $csort = 'SortDown'; - break; - case 'TA'; - $orderBy[] = 'lastModel ASC'; - $tact = 'active'; - $tsort = 'SortUp'; - break; - case 'TD'; - $orderBy[] = 'lastModel DESC'; - $tact = 'active'; - $tsort = 'SortDown'; - break; - } - } - - if (count($orderBy) > 0) - $sql .= ' ORDER BY ' . implode(', ', $orderBy) . ''; - - - $start_offset = ($page - 1) >= 0 ? ($page - 1) : 0; - - - $sql .= ' LIMIT ' . ($start_offset * $perPage) . ', ' . $perPage . ''; - - $out .= '
- - - 0 ? ("onclick='specialsearch(false," . ($page - 1) . ")'") : "") . ' src="/skins/icons/prev.png"/> - - $nPage ? "" : "onclick='specialsearch(false," . ($page + 1) . ")'") . ' src="/skins/icons/next.png"/> - - -'; - $out .= '
'; - $out .= "
"; - - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - - - $out .= ""; - $out .= ""; - $out .= ""; - - - $out .= ""; - $ilig = 0; - - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - - $sel = $hd_checked = ''; - if (array_key_exists($row["usr_id"], $push_datas[$token]['usrs'])) - { - $sel = 'selected'; - if ($push_datas[$token]['usrs'][$row["usr_id"]]['HD'] == '1') - $hd_checked = 'checked'; - if ($view == 'search') - continue; - } - else - { - if ($view == 'current') - continue; - } - $out .= ""; - $out .= ""; - - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - - $pays = ""; - if (isset($ctry[trim($row["pays"])])) - $pays = $ctry[trim($row["pays"])]; - - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $ilig++; - } - - if ($ilig > 11) - { - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= ""; - } - $out .= ""; - $out .= "
" . sprintf(_('push:: %d resultats'), $nresult) . " - - " . _('push:: tous les ajouter') . " --- - " . sprintf(_("push:: %s selectionnes"), "" . count($push_datas[$token]['usrs']) . "") . " - - " . _('push:: enregistrer cette liste') . " / - " . _('push:: tout deselectionner') . " --- - " . _('push:: afficher :') . " -
" . _('admin::compte-utilisateur identifiant') . "" . _('admin::compte-utilisateur nom') . '/' . _('admin::compte-utilisateur prenom') . "" . _('admin::compte-utilisateur email') . "" . _('admin::compte-utilisateur societe') . "" . _('admin::compte-utilisateur poste') . "" . _('admin::compte-utilisateur activite') . "" . _('admin::compte-utilisateur pays') . "" . _('admin::compte-utilisateur dernier modele applique') . "
" . $row["usr_login"] . "" . $row["usr_nomprenom"] . "" . $row["usr_mail"] . "" . $row["societe"] . "" . $row["fonction"] . "" . $row["activite"] . "" . $pays . "" . $row["lastModel"] . "
" . _('admin::compte-utilisateur identifiant') . "" . _('admin::compte-utilisateur nom') . '/' . _('admin::compte-utilisateur prenom') . "" . _('admin::compte-utilisateur email') . "" . _('admin::compte-utilisateur societe') . "" . _('admin::compte-utilisateur poste') . "" . _('admin::compte-utilisateur activite') . "" . _('admin::compte-utilisateur pays') . "" . _('admin::compte-utilisateur dernier modele applique') . "
" . - ""; - - $out .= ""; - - return $out; -} - -function saveiList($usr, $lng, $name, $token, $filters) -{ - $registry = registry::get_instance(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $ret = -1; - - $conn = connection::getPDOConnection(); - - $ilists = new stdClass(); - - $sql = 'SELECT push_list FROM usr WHERE usr_id = :usr_id'; - - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row && $row['push_list'] != '') - { - $ilists = json_decode($row['push_list']); - } - - if (($filters = json_decode($filters)) !== false) - { - $label = $name; - $n = 2; - while (isset($ilists->$label)) - { - $label = $name . '#' . $n; - $n++; - } - $ilists->$label = $filters; - - $sql = 'UPDATE usr SET push_list = :ilists WHERE usr_id = :usr_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':ilists' => p4string::jsonencode($ilists), ':usr_id' => $usr)); - $stmt->closeCursor(); - $ret = loadILists($usr, $lng, $label); - } - - return $ret; -} - -function loadILists($usr, $lng, $name='') -{ - $conn = connection::getPDOConnection(); - - $lists = array(); - - $html = ''; - - $sql = 'SELECT push_list FROM usr WHERE usr_id = :usr_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - if ($ilists = json_decode($row['push_list'])) - { - foreach ($ilists as $k => $v) - { - $sel = ""; - if ($k == $name) - $sel = 'selected="selected"'; - $html .= ""; - } - } - } - - return $html; -} - -function loadIList($name) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $usr = $session->get_usr_id(); - - $conn = $appbox->get_connection(); - - $sql = 'SELECT push_list FROM usr WHERE usr_id = :usr_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - if ($ilists = json_decode($row['push_list'])) - { - if (isset($ilists->$name)) - $ret = $ilists->$name; - else - $ret = array( - 'strings' => array() - , 'countries' => array() - , 'fonction' => array() - , 'activite' => array() - , 'lists' => array() - , 'societe' => array() - , 'template' => array() - ); - } - } - - return p4string::jsonencode($ret); -} - -function saveList($usr, $lng, $name, $token) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $ret = '-1' . 'ses'; - - $conn = $appbox->get_connection(); - - $label = $name; - - $sql = 'SELECT label FROM usrlist WHERE usr_id = :usr_id AND label = :label'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr, ':label' => $label)); - $n = $stmt->rowCount(); - $stmt->closeCursor(); - - $m = 2; - while ($n > 0) - { - $label = $name . '#' . $m; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr, ':label' => $label)); - $n = $stmt->rowCount(); - $stmt->closeCursor(); - $m++; - } - - $ret = '-1'; - - $push_datas = $session->storage()->get('push', array()); - - if (isset($push_datas[$token]) && count($push_datas[$token]['usrs']) > 0) - { - $sql = 'INSERT into usrlist (list_id, usr_id, label) - VALUES (null, :usr_id, :label)'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr, ':label' => $label)); - $stmt->closeCursor(); - - $list_id = $conn->lastInsertId(); - - $sql = 'INSERT INTO usrlistusers (list_id, usr_id) - VALUES (:list_id,:usr_id)'; - $stmt = $conn->prepare($sql); - - foreach ($push_datas[$token]['usrs'] as $usr_id => $cool) - { - $stmt->execute(array(':list_id' => $list_id, ':usr_id' => $usr_id)); - } - - $stmt->closeCursor(); - $ret = loadLists($usr, $lng); - } - - return $ret; -} - -function loadLists($usr, $lng, $name='') -{ - $registry = registry::get_instance(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $conn = connection::getPDOConnection(); - - $lists = array(); - - $html = ''; - $sql = 'SELECT l.label, l.list_id, COUNT(u.usr_id) as nusr - FROM (usr s, usrlist l) - LEFT JOIN usrlistusers u - ON (l.list_id = u.list_id AND u.usr_id = s.usr_id) - WHERE l.usr_id = :usr_id AND s.usr_login NOT LIKE "(#deleted_%" - GROUP BY l.label ORDER BY l.label ASC'; - - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $sel = ""; - if ($name != '' && $row['label'] == $name) - $sel = "selected='selected'"; - - $html .= ""; - } - - return $html; -} - -function deleteList($usr, $lists, $lng) -{ - $registry = registry::get_instance(); - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); - - $conn = connection::getPDOConnection(); - $lists = json_decode($lists); - foreach ($lists as $list) - { - $sql = "DELETE FROM usrlist WHERE list_id = :list_id AND usr_id = :usr_id"; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':list_id' => $list, ':usr_id' => $usr)); - $stmt->closeCursor(); - - $sql = 'DELETE FROM usrlistusers WHERE list_id = :list_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':list_id' => $list)); - $stmt->closeCursor(); - } - - return loadLists($usr, $lng); - - return $html; -} - -function deleteiList($usr, $name, $lng) -{ - $conn = connection::getPDOConnection(); - - $sql = "SELECT push_list FROM usr WHERE usr_id = :usr_id"; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':usr_id' => $usr)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if ($row) - { - $lists = json_decode($row['push_list']); - if (isset($lists->$name)) - { - unset($lists->$name); - } - - $sql = 'UPDATE usr SET push_list = :lists WHERE usr_id = :usr_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':lists' => p4string::jsonencode($lists), ':usr_id' => $usr)); - $stmt->closeCursor(); - } - - $ret = loadiLists($usr, $lng); - - return $ret; -} - -function getUsrInfos($usr, $arrayUsrs) -{ - $conn = connection::getPDOConnection(); - - $usrs = array(); - - $sql = 'SELECT usr_id,usr_mail, usr_login, usr_password, usr_nom, usr_prenom - FROM usr WHERE usr_id IN (' . implode(',', $arrayUsrs) . ')'; - - $stmt = $conn->prepare($sql); - $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $usrs[$row['usr_id']] = $row; - } - - return $usrs; -} - -function pushIt($usr, $newBask, $parmLST, $users, $mail_content, $lng, $accuse) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - $finalUsers = array(); - - $conn = $appbox->get_connection(); - - $nbMail = 0; - $nbchu = 0; - $my_link = ""; - - $usrs = getUsrInfos($usr, array_merge(array_keys($users), array($usr))); - - $me = User_Adapter::getInstance($session->get_usr_id(), $appbox); - - $reading_confirm_to = false; - if ($accuse == '1') - { - $reading_confirm_to = $me->get_email(); - } - - foreach ($users as $oneuser => $rights) - { - $new_basket = null; - - try - { - $user = User_Adapter::getInstance($oneuser, $appbox); - $pusher = User_Adapter::getInstance($usr, $appbox); - - $new_basket = basket_adapter::create($appbox, $newBask, $user, '', $pusher); - $new_basket->set_unread(); - - $nbchu++; - - $new_basket->push_list($parmLST, false); - - $finalUsers[] = $user->get_id(); - - $canSendHD = sendHdOk($usr, $parmLST); - - foreach ($new_basket->get_elements() as $element) - { - $record = $element->get_record(); - if ($rights['canHD'] && in_array($record->get_base_id(), $canSendHD)) - $user->ACL()->grant_hd_on($record, $me, 'push'); - else - $user->ACL()->grant_preview_on($record, $me, 'push'); - } - - set_time_limit(60); - - $from = trim($me->get_email()) != "" ? $me->get_email() : false; - - - $url = $registry->get('GV_ServerName') . 'lightbox/index.php?LOG=' . random::getUrlToken('view', $user->get_id(), null, $new_basket->get_ssel_id()); - - if ($me->get_id() == $user->get_id()) - $my_link = $url; - - $name = User_Adapter::getInstance($user->get_id(), $appbox)->get_display_name(); - - $params = array( - 'from' => $session->get_usr_id() - , 'from_email' => $from - , 'to' => $user->get_id() - , 'to_email' => $user->get_email() - , 'to_name' => $name - , 'url' => $url - , 'accuse' => $reading_confirm_to - , 'message' => $mail_content - , 'ssel_id' => $new_basket->get_ssel_id() - ); - - - $evt_mngr = eventsmanager_broker::getInstance($appbox); - $evt_mngr->trigger('__PUSH_DATAS__', $params); - } - catch (Exception $e) - { - - } - } - - return array('nbchu' => $nbchu, 'mylink' => $my_link, 'users' => $finalUsers); -} - -function pushValidation($usr, $ssel_id, $listUsrs, $time, $mail_content, $accuse) -{ - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $registry = $appbox->get_registry(); - $finalUsers = array(); - - $my_link = ''; - - $me = User_Adapter::getInstance($session->get_usr_id(), $appbox); - - $reading_confirm_to = false; - if ($accuse == '1') - { - $reading_confirm_to = $me->get_email(); - } - - if ($time != 0) - { - $expires_obj = new DateTime('+' . (int) $time . ' day' . ((int) $time > 1 ? 's' : '')); - $expires = $expires_obj; - - if ($time > 1) - $mail_content .= '

' . sprintf(_('Vous avez %d jours pour confirmer votre validation'), $time) . '


'; - else - $mail_content .= '

' . _('Vous avez une journee pour confirmer votre validation') . '


'; - } - else - { - $expires = null; - } - - - - $basket = basket_adapter::getInstance($appbox, $ssel_id, $session->get_usr_id()); - $basket->set_unread(); - - foreach ($listUsrs as $oneuser => $rights) - { - $user = User_Adapter::getInstance($oneuser, appbox::get_instance()); - - if (!$user->get_id()) - continue; - - $from = trim($me->get_email()) != "" ? $me->get_email() : false; - - $message = $mail_content . "
\n
\n"; - - $url = $registry->get('GV_ServerName') . 'lightbox/index.php?LOG=' . random::getUrlToken('validate', $user->get_id(), $expires, $ssel_id); - - $name = $user->get_display_name(); - - $params = array( - 'from' => $session->get_usr_id() - , 'from_email' => $from - , 'to' => $user->get_id() - , 'to_email' => $user->get_email() - , 'to_name' => $name - , 'message' => $mail_content - , 'url' => $url - , 'ssel_id' => $ssel_id - , 'accuse' => $reading_confirm_to - ); - - $evt_mngr = eventsmanager_broker::getInstance($appbox); - $evt_mngr->trigger('__PUSH_VALIDATION__', $params); - - if ($me->get_id() == $user->get_id()) - $my_link = $url; - - if ($time != 0) - $message .= '
\n
\n' . sprintf(_('push:: %d jours restent pour finir cette validation'), (int) $time) . "
\n"; - - $basket->validation_to_users($user, $rights['canAgree'], $rights['canSeeOther'], $rights['canHD'], $expires); - $finalUsers[] = $oneuser; - } - - return array('mylink' => $my_link, 'users' => $finalUsers); -} - -?> diff --git a/lib/classes/eventsmanager/broker.class.php b/lib/classes/eventsmanager/broker.class.php index 2b15317d02..d4b6048266 100644 --- a/lib/classes/eventsmanager/broker.class.php +++ b/lib/classes/eventsmanager/broker.class.php @@ -12,22 +12,28 @@ class eventsmanager_broker * @var appbox */ protected $appbox; + /** + * + * @var \Alchemy\Phrasea\Core + */ + protected $core; - private function __construct(appbox &$appbox) + private function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core) { $this->appbox = $appbox; + $this->core = $core; return $this; } /** - * @return eventsmanager + * @return \eventsmanager_broker */ - public static function getInstance(appbox &$appbox) + public static function getInstance(appbox &$appbox, \Alchemy\Phrasea\Core $core) { if (!self::$_instance) { - self::$_instance = new self($appbox); + self::$_instance = new self($appbox, $core); } return self::$_instance; @@ -50,7 +56,7 @@ class eventsmanager_broker { continue; } - $this->pool_classes[$classname] = new $classname($this->appbox, $this->appbox->get_registry(), $this); + $this->pool_classes[$classname] = new $classname($this->appbox, $this->core, $this); foreach ($this->pool_classes[$classname]->get_events() as $event) $this->bind($event, $classname); @@ -67,17 +73,17 @@ class eventsmanager_broker { $iterators_pool = array(); - $root = dirname(__FILE__) . '/../../'; + $root = __DIR__ . '/../../'; if ($type == 'event') { - $iterators_pool['event'][] = new DirectoryIterator(dirname(__FILE__) . '/event/'); - if (file_exists(dirname(__FILE__) . '/event/')) - $iterators_pool['event'][] = new DirectoryIterator(dirname(__FILE__) . '/event/'); + $iterators_pool['event'][] = new DirectoryIterator(__DIR__ . '/event/'); + if (file_exists(__DIR__ . '/event/')) + $iterators_pool['event'][] = new DirectoryIterator(__DIR__ . '/event/'); } if ($type == 'notify') { - $iterators_pool['notify'][] = new DirectoryIterator(dirname(__FILE__) . '/notify/'); + $iterators_pool['notify'][] = new DirectoryIterator(__DIR__ . '/notify/'); } $ret = array(); @@ -100,7 +106,7 @@ class eventsmanager_broker { continue; } - $obj = new $classname($this->appbox, $this->appbox->get_registry(), $this); + $obj = new $classname($this->appbox, $this->core, $this); $ret[$classname] = $obj->get_name(); } @@ -164,7 +170,7 @@ class eventsmanager_broker function get_json_notifications($page=0) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $unread = 0; @@ -242,7 +248,7 @@ class eventsmanager_broker function get_unread_notifications_number() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $total = 0; @@ -265,7 +271,7 @@ class eventsmanager_broker function get_notifications() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $unread = 0; diff --git a/lib/classes/eventsmanager/eventAbstract.class.php b/lib/classes/eventsmanager/eventAbstract.class.php index 40373f8d44..343567774a 100644 --- a/lib/classes/eventsmanager/eventAbstract.class.php +++ b/lib/classes/eventsmanager/eventAbstract.class.php @@ -15,6 +15,11 @@ abstract class eventsmanager_eventAbstract * @var registryInterface */ protected $registry; + /** + * + * @var \Alchemy\Phrasea\Core + */ + protected $core; /** * * @var eventsmanager @@ -22,10 +27,11 @@ abstract class eventsmanager_eventAbstract protected $broker; - public function __construct(appbox &$appbox, registryInterface $registry, eventsmanager_broker &$broker) + public function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->appbox = $appbox; - $this->registry = $registry; + $this->registry = $core->getRegistry(); + $this->core = $core; $this->broker = $broker; return $this; diff --git a/lib/classes/eventsmanager/notify/autoregister.class.php b/lib/classes/eventsmanager/notify/autoregister.class.php index ee54a2de17..fb42f178b4 100644 --- a/lib/classes/eventsmanager/notify/autoregister.class.php +++ b/lib/classes/eventsmanager/notify/autoregister.class.php @@ -213,7 +213,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract function mail($to, $from, $datas) { $subject = sprintf(_('admin::register: Inscription automatique sur %s') - , GV_homeTitle); + , $this->registry->get('GV_homeTitle')); $body = "
" . _('admin::register: un utilisateur s\'est inscrit') . "
\n"; diff --git a/lib/classes/eventsmanager/notify/downloadmailfail.class.php b/lib/classes/eventsmanager/notify/downloadmailfail.class.php new file mode 100644 index 0000000000..4ca0204621 --- /dev/null +++ b/lib/classes/eventsmanager/notify/downloadmailfail.class.php @@ -0,0 +1,177 @@ + null + , 'lst' => '' + , 'ssttid' => '' + , 'dest' => '' + , 'reason' => '' + ); + + $params = array_merge($default, $params); + + $dom_xml = new DOMDocument('1.0', 'UTF-8'); + $dom_xml->preserveWhiteSpace = false; + $dom_xml->formatOutput = true; + + $root = $dom_xml->createElement('datas'); + + $lst = $dom_xml->createElement('lst'); + $ssttid = $dom_xml->createElement('ssttid'); + $dest = $dom_xml->createElement('dest'); + $reason = $dom_xml->createElement('reason'); + + $lst->appendChild($dom_xml->createTextNode($params['lst'])); + $ssttid->appendChild($dom_xml->createTextNode($params['ssttid'])); + $dest->appendChild($dom_xml->createTextNode($params['dest'])); + $reason->appendChild($dom_xml->createTextNode($params['reason'])); + + $root->appendChild($lst); + $root->appendChild($ssttid); + $root->appendChild($dest); + $root->appendChild($reason); + + $dom_xml->appendChild($root); + + $datas = $dom_xml->saveXml(); + + $mailed = false; + + $send_notif = ($this->get_prefs(__CLASS__, $params['usr_id']) != '0'); + + if ($send_notif) + { + $user = User_Adapter::getInstance($params['usr_id'], $this->appbox); + $name = $user->get_display_name(); + + $to = array('email' => $user->get_email(), 'name' => $name); + + $from = array( + 'email' => $this->registry->get('GV_defaulmailsenderaddr'), + 'name' => $this->registry->get('GV_homeTitle') + ); + + if (parent::email()) + $mailed = true; + } + + $this->broker->notify($params['usr_id'], __CLASS__, $datas, $mailed); + + return; + } + + /** + * + * @param Array $datas + * @param boolean $unread + * @return Array + */ + public function datas($datas, $unread) + { + $sx = simplexml_load_string($datas); + $usr_id = (int) $sx->usr_id; + $reason = (int) $sx->reason; + $lst = (string) $sx->lst; + $ssttid = (int) $sx->ssttid; + $dest = (string) $sx->dest; + + if ($reason == self::MAIL_NO_VALID) + { + $reason = _('email is not valid'); + } + elseif ($reason == self::MAIL_FAIL) + { + $reason = _('failed to send mail'); + } + else + { + $reason = _('an error occured while exporting records'); + } + + $text = sprintf( + _("The delivery to %s failed for the following reason : %s") + , $dest + , $reason + ); + + $ret = array( + 'text' => $text + , 'class' => '' + ); + + return $ret; + } + + /** + * + * @return string + */ + public function get_name() + { + return _('Email export fails'); + } + + /** + * + * @return string + */ + public function get_description() + { + return _('Get a notification when a mail export fails'); + } + + /** + * + * @return boolean + */ + function is_available() + { + return true; + } + +} diff --git a/lib/classes/eventsmanager/notify/feed.class.php b/lib/classes/eventsmanager/notify/feed.class.php new file mode 100644 index 0000000000..6cb94c51e7 --- /dev/null +++ b/lib/classes/eventsmanager/notify/feed.class.php @@ -0,0 +1,208 @@ + $entry->get_id() + ); + + $dom_xml = new DOMDocument('1.0', 'UTF-8'); + + $dom_xml->preserveWhiteSpace = false; + $dom_xml->formatOutput = true; + + $root = $dom_xml->createElement('datas'); + + $entry_id = $dom_xml->createElement('entry_id'); + + $entry_id->appendChild($dom_xml->createTextNode($params['entry_id'])); + + $root->appendChild($entry_id); + + $dom_xml->appendChild($root); + + $datas = $dom_xml->saveXml(); + + $Query = new \User_Query($this->appbox); + + $Query->include_phantoms(true)->include_invite(false)->include_templates(false); + + if ($entry->get_feed()->get_collection()) + { + $Query->on_base_ids(array($entry->get_feed()->get_collection()->get_base_id())); + } + + $start = 0; + $perLoop = 100; + + $from = array( + 'email' => $entry->get_author_email(), + 'name' => $entry->get_author_name() + ); + + do + { + $results = $Query->limit($start, $perLoop)->execute()->get_results(); + + foreach ($results as $user_to_notif) + { + /* @var $user_to_notif \User_Adapter */ + $mailed = false; + + $send_notif = ($this->get_prefs(__CLASS__, $user_to_notif->get_id()) != '0'); + if ($send_notif) + { + $email = array( + 'email' => $user_to_notif->get_email(), + 'name' => $user_to_notif->get_display_name() + ); + + $token = \random::getUrlToken( + \random::TYPE_FEED_ENTRY + , $user_to_notif->get_id() + , null + , $entry->get_id() + ); + + $url = $this->appbox->get_registry()->get('GV_ServerName') . 'lightbox/index.php?LOG=' . $token; + + if (self::mail($email, $from, $url, $entry)) + $mailed = true; + } + + $this->broker->notify($user_to_notif->get_id(), __CLASS__, $datas, $mailed); + } + $start += $perLoop; + } + while (count($results) > 0); + + return true; + } + + /** + * + * @param Array $datas + * @param boolean $unread + * @return Array + */ + public function datas($datas, $unread) + { + $sx = simplexml_load_string($datas); + + try + { + $entry = \Feed_Entry_Adapter::load_from_id($this->appbox, (int) $sx->entry_id); + } + catch (\Exception $e) + { + return array(); + } + + $ret = array( + 'text' => sprintf( + _('%1$s has published %2$s') + , $entry->get_author_name() + , '
' . $entry->get_title() . '' + ) + , 'class' => ($unread == 1 ? 'reload_baskets' : '') + ); + + return $ret; + } + + /** + * + * @return string + */ + public function get_name() + { + return _('Feeds'); + } + + /** + * + * @return string + */ + public function get_description() + { + return _('Recevoir des notifications lorsqu\'on me push quelque chose'); + } + + /** + * + * @return boolean + */ + function is_available() + { + return true; + } + + /** + * + * @param Array $to + * @param Array $from + * @param string $message + * @param string $url + * @param boolean $accuse + * @return boolean + */ + function mail($to, $from, $url, \Feed_Entry_Adapter $entry) + { + $subject = sprintf(_('Nouvelle publication : %s'), $entry->get_title()); + + $body = "
" + . sprintf('%s vient de publier %s', $entry->get_author_name(), $entry->get_title()) + . _('Connectez vous a l\'adresse suivante pour la consulter') + . "
\n"; + + $body .= '\n"; + + $body .= "
"; + + $body .= "
\n
\n
\n" + . _('push::atention: ce lien est unique et son contenu confidentiel, ne divulguez pas'); + + return mail::send_mail($subject, $body, $to, $from, array()); + } + +} diff --git a/lib/classes/eventsmanager/notify/order.class.php b/lib/classes/eventsmanager/notify/order.class.php index afc362e07f..4e5253b288 100644 --- a/lib/classes/eventsmanager/notify/order.class.php +++ b/lib/classes/eventsmanager/notify/order.class.php @@ -254,8 +254,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract function is_available() { $bool = false; - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $session = $this->appbox->get_session(); if (!$session->is_authenticated()) return false; diff --git a/lib/classes/eventsmanager/notify/orderdeliver.class.php b/lib/classes/eventsmanager/notify/orderdeliver.class.php index b441f88e1f..529c13fd34 100644 --- a/lib/classes/eventsmanager/notify/orderdeliver.class.php +++ b/lib/classes/eventsmanager/notify/orderdeliver.class.php @@ -28,10 +28,10 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract * * @return notify_orderdeliver */ - function __construct(appbox &$appbox, registryInterface &$registry, eventsmanager_broker &$broker) + function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->group = _('Commande'); - parent::__construct($appbox, $registry, $broker); + parent::__construct($appbox, $core, $broker); return $this; } @@ -147,7 +147,10 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id, $this->appbox->get_session()->get_usr_id()); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findUserBasket($ssel_id, $this->core->getAuthenticatedUser(), false); } catch (Exception $e) { @@ -159,7 +162,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract $sender, $n, '' - . $basket->get_name() . '' + . $basket->getName() . '' ) , 'class' => '' ); @@ -196,7 +199,14 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract { try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id, $this->appbox->get_session()->get_usr_id()); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findOneBy(array( + 'id' => $ssel_id + , 'pusher_id' => $this->core->getAuthenticatedUser()->get_id() + ) + ); } catch (Exception $e) { @@ -204,7 +214,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract } $subject = sprintf( _('push::mail:: Reception de votre commande %s'), - $basket->get_name() + $basket->getName() ); $body = "
" diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.class.php b/lib/classes/eventsmanager/notify/ordernotdelivered.class.php index 537d32ecdb..a1e737983e 100644 --- a/lib/classes/eventsmanager/notify/ordernotdelivered.class.php +++ b/lib/classes/eventsmanager/notify/ordernotdelivered.class.php @@ -24,10 +24,10 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac */ public $events = array('__ORDER_NOT_DELIVERED__'); - function __construct(appbox &$appbox, registryInterface &$registry, eventsmanager_broker &$broker) + function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->group = _('Commande'); - parent::__construct($appbox, $registry, $broker); + parent::__construct($appbox, $core, $broker); return $this; } diff --git a/lib/classes/eventsmanager/notify/push.class.php b/lib/classes/eventsmanager/notify/push.class.php index a999072086..533e767005 100644 --- a/lib/classes/eventsmanager/notify/push.class.php +++ b/lib/classes/eventsmanager/notify/push.class.php @@ -30,7 +30,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract */ public function icon_url() { - return '/skins/prod/000000/images/pushdoc_history.gif'; + return '/skins/icons/push16.png'; } /** diff --git a/lib/classes/eventsmanager/notify/register.class.php b/lib/classes/eventsmanager/notify/register.class.php index 4a0b6844fe..a92e9dd502 100644 --- a/lib/classes/eventsmanager/notify/register.class.php +++ b/lib/classes/eventsmanager/notify/register.class.php @@ -289,8 +289,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract { $bool = false; - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $session = $this->appbox->get_session(); if (!$session->is_authenticated() || !login::register_enabled()) return false; diff --git a/lib/classes/eventsmanager/notify/validate.class.php b/lib/classes/eventsmanager/notify/validate.class.php index 2de351364e..550086d281 100644 --- a/lib/classes/eventsmanager/notify/validate.class.php +++ b/lib/classes/eventsmanager/notify/validate.class.php @@ -28,10 +28,10 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract * * @return notify_validate */ - function __construct(appbox &$appbox, registryInterface &$registry, eventsmanager_broker &$broker) + function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->group = _('Validation'); - parent::__construct($appbox, $registry, $broker); + parent::__construct($appbox, $core, $broker); return $this; } @@ -42,7 +42,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract */ public function icon_url() { - return '/skins/prod/000000/images/pushdoc_history.gif'; + return '/skins/icons/push16.png'; } /** @@ -140,9 +140,12 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id,$this->appbox->get_session()->get_usr_id()); - $basket_name = (trim($basket->get_name()) != '' ? - $basket->get_name() : _('Une selection')); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findUserBasket($ssel_id, $this->core->getAuthenticatedUser(), false); + + $basket_name = trim($basket->getName()) ?: _('Une selection'); } catch (Exception $e) { diff --git a/lib/classes/eventsmanager/notify/validationdone.class.php b/lib/classes/eventsmanager/notify/validationdone.class.php index adda77f692..2d10376233 100644 --- a/lib/classes/eventsmanager/notify/validationdone.class.php +++ b/lib/classes/eventsmanager/notify/validationdone.class.php @@ -28,10 +28,10 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract * * @return notify_validationdone */ - function __construct(appbox &$appbox, registryInterface &$registry, eventsmanager_broker &$broker) + function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->group = _('Validation'); - parent::__construct($appbox, $registry, $broker); + parent::__construct($appbox, $core, $broker); return $this; } @@ -42,7 +42,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract */ public function icon_url() { - return '/skins/prod/000000/images/pushdoc_history.gif'; + return '/skins/icons/push16.png'; } /** @@ -139,11 +139,14 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract return array(); } - $sender = User_Adapter::getInstance($from, $this->appbox)->get_display_name(); + $sender = $registered_user->get_display_name(); try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id,$this->appbox->get_session()->get_usr_id()); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findUserBasket($ssel_id, $this->core->getAuthenticatedUser(), false); } catch (Exception $e) { @@ -156,7 +159,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract $sender, '' - . $basket->get_name() . '' + . $basket->getName() . '' ) , 'class' => '' ); @@ -193,7 +196,10 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract { try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id,$this->appbox->get_session()->get_usr_id()); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findUserBasket($ssel_id, $this->core->getAuthenticatedUser(), false); } catch (Exception $e) { @@ -203,7 +209,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract $subject = sprintf( _('push::mail:: Rapport de validation de %1$s pour %2$s'), $from['name'], - $basket->get_name() + $basket->getName() ); $body = "
" . sprintf( @@ -224,8 +230,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract { $bool = false; - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $session = $this->appbox->get_session(); if (!$session->is_authenticated()) return false; diff --git a/lib/classes/eventsmanager/notify/validationreminder.class.php b/lib/classes/eventsmanager/notify/validationreminder.class.php index 934b87eccc..13622a8500 100644 --- a/lib/classes/eventsmanager/notify/validationreminder.class.php +++ b/lib/classes/eventsmanager/notify/validationreminder.class.php @@ -28,10 +28,10 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra * * @return notify_validationreminder */ - function __construct(appbox &$appbox, registryInterface &$registry, eventsmanager_broker &$broker) + function __construct(appbox &$appbox, \Alchemy\Phrasea\Core $core, eventsmanager_broker &$broker) { $this->group = _('Validation'); - parent::__construct($appbox, $registry, $broker); + parent::__construct($appbox, $core, $broker); return $this; } @@ -42,7 +42,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra */ public function icon_url() { - return '/skins/prod/000000/images/pushdoc_history.gif'; + return '/skins/icons/push16.png'; } /** @@ -156,9 +156,12 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra try { - $basket = basket_adapter::getInstance($this->appbox, $ssel_id, $this->appbox->get_session()->get_usr_id()); - $basket_name = (trim($basket->get_name()) != '' ? - $basket->get_name() : _('Une selection')); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + $basket = $repository->findUserBasket($ssel_id, $this->core->getAuthenticatedUser(), false); + + $basket_name = trim($basket->getName()) ? : _('Une selection'); } catch (Exception $e) { diff --git a/lib/classes/eventsmanager/notifyAbstract.class.php b/lib/classes/eventsmanager/notifyAbstract.class.php index 8ab041a712..88bf6c0336 100644 --- a/lib/classes/eventsmanager/notifyAbstract.class.php +++ b/lib/classes/eventsmanager/notifyAbstract.class.php @@ -26,7 +26,7 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract protected function get_prefs($class, $usr_id) { - $user = User_Adapter::getInstance($usr_id, appbox::get_instance()); + $user = User_Adapter::getInstance($usr_id, appbox::get_instance(\bootstrap::getCore())); return $user->getPrefs('notification_' . $class); } diff --git a/lib/classes/gatekeeper.class.php b/lib/classes/gatekeeper.class.php index 240310e931..eb997d6836 100644 --- a/lib/classes/gatekeeper.class.php +++ b/lib/classes/gatekeeper.class.php @@ -41,15 +41,16 @@ class gatekeeper * @var gatekeeper */ protected static $_instance; + protected $Core; /** * * @return gatekeeper */ - public static function getInstance() + public static function getInstance(\Alchemy\Phrasea\Core $Core) { if (!(self::$_instance instanceof self)) - self::$_instance = new self(); + self::$_instance = new self($Core); return self::$_instance; } @@ -58,8 +59,10 @@ class gatekeeper * * @return gatekeeper */ - function __construct() + function __construct(\Alchemy\Phrasea\Core $Core) { + $this->Core = $Core; + return $this; } @@ -71,8 +74,8 @@ class gatekeeper */ function check_directory() { - $request = http_request::getInstance(); - $appbox = appbox::get_instance(); + $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); + $appbox = appbox::get_instance($this->Core); $session = $appbox->get_session(); if (http_request::is_command_line()) @@ -100,7 +103,7 @@ class gatekeeper try { $cookie = Session_Handler::get_cookie('persistent'); - $auth = new Session_Authentication_PersistentCookie($appbox, $cookie); + $auth = new Session_Authentication_PersistentCookie($appbox, $cookie); $session->restore($auth->get_user(), $auth->get_ses_id()); } catch (Exception $e) @@ -116,12 +119,19 @@ class gatekeeper case 'prod': case 'client': $this->give_guest_access(); - phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); + if ($request->isXmlHttpRequest()) + { + phrasea::headers(404); + } + else + { + phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); + } break; case 'thesaurus2': if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php' - || $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php' - || $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') + || $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php' + || $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') return; phrasea::redirect('/login/?redirect=/thesaurus2'); @@ -230,7 +240,7 @@ class gatekeeper */ protected function give_guest_access() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance($this->Core); $request = http_request::getInstance(); $session = $appbox->get_session(); @@ -246,10 +256,10 @@ class gatekeeper catch (Exception $e) { $url = '/login/?redirect=' . $parm['redirect'] - . '&error=' . urlencode($e->getMessage()); + . '&error=' . urlencode($e->getMessage()); phrasea::redirect($url); } - phrasea::redirect('/' . $this->_directory . '/index.php'); + phrasea::redirect('/' . $this->_directory . '/'); } return $this; @@ -262,10 +272,10 @@ class gatekeeper */ protected function token_access() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance($this->Core); $request = new http_request(); $session = $appbox->get_session(); - $parm = $request->get_parms('LOG'); + $parm = $request->get_parms('LOG'); if (is_null($parm["LOG"])) @@ -287,7 +297,19 @@ class gatekeeper { $datas = random::helloToken($parm['LOG']); - return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/"); + switch ($datas['type']) + { + default: + return $this; + break; + case \random::TYPE_FEED_ENTRY: + return phrasea::redirect("/lightbox/feeds/entry/" . $datas['datas'] . "/"); + break; + case \random::TYPE_VALIDATE: + case \random::TYPE_VIEW: + return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/"); + break; + } } catch (Exception_NotFound $e) { @@ -305,7 +327,7 @@ class gatekeeper */ public function require_session() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance($this->Core); $session = $appbox->get_session(); if ($session->is_authenticated()) { diff --git a/lib/classes/geonames.class.php b/lib/classes/geonames.class.php index 4d4859eba7..bd3d494677 100644 --- a/lib/classes/geonames.class.php +++ b/lib/classes/geonames.class.php @@ -3,12 +3,18 @@ class geonames { + protected static $NamesFromId = array(); + protected static $CountryFromId = array(); + protected static $CountryCodeFromId = array(); + protected static $GeonameFromIp = array(); + protected static $Searches = array(); + public function name_from_id($geonameid) { $registry = registry::get_instance(); - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') - . 'get_name.php?geonameid=' - . $geonameid; + $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + . 'get_name.php?geonameid=' + . $geonameid; $ret = ''; @@ -35,9 +41,9 @@ class geonames } $registry = registry::get_instance(); - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') - . 'get_name.php?geonameid=' - . $geonameid; + $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + . 'get_name.php?geonameid=' + . $geonameid; $ret = ''; $xml = http_query::getUrl($url); @@ -57,9 +63,9 @@ class geonames public function get_country_code($geonameid) { $registry = registry::get_instance(); - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') - . 'get_name.php?geonameid=' - . $geonameid; + $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + . 'get_name.php?geonameid=' + . $geonameid; $ret = ''; @@ -85,7 +91,7 @@ class geonames protected static function highlight($title, $length) { return '' . mb_substr($title, 0, $length) . '' - . mb_substr($title, $length); + . mb_substr($title, $length); } public function find_city($cityName) @@ -98,9 +104,9 @@ class geonames return $output; $registry = registry::get_instance(); - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') - . 'find_city.php?city=' - . urlencode($cityName) . '&maxResult=30'; + $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + . 'find_city.php?city=' + . urlencode($cityName) . '&maxResult=30'; $sxe = simplexml_load_string(http_query::getUrl($url)); @@ -113,17 +119,17 @@ class geonames $country_highlight = (string) $geoname->country; if (trim($geoname->country_match) !== '') { - $length = mb_strlen($geoname->country_match); + $length = mb_strlen($geoname->country_match); $country_highlight = self::highlight($geoname->country, $length); } $output[] = array( - 'title_highlighted' => $title_highlight - , 'title' => (string) $geoname->title - , 'country_highlighted' => $country_highlight - , 'country' => (string) $geoname->country - , 'geoname_id' => (int) $geoname->geonameid - , 'region' => (string) $geoname->region + 'title_highlighted' => $title_highlight + , 'title' => (string) $geoname->title + , 'country_highlighted' => $country_highlight + , 'country' => (string) $geoname->country + , 'geoname_id' => (int) $geoname->geonameid + , 'region' => (string) $geoname->region ); } @@ -139,18 +145,18 @@ class geonames return $this->cache_ips[$ip]; $output = array( - 'city' => '', - 'country_code' => '', - 'country' => '', - 'fips' => '', - 'longitude' => '', - 'latitude' => '' + 'city' => '', + 'country_code' => '', + 'country' => '', + 'fips' => '', + 'longitude' => '', + 'latitude' => '' ); $registry = registry::get_instance(); - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') - . 'geoip.php?ip=' - . urlencode($ip); + $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + . 'geoip.php?ip=' + . urlencode($ip); $xml = http_query::getUrl($url); if ($xml) @@ -158,12 +164,12 @@ class geonames $sxe = simplexml_load_string($xml); if ($sxe && $sxe->geoname) { - $output['city'] = (string) $sxe->geoname->city; + $output['city'] = (string) $sxe->geoname->city; $output['country_code'] = (string) $sxe->geoname->country_code; - $output['country'] = (string) $sxe->geoname->country; - $output['fips'] = (string) $sxe->geoname->fips; - $output['longitude'] = (string) $sxe->geoname->longitude; - $output['latitude'] = (string) $sxe->geoname->latitude; + $output['country'] = (string) $sxe->geoname->country; + $output['fips'] = (string) $sxe->geoname->fips; + $output['longitude'] = (string) $sxe->geoname->longitude; + $output['latitude'] = (string) $sxe->geoname->latitude; } } $this->cache_ips[$ip] = $output; diff --git a/lib/classes/http/query.class.php b/lib/classes/http/query.class.php index 9e10148024..86f6a8a9e1 100644 --- a/lib/classes/http/query.class.php +++ b/lib/classes/http/query.class.php @@ -25,26 +25,41 @@ class http_query */ public static function getHttpCodeFromUrl($url) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_MAXREDIRS, 10); - curl_setopt($ch, CURLOPT_NOBODY, true); - curl_setopt($ch, CURLOPT_HEADER, true); + if (!is_scalar($url)) - curl_exec($ch); - $result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); + return null; - curl_close($ch); + if (trim($url) === '') - return $result; + return null; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_MAXREDIRS, 10); + curl_setopt($ch, CURLOPT_NOBODY, true); + curl_setopt($ch, CURLOPT_HEADER, true); + + curl_exec($ch); + $result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); + + curl_close($ch); + + return $result; } public static function getHttpHeaders($url) { + if (!is_scalar($url)) + + return null; + + if (trim($url) === '') + + return null; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); @@ -69,24 +84,32 @@ class http_query * @param array $post_data * @return string */ - public static function getUrl($url, $post_data=false) + public static function getUrl($url, $post_data = false) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); - curl_setopt($ch, CURLOPT_FAILONERROR, 1); + if (!is_scalar($url)) - if ($post_data) - { - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - } + return null; - $result = (curl_exec($ch)); - curl_close($ch); + if (trim($url) === '') + + return null; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); + curl_setopt($ch, CURLOPT_FAILONERROR, 1); + + if ($post_data) + { + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + } + + $result = (curl_exec($ch)); + curl_close($ch); return $result; } diff --git a/lib/classes/lazaret.class.php b/lib/classes/lazaret.class.php index ac278f38cf..c5b1accb97 100644 --- a/lib/classes/lazaret.class.php +++ b/lib/classes/lazaret.class.php @@ -25,7 +25,7 @@ class lazaret extends set_abstract */ function __construct() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); $conn = $appbox->get_connection(); diff --git a/lib/classes/lazaretFile.class.php b/lib/classes/lazaretFile.class.php index 6df683398c..f2b1f36cb4 100644 --- a/lib/classes/lazaretFile.class.php +++ b/lib/classes/lazaretFile.class.php @@ -147,7 +147,7 @@ class lazaretFile public static function move_uploaded_to_lazaret( system_file $system_file, $base_id, $filename, $errors='', $status=false) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); $conn = $appbox->get_connection(); diff --git a/lib/classes/liste.class.php b/lib/classes/liste.class.php index 284ba47d76..bdcc2459c9 100644 --- a/lib/classes/liste.class.php +++ b/lib/classes/liste.class.php @@ -5,7 +5,7 @@ class liste public static function filter($lst) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); if (!is_array($lst)) diff --git a/lib/classes/login.class.php b/lib/classes/login.class.php index fe81eceb27..93b0444d80 100644 --- a/lib/classes/login.class.php +++ b/lib/classes/login.class.php @@ -29,33 +29,6 @@ class login return false; } - public function get_language_selector(registryInterface $registry) - { - $lngSelect = ''; - - return $lngSelect; - } - - public function get_password_link() - { -// $findpwd = ''; -// if(GV_find_password ) -// { - $findpwd = '' . _('login:: Forgot your password') . ''; -// } - return $findpwd; - } - public function get_register_link() { $demandLinkBox = ''; @@ -74,7 +47,7 @@ class login if (phrasea::guest_allowed()) { - $inviteBox = '' . _('login:: guest Access') . ''; + $inviteBox = '' . _('login:: guest Access') . ''; } return $inviteBox; diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php index ac1137ac7f..631a60a8bc 100644 --- a/lib/classes/mail.class.php +++ b/lib/classes/mail.class.php @@ -127,7 +127,7 @@ class mail { $registry = registry::get_instance(); $date = new DateTime('1 day'); - $token = random::getUrlToken('email', $usr_id, $date, $email); + $token = random::getUrlToken(\random::TYPE_EMAIL, $usr_id, $date, $email); $url = $registry->get('GV_ServerName') . 'login/reset-email.php?token=' . $token; @@ -143,6 +143,8 @@ class mail public static function mail_confirm_registered($email) { + $registry = \registry::get_instance(); + $subject = _('login::register: sujet email : confirmation de votre adresse email'); $body = "
" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n"; @@ -172,7 +174,7 @@ class mail { $registry = registry::get_instance(); $expire = new DateTime('+3 days'); - $token = random::getUrlToken('password', $usr_id, $expire, $email); + $token = random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $expire, $email); $subject = _('login::register: sujet email : confirmation de votre adresse email'); @@ -206,12 +208,15 @@ class mail $body = eregi_replace("[\]", '', $body); - $body .= "
\n"._('Si le lien n\'est pas cliquable, copiez-collez le dans votre navigateur.')."
\n"; $body .= "



\n\n\n\n"; + $body .= '
'._('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.').'
'; + $body .= "
\n"; $body .= '
' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "
\n"; $body .= '\n"; $body = '' . $body . ''; + $body = str_replace('https://', 'http://', $body); + try { $mail->CharSet = 'utf-8'; @@ -256,7 +261,7 @@ class mail $mail->ConfirmReadingTo = $reading_confirm_to; } - $mail->MsgHTML(strip_tags($body, '

  • ')); + $mail->MsgHTML(strip_tags($body, '


    • ')); foreach ($files as $f) { diff --git a/lib/classes/module/Admin.php b/lib/classes/module/Admin.php deleted file mode 100644 index 8e960d684f..0000000000 --- a/lib/classes/module/Admin.php +++ /dev/null @@ -1,37 +0,0 @@ -mount('/publications', new Controller_Admin_Publications()); - $app->mount('/users', new Controller_Admin_Users()); - $app->mount('/fields', new Controller_Admin_Fields()); - $app->mount('/tests/connection', new Controller_Utils_ConnectionTest()); - $app->mount('/tests/pathurl', new Controller_Utils_PathFileTest()); - - $app->error(function(\Exception $e) - { - return $e->getMessage(); - }); - - return $app; - }); diff --git a/lib/classes/module/Lightbox.php b/lib/classes/module/Lightbox.php deleted file mode 100644 index 8d90286f57..0000000000 --- a/lib/classes/module/Lightbox.php +++ /dev/null @@ -1,457 +0,0 @@ -get_session(); - - $app = new Silex\Application(); - - $app->get('/', function () use ($session, $appbox) - { - User_Adapter::updateClientInfos((6)); - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - $browser = Browser::getInstance(); - - $template = 'lightbox/index.twig'; - if (!$browser->isNewGeneration() && !$browser->isMobile()) - $template = 'lightbox/IE6/index.twig'; - - $output = $twig->render($template, array( - 'baskets_collection' => $basket_collection, - 'module_name' => 'Lightbox', - 'module' => 'lightbox' - ) - ); - $response = new Response($output); - $response->setCharset('UTF-8'); - - return $response; - } - ); - - $app->get('/ajax/NOTE_FORM/{sselcont_id}/', function($sselcont_id) use ($session, $appbox) - { - $browser = Browser::getInstance(); - if (!$browser->isMobile()) - - return new Response(''); - - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - $basket_element = basket_element_adapter::getInstance($sselcont_id); - $template = '/lightbox/note_form.twig'; - $output = $twig->render($template, array('basket_element' => $basket_element, 'module_name' => '')); - - return new Response($output); - } - )->assert('sselcont_id', '\d+'); - - $app->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function($sselcont_id) - { - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br', 'formatoctet' => 'p4string::format_octets')); - - $browser = Browser::getInstance(); - - if ($browser->isMobile()) - { - $basket_element = basket_element_adapter::getInstance($sselcont_id); - - $output = $twig->render('lightbox/basket_element.twig', array( - 'basket_element' => $basket_element, - 'module_name' => $basket_element->get_record()->get_title() - ) - ); - - return new Response($output); - } - else - { - $template_options = 'lightbox/sc_options_box.twig'; - $template_agreement = 'lightbox/agreement_box.twig'; - $template_selector = 'lightbox/selector_box.twig'; - $template_note = 'lightbox/sc_note.twig'; - $template_preview = 'common/preview.html'; - $template_caption = 'common/caption.html'; - - if (!$browser->isNewGeneration()) - { - $template_options = 'lightbox/IE6/sc_options_box.twig'; - $template_agreement = 'lightbox/IE6/agreement_box.twig'; - } - $appbox = appbox::get_instance(); - $usr_id = $appbox->get_session()->get_usr_id(); - - $basket_element = basket_element_adapter::getInstance($sselcont_id); - $basket = basket_adapter::getInstance($appbox, $basket_element->get_ssel_id(), $usr_id); - - $ret = array(); - $ret['number'] = $basket_element->get_record()->get_number(); - $ret['title'] = $basket_element->get_record()->get_title(); - - $ret['preview'] = $twig->render($template_preview, array('record' => $basket_element->get_record(), 'not_wrapped' => true)); - $ret['options_html'] = $twig->render($template_options, array('basket_element' => $basket_element)); - $ret['agreement_html'] = $twig->render($template_agreement, array('basket' => $basket, 'basket_element' => $basket_element)); - $ret['selector_html'] = $twig->render($template_selector, array('basket_element' => $basket_element)); - $ret['note_html'] = $twig->render($template_note, array('basket_element' => $basket_element)); - $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $basket_element->get_record())); - $output = p4string::jsonencode($ret); - - return new Response($output, 200, array('Content-Type' => 'application/json')); - } - } - )->assert('sselcont_id', '\d+'); - - - - - $app->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function($entry_id, $item_id) - { - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br', 'formatoctet' => 'p4string::format_octets')); - - $appbox = appbox::get_instance(); - $entry = Feed_Entry_Adapter::load_from_id($appbox, $entry_id); - $item = new Feed_Entry_Item($appbox, $entry, $item_id); - - $browser = Browser::getInstance(); - - if ($browser->isMobile()) - { - $output = $twig->render('lightbox/feed_element.twig', array( - 'feed_element' => $item, - 'module_name' => $item->get_record()->get_title() - ) - ); - - return new Response($output); - } - else - { - $template_options = 'lightbox/sc_options_box.twig'; - $template_preview = 'common/preview.html'; - $template_caption = 'common/caption.html'; - - if (!$browser->isNewGeneration()) - { - $template_options = 'lightbox/IE6/sc_options_box.twig'; - } - $usr_id = $appbox->get_session()->get_usr_id(); - - $ret = array(); - $ret['number'] = $item->get_record()->get_number(); - $ret['title'] = $item->get_record()->get_title(); - - $ret['preview'] = $twig->render($template_preview, array('record' => $item->get_record(), 'not_wrapped' => true)); - $ret['options_html'] = $twig->render($template_options, array('basket_element' => $item)); - $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $item->get_record())); - - - $ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = ''; - - - $output = p4string::jsonencode($ret); - - return new Response($output, 200, array('Content-type' => 'application/json')); - } - } - )->assert('entry_id', '\d+')->assert('item_id', '\d+'); - - $app->get('/validate/{ssel_id}/', function ($ssel_id) use ($session, $appbox) - { - - User_Adapter::updateClientInfos((6)); - - $browser = Browser::getInstance(); - - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); - $basket = basket_adapter::getInstance($appbox, $ssel_id, $session->get_usr_id()); - - if ($basket->is_valid()) - { - if($basket->get_first_element() instanceof basket_element_adapter) - $basket->get_first_element()->load_users_infos(); - } - - $twig = new supertwig(); - - $twig->addFilter(array('nl2br' => 'nl2br')); - - $template = 'lightbox/validate.twig'; - - if (!$browser->isNewGeneration() && !$browser->isMobile()) - $template = 'lightbox/IE6/validate.twig'; - - $response = new Response($twig->render($template, array( - 'baskets_collection' => $basket_collection, - 'basket' => $basket, - 'local_title' => strip_tags($basket->get_name()), - 'module' => 'lightbox', - 'module_name' => _('admin::monitor: module validation') - ) - )); - $response->setCharset('UTF-8'); - - return $response; - } - )->assert('ssel_id', '\d+'); - - $app->get('/compare/{ssel_id}/', function ($ssel_id) use ($session, $appbox) - { - - User_Adapter::updateClientInfos((6)); - - $browser = Browser::getInstance(); - - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); - $basket = basket_adapter::getInstance($appbox, $ssel_id, $session->get_usr_id()); - - if ($basket->is_valid()) - { - $basket->get_first_element()->load_users_infos(); - } - - $twig = new supertwig(); - - $twig->addFilter(array('nl2br' => 'nl2br')); - - $template = 'lightbox/validate.twig'; - - if (!$browser->isNewGeneration() && !$browser->isMobile()) - $template = 'lightbox/IE6/validate.twig'; - - $response = new Response($twig->render($template, array( - 'baskets_collection' => $basket_collection, - 'basket' => $basket, - 'local_title' => strip_tags($basket->get_name()), - 'module' => 'lightbox', - 'module_name' => _('admin::monitor: module validation') - ) - )); - $response->setCharset('UTF-8'); - - return $response; - } - )->assert('ssel_id', '\d+'); - - - - $app->get('/feeds/entry/{entry_id}/', function ($entry_id) use ($session, $appbox) - { - - User_Adapter::updateClientInfos((6)); - - $browser = Browser::getInstance(); - - $feed_entry = Feed_Entry_Adapter::load_from_id($appbox, $entry_id); - - $twig = new supertwig(); - - $twig->addFilter(array('nl2br' => 'nl2br')); - - $template = 'lightbox/feed.twig'; - - if (!$browser->isNewGeneration() && !$browser->isMobile()) - $template = 'lightbox/IE6/feed.twig'; - - $output = $twig->render($template, array( - 'feed_entry' => $feed_entry, - 'first_item' => array_shift($feed_entry->get_content()), - 'local_title' => $feed_entry->get_title(), - 'module' => 'lightbox', - 'module_name' => _('admin::monitor: module validation') - ) - ); - $response = new Response($output, 200); - $response->setCharset('UTF-8'); - - return $response; - } - )->assert('entry_id', '\d+'); - - $app->get('/ajax/LOAD_REPORT/{ssel_id}/', function($ssel_id) use ($appbox, $app) - { - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - - $browser = Browser::getInstance(); - - $template = 'lightbox/basket_content_report.twig'; - - $basket = basket_adapter::getInstance($appbox, $ssel_id, $appbox->get_session()->get_usr_id()); - - $response = new Response($twig->render($template, array('basket' => $basket))); - $response->setCharset('UTF-8'); - - return $response; - } - )->assert('ssel_id', '\d+'); - - $app->post('/ajax/SET_NOTE/{sselcont_id}/', function ($sselcont_id) use ($app) - { - $output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')); - try - { - $request = $app['request']; - $note = $request->get('note'); - - $basket_element = basket_element_adapter::getInstance($sselcont_id); - $basket_element->set_note($note); - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - - $browser = Browser::getInstance(); - - if ($browser->isMobile()) - { - $datas = $twig->render('lightbox/sc_note.twig', array('basket_element' => $basket_element)); - - $output = array('error' => false, 'datas' => $datas); - } - else - { - $template = 'lightbox/sc_note.twig'; - - $datas = $twig->render($template, array('basket_element' => $basket_element)); - - $output = array('error' => false, 'datas' => $datas); - } - } - catch (Exception $e) - { - return new Response('Bad Request : ' . $e->getMessage() . $e->getFile() . $e->getLine(), 400); - } - - $output = p4string::jsonencode($output); - - return new Response($output, 200, array('Content-Type' => 'application/json')); - } - )->assert('sselcont_id', '\d+'); - - $app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function($sselcont_id) use ($app) - { - $request = $app['request']; - $agreement = (int) $request->get('agreement'); - - $ret = array( - 'error' => true, - 'releasable' => false, - 'datas' => _('Erreur lors de la mise a jour des donnes ') - ); - try - { - $appbox = appbox::get_instance(); - - $basket_element = basket_element_adapter::getInstance($sselcont_id); - $basket_element->set_agreement($agreement); - $basket = basket_adapter::getInstance($appbox, $basket_element->get_ssel_id(), $appbox->get_session()->get_usr_id()); - - $ret = array( - 'error' => false - , 'datas' => '' - , 'releasable' => $basket->is_releasable() ? _('Do you want to send your report ?') : false - ); - } - catch (Exception $e) - { - return new Response('Bad Request', 400); - } - $output = p4string::jsonencode($ret); - - return new Response($output, 200, array('Content-Type' => 'application/json')); - } - )->assert('sselcont_id', '\d+'); - - - $app->post('/ajax/SET_RELEASE/{ssel_id}/', function($ssel_id) use ($session, $appbox) - { - $basket = basket_adapter::getInstance($appbox, $ssel_id, $appbox->get_session()->get_usr_id()); - - $datas = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')); - try - { - $appbox->get_connection()->beginTransaction(); - $basket->set_released(); - $datas = array('error' => false, 'datas' => _('Envoie avec succes')); - $appbox->get_connection()->commit(); - } - catch (Exception $e) - { - $appbox->get_connection()->rollBack(); - - return new Response('Bad Request', 400); - } - $output = p4string::jsonencode($datas); - - $response = new Response($output, 200, array('Content-Type' => 'application/json')); - $response->setCharset('UTF-8'); - - return $response; - } - )->assert('ssel_id', '\d+'); - - - - $app->error(function($e) - { - $twig = new supertwig(); - $registry = registry::get_instance(); - - $template = 'lightbox/error.twig'; - - if ($registry->get('GV_debug')) - { - $options = array( - 'module' => 'validation', - 'module_name' => _('admin::monitor: module validation'), - 'error' => sprintf( - '%s in %s on line %s ' - , $e->getMessage() - , $e->getFile() - , $e->getLine() - ) - ); - } - else - { - $options = array( - 'module' => 'validation', - 'module_name' => _('admin::monitor: module validation'), - 'error' => '' - ); - } - $output = $twig->render($template, $options); - $response = new Response($output, 404); - $response->setCharset('UTF-8'); - - return $response; - }); - - return $app; - } -); diff --git a/lib/classes/module/Overview.php b/lib/classes/module/Overview.php deleted file mode 100644 index 6d07c54019..0000000000 --- a/lib/classes/module/Overview.php +++ /dev/null @@ -1,227 +0,0 @@ -get_session(); - - $app = new Silex\Application(); - - - $deliver_content = function(Session_Handler $session, record_adapter $record, $subdef, $watermark, $stamp, $app) - { - - $file = $record->get_subdef($subdef); - if ($file->get_baseurl() !== '') - { - return $app->redirect($file->get_url()); - } - - $pathIn = $pathOut = $file->get_pathfile(); - - if ($watermark === true && $file->get_type() === media_subdef::TYPE_IMAGE) - { - $pathOut = recordutils_image::watermark($record->get_base_id(), $record->get_record_id()); - } - elseif ($stamp === true && $file->get_type() === media_subdef::TYPE_IMAGE) - { - $pathOut = recordutils_image::stamp($record->get_base_id(), $record->get_record_id()); - } - - - $log_id = null; - try - { - $registry = registry::get_instance(); - $logger = $session->get_logger($record->get_databox()); - $log_id = $logger->get_id(); - - $referrer = 'NO REFERRER'; - - if (isset($_SERVER['HTTP_REFERER'])) - $referrer = $_SERVER['HTTP_REFERER']; - - $record->log_view($log_id, $referrer, $registry->get('GV_sit')); - } - catch (Exception $e) - { - - } - - return set_export::stream_file($pathOut, $file->get_file(), $file->get_mime(), 'attachment'); - }; - - $app->get('/datafiles/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef) use ($app, $session, $deliver_content) - { - - $databox = databox::get_instance((int) $sbas_id); - $record = new record_adapter($sbas_id, $record_id); - - $record->get_type(); - - if (!$session->is_authenticated()) - throw new Exception_Session_NotAuthenticated(); - - $user = User_Adapter::getInstance($session->get_usr_id(), appbox::get_instance()); - - if (!$user->ACL()->has_access_to_subdef($record, $subdef)) - throw new Exception_UnauthorizedAction(); - - $stamp = false; - $watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark'); - - if ($watermark) - { - $subdef_class = $databox - ->get_subdef_structure() - ->get_subdef($record->get_type(), $subdef) - ->get_class(); - - if ($subdef_class == databox_subdefAbstract::CLASS_PREVIEW && $user->ACL()->has_preview_grant($record)) - { - $watermark = false; - } - elseif ($subdef_class == databox_subdefAbstract::CLASS_DOCUMENT && $user->ACL()->has_hd_grant($record)) - { - $watermark = false; - } - } - - if ($watermark) - { - if (basket_element_adapter::is_in_validation_session($record, $user)) - { - $watermark = false; - } - elseif (basket_element_adapter::has_been_received($record, $user)) - { - $watermark = false; - } - } - - return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); - })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/view/' - , function($label, $sbas_id, $record_id, $key, $subdef) - { - - $databox = databox::get_instance((int) $sbas_id); - $record = media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef); - if (!($record instanceof record_adapter)) - throw new Exception('bad luck'); - $twig = new supertwig(); - $twig->addFilter(array('formatoctet' => 'p4string::format_octets')); - - return $twig->render('overview.twig', array('subdef_name' => $subdef, 'module_name' => 'overview', 'module' => 'overview', 'view' => 'overview', 'record' => $record)); - })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/' - , function($label, $sbas_id, $record_id, $key, $subdef) use ($app, $session, $deliver_content) - { - $databox = databox::get_instance((int) $sbas_id); - $record = media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef); - if (!($record instanceof record_adapter)) - throw new Exception('bad luck'); - - $watermark = $stamp = false; - - if ($session->is_authenticated()) - { - $user = User_Adapter::getInstance($session->get_usr_id(), appbox::get_instance()); - - $watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark'); - - if ($watermark) - { - if (basket_element_adapter::is_in_validation_session($record, $user)) - { - $watermark = false; - } - elseif (basket_element_adapter::has_been_received($record, $user)) - { - $watermark = false; - } - } - - return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); - } - else - { - $collection = collection::get_from_base_id($record->get_base_id()); - switch ($collection->get_pub_wm()) - { - default: - case 'none': - $watermark = false; - break; - case 'stamp': - $stamp = true; - break; - case 'wm': - $watermark = false; - break; - } - } - - return $deliver_content($session, $record, $subdef, $watermark, $stamp, $app); - } - ) - ->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - - - $app->error(function (\Exception $e) - { - if ($e instanceof Exception_Session_NotAuthenticated) - { - $code = 403; - $message = 'Forbidden'; - } - elseif ($e instanceof Exception_NotAllowed) - { - $code = 403; - $message = 'Forbidden'; - } - elseif ($e instanceof Exception_NotFound) - { - $code = 404; - $message = 'Not Found'; - } - else - { - $code = 404; - $message = 'Not Found'; - } - - return new Response($message, $code); - }); - - - - - return $app; - } -); diff --git a/lib/classes/module/Prod.php b/lib/classes/module/Prod.php deleted file mode 100644 index 4cef7878a3..0000000000 --- a/lib/classes/module/Prod.php +++ /dev/null @@ -1,80 +0,0 @@ -mount('/records/edit', new Controller_Prod_Records_Edit()); - $app->mount('/records/movecollection', new Controller_Prod_Records_MoveCollection()); - $app->mount('/bridge/', new Controller_Prod_Records_Bridge()); - $app->mount('/feeds', new Controller_Prod_Records_Feed()); - $app->mount('/tooltip', new Controller_Prod_Records_Tooltip()); - - $app->error(function (\Exception $e, $code) use ($app, $twig) - { - if ($e instanceof Bridge_Exception) - { - $request = $app['request']; - - $params = array( - 'message' => $e->getMessage() - , 'file' => $e->getFile() - , 'line' => $e->getLine() - , 'r_method' => $request->getMethod() - , 'r_action' => $request->getRequestUri() - , 'r_parameters' => ($request->getMethod() == 'GET' ? array() : $request->request->all()) - ); - - if ($e instanceof Bridge_Exception_ApiConnectorNotConfigured) - { - $params = array_merge($params, array('account' => $app['current_account'])); - - return new response($twig->render('/prod/actions/Bridge/notconfigured.twig', $params), 200); - } - elseif ($e instanceof Bridge_Exception_ApiConnectorNotConnected) - { - $params = array_merge($params, array('account' => $app['current_account'])); - - return new response($twig->render('/prod/actions/Bridge/disconnected.twig', $params), 200); - } - elseif ($e instanceof Bridge_Exception_ApiConnectorAccessTokenFailed) - { - $params = array_merge($params, array('account' => $app['current_account'])); - - return new response($twig->render('/prod/actions/Bridge/disconnected.twig', $params), 200); - } - elseif ($e instanceof Bridge_Exception_ApiDisabled) - { - $params = array_merge($params, array('api' => $e->get_api())); - - return new response($twig->render('/prod/actions/Bridge/deactivated.twig', $params), 200); - } - - return new response($twig->render('/prod/actions/Bridge/error.twig', $params), 200); - } - }); - - - return $app; - }); diff --git a/lib/classes/module/Root.php b/lib/classes/module/Root.php deleted file mode 100644 index 17c30348aa..0000000000 --- a/lib/classes/module/Root.php +++ /dev/null @@ -1,79 +0,0 @@ -redirect("/setup/")->send(); - } - - $app->get('/', function() use ($app) - { - $browser = Browser::getInstance(); - if ($browser->isMobile()) - - return $app->redirect("/login/?redirect=/lightbox"); - elseif ($browser->isNewGeneration()) - - return $app->redirect("/login/?redirect=/prod"); - else - - return $app->redirect("/login/?redirect=/client"); - }); - - $app->get('robots.txt', function() use ($app) - { - require dirname(__FILE__) . "/../lib/bootstrap.php"; - $appbox = appbox::get_instance(); - - $registry = $appbox->get_registry(); - - if ($registry->get('GV_allow_search_engine') === true) - { - $buffer = "User-Agent: *\n" - . "Allow: /\n"; - } - else - { - $buffer = "User-Agent: *\n" - . "Disallow: /\n"; - } - - $response = new Response($buffer, 200, array('Content-Type: text/plain')); - $response->setCharset('UTF-8'); - - return $response; - }); - - $app->mount('/feeds/', new Controller_RSSFeeds()); - - /** - * Mount all aps - */ - - return $app; - } -); diff --git a/lib/classes/module/Setup.php b/lib/classes/module/Setup.php deleted file mode 100644 index b35443710e..0000000000 --- a/lib/classes/module/Setup.php +++ /dev/null @@ -1,83 +0,0 @@ -before(function($a) use ($app) - { - if (setup::is_installed()) - { - $appbox = appbox::get_instance(); - - if (!$appbox->need_major_upgrade()) - throw new Exception_Setup_PhraseaAlreadyInstalled(); - - $app['upgrade'] = true; - } - else - { - $app['install'] = true; - } - - return; - }); - - - $app->get('/', function() use ($app) - { - if ($app['install'] === true) - - return $app->redirect('/setup/installer/'); - if ($app['upgrade'] === true) - - return $app->redirect('/setup/upgrader/'); - }); - - - $app->mount('/installer/', new Controller_Setup_Installer()); - $app->mount('/upgrader/', new Controller_Setup_Upgrader()); - $app->mount('/test', new Controller_Utils_PathFileTest()); - $app->mount('/connection_test', new Controller_Utils_ConnectionTest()); - - $app->error(function($e) use ($app) - { - if ($e instanceof Exception_Setup_PhraseaAlreadyInstalled) - - return $app->redirect('/login'); - - return new Response( - sprintf( - 'Error %s @%s:%s' - , $e->getFile() - , $e->getLine() - , $e->getMessage() - ) - , 500 - ); - }); - - return $app; - }); diff --git a/lib/classes/module/admin.class.php b/lib/classes/module/admin.class.php index a84bc63058..d8c71da1fe 100644 --- a/lib/classes/module/admin.class.php +++ b/lib/classes/module/admin.class.php @@ -20,7 +20,7 @@ class module_admin function getTree($position=false) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $usr_id = $session->get_usr_id(); @@ -76,7 +76,9 @@ class module_admin , 'off_databoxes' => $off_databoxes ); - $twig = new supertwig(); + + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); return $twig->render('admin/tree.html.twig', $params); diff --git a/lib/classes/module/api/V1.php b/lib/classes/module/api/V1.php deleted file mode 100644 index be3a7fbb68..0000000000 --- a/lib/classes/module/api/V1.php +++ /dev/null @@ -1,750 +0,0 @@ -protect(function ($result) - { - $response = new Response( - $result->format() - , $result->get_http_code() - , array('Content-Type' => $result->get_content_type()) - ); - $response->setCharset('UTF-8'); - - return $response; - }); - -/** - * Api Service - * @var Closure - */ -$app['api'] = function () use ($app) - { - return new API_V1_adapter(false, $app["appbox"]); - }; - - - -$parseRoute = function ($route, Response $response) - { - $ressource = $general = $aspect = $action = null; - $exploded_route = explode('/', p4string::delFirstSlash((p4string::delEndSlash($route)))); - if (sizeof($exploded_route) > 0 && $response->isOk()) - { - $ressource = $exploded_route[0]; - - if (sizeof($exploded_route) == 2 && (int) $exploded_route[1] == 0) - { - $general = $exploded_route[1]; - } - else - { - switch ($ressource) - { - case API_V1_Log::DATABOXES_RESSOURCE : - if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) - $aspect = $exploded_route[2]; - break; - case API_V1_Log::RECORDS_RESSOURCE : - if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 4) - { - if (!isset($exploded_route[3])) - $aspect = "record"; - elseif (preg_match("/^set/", $exploded_route[3])) - $action = $exploded_route[3]; - else - $aspect = $exploded_route[3]; - } - break; - case API_V1_Log::BASKETS_RESSOURCE : - if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) - { - if (preg_match("/^set/", $exploded_route[2]) || preg_match("/^delete/", $exploded_route[2])) - $action = $exploded_route[2]; - else - $aspect = $exploded_route[2]; - } - break; - case API_V1_Log::FEEDS_RESSOURCE : - if ((int) $exploded_route[1] > 0 && sizeof($exploded_route) == 3) - $aspect = $exploded_route[2]; - break; - } - } - } - - return array('ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action); - }; - - - -/** - * oAuth verification process - */ -$app->before(function($request) use ($app) - { - $session = $app["appbox"]->get_session(); - $oauth2_adapter = new API_OAuth2_Adapter($app["appbox"]); - $oauth2_adapter->verifyAccessToken(); - - $app['p4user'] = User_Adapter::getInstance($oauth2_adapter->get_usr_id(), $app["appbox"]); - $app['token'] = API_OAuth2_Token::load_by_oauth_token($app["appbox"], $oauth2_adapter->getToken()); - - if ($session->is_authenticated()) - - return; - if ($oauth2_adapter->has_ses_id()) - { - try - { - $session->restore($app['p4user'], $oauth2_adapter->get_ses_id()); - - return; - } - catch (\Exception $e) - { - - } - } - $auth = new Session_Authentication_None($app['p4user']); - $session->authenticate($auth); - $oauth2_adapter->remember_this_ses_id($session->get_ses_id()); - - return; - }); - - -/** - * oAUth log process - */ -$app->after(function (Request $request, Response $response) use ($app, $parseRoute) - { - $account = $app['token']->get_account(); - $pathInfo = $request->getPathInfo(); - $route = $parseRoute($pathInfo, $response); - $log = API_V1_Log::create( - $app["appbox"], - $account, - $request->getMethod() . " " . $pathInfo, - $response->getStatusCode(), - $response->headers->get('content-type'), - $route['ressource'], - $route['general'], - $route['aspect'], - $route['action']); - }); - -/** - * Method Not Allowed Closure - */ -$bad_request_exception = function() - { - throw new API_V1_exception_badrequest(); - }; - -/** - * ******************************************************************* - * Route : /databoxes/list/FORMAT/ - * - * Method : GET - * - * Parameters : - * - */ -$route = '/databoxes/list/'; -$app->get( - $route, function() use ($app) - { - return $app['response']($app['api']->get_databoxes($app['request'])); - } -); - -/** - * ******************************************************************* - * - * Route /databoxes/DATABOX_ID/collections/FORMAT/ - * - * Method : GET - * - * Parameters ; - * DATABOX_ID : required INT - */ -$route = '/databoxes/{databox_id}/collections/'; -$app->get( - $route, function($databox_id) use ($app) - { - $result = $app['api']->get_databox_collections($app['request'], $databox_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+'); - -$app->get('/databoxes/{any_id}/collections/', $bad_request_exception); - - -/** - * ******************************************************************* - * Route /databoxes/DATABOX_ID/status/FORMAT/ - * - * Method : GET - * - * Parameters ; - * DATABOX_ID : required INT - * - */ -$route = '/databoxes/{databox_id}/status/'; -$app->get( - $route, function($databox_id) use ($app) - { - $result = $app['api']->get_databox_status($app['request'], $databox_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+'); - -$app->get('/databoxes/{any_id}/status/', $bad_request_exception); - -/** - * Route /databoxes/DATABOX_ID/metadatas/FORMAT/ - * - * Method : GET - * - * Parameters ; - * DATABOX_ID : required INT - */ -$route = '/databoxes/{databox_id}/metadatas/'; -$app->get( - $route, function($databox_id) use ($app) - { - $result = $app['api']->get_databox_metadatas($app['request'], $databox_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+'); - -$app->get('/databoxes/{any_id}/metadatas/', $bad_request_exception); - -/** - * Route /databoxes/DATABOX_ID/termsOfUse/FORMAT/ - * - * Method : GET - * - * Parameters ; - * DATABOX_ID : required INT - */ -$route = '/databoxes/{databox_id}/termsOfUse/'; -$app->get( - $route, function($databox_id) use ($app) - { - $result = $app['api']->get_databox_terms($app['request'], $databox_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+'); - -$app->get('/databoxes/{any_id}/termsOfUse/', $bad_request_exception); - - - - - -/** - * Route : /records/search/FORMAT/ - * - * Method : GET or POST - * - * Parameters : - * bases[] : array - * status[] : array - * fields[] : array - * record_type : boolean - * media_type : string - * - * Response : - * Array of record objects - * - */ -$route = '/records/search/'; -$app->post( - $route, function() use ($app) - { - $result = $app['api']->search_records($app['request']); - - return $app['response']($result); - } -); - - -/** - * Route : /records/DATABOX_ID/RECORD_ID/metadatas/FORMAT/ - * - * Method : GET - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/metadatas/'; -$app->get( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->get_record_metadatas($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->get('/records/{any_id}/{anyother_id}/metadatas/', $bad_request_exception); - -/** - * Route : /records/DATABOX_ID/RECORD_ID/status/FORMAT/ - * - * Method : GET - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/status/'; -$app->get( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->get_record_status($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->get('/records/{any_id}/{anyother_id}/status/', $bad_request_exception); - -/** - * Route : /records/DATABOX_ID/RECORD_ID/related/FORMAT/ - * - * Method : GET - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/related/'; -$app->get( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->get_record_related($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->get('/records/{any_id}/{anyother_id}/related/', $bad_request_exception); - -/** - * Route : /records/DATABOX_ID/RECORD_ID/embed/FORMAT/ - * - * Method : GET - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/embed/'; -$app->get( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->get_record_embed($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->get('/records/{any_id}/{anyother_id}/embed/', $bad_request_exception); - -/** - * Route : /records/DATABOX_ID/RECORD_ID/setmetadatas/FORMAT/ - * - * Method : POST - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/setmetadatas/'; -$app->post( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->set_record_metadatas($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->post('/records/{any_id}/{anyother_id}/setmetadatas/', $bad_request_exception); - -/** - * Route : /records/DATABOX_ID/RECORD_ID/setstatus/FORMAT/ - * - * Method : POST - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/setstatus/'; -$app->post( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->set_record_status($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); - -$app->post('/records/{any_id}/{anyother_id}/setstatus/', $bad_request_exception); - - -/** - * Route : /records/DATABOX_ID/RECORD_ID/setcollection/FORMAT/ - * - * Method : POST - * - * Parameters : - * DATABOX_ID : required INT - * RECORD_ID : required INT - * - */ -$route = '/records/{databox_id}/{record_id}/setcollection/'; -$app->post( - $route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->set_record_collection($app['request'], $databox_id, $record_id); - - return $app['response']($result); - } -)->assert('databox_id', '\d+')->assert('record_id', '\d+'); -$app->post('/records/{wrong_databox_id}/{wrong_record_id}/setcollection/', $bad_request_exception); - - -$route = '/records/{databox_id}/{record_id}/'; -$app->get($route, function($databox_id, $record_id) use ($app) - { - $result = $app['api']->get_record($app['request'], $databox_id, $record_id); - - return $app['response']($result); - })->assert('databox_id', '\d+')->assert('record_id', '\d+'); -$app->get('/records/{any_id}/{anyother_id}/', $bad_request_exception); - -/** - * Route : /baskets/list/FORMAT/ - * - * Method : POST - * - * Parameters : - * - */ -$route = '/baskets/list/'; -$app->get( - $route, function() use ($app) - { - $result = $app['api']->search_baskets($app['request']); - - return $app['response']($result); - } -); - - -/** - * Route : /baskets/add/FORMAT/ - * - * Method : POST - * - * Parameters : - * - */ -$route = '/baskets/add/'; -$app->post( - $route, function() use ($app) - { - $result = $app['api']->create_basket($app['request']); - - return $app['response']($result); - } -); - - - -/** - * Route : /baskets/BASKET_ID/content/FORMAT/ - * - * Method : GET - * - * Parameters : - * BASKET_ID : required INT - * - */ -$route = '/baskets/{basket_id}/content/'; -$app->get( - $route, function($basket_id) use ($app) - { - $result = $app['api']->get_basket($app['request'], $basket_id); - - return $app['response']($result); - } -)->assert('basket_id', '\d+'); -$app->get('/baskets/{wrong_basket_id}/content/', $bad_request_exception); - - -/** - * Route : /baskets/BASKET_ID/settitle/FORMAT/ - * - * Method : GET - * - * Parameters : - * BASKET_ID : required INT - * - */ -$route = '/baskets/{basket_id}/setname/'; -$app->post( - $route, function($basket_id) use ($app) - { - $result = $app['api']->set_basket_title($app['request'], $basket_id); - - return $app['response']($result); - } -)->assert('basket_id', '\d+'); -$app->post('/baskets/{wrong_basket_id}/setname/', $bad_request_exception); - - -/** - * Route : /baskets/BASKET_ID/setdescription/FORMAT/ - * - * Method : POST - * - * Parameters : - * BASKET_ID : required INT - * - */ -$route = '/baskets/{basket_id}/setdescription/'; -$app->post( - $route, function($basket_id) use ($app) - { - $result = $app['api']->set_basket_description($app['request'], $basket_id); - - return $app['response']($result); - } -)->assert('basket_id', '\d+'); -$app->post('/baskets/{wrong_basket_id}/setdescription/', $bad_request_exception); - -/** - * Route : /baskets/BASKET_ID/delete/FORMAT/ - * - * Method : POST - * - * Parameters : - * BASKET_ID : required INT - * - */ -$route = '/baskets/{basket_id}/delete/'; -$app->post( - $route, function($basket_id) use ($app) - { - $result = $app['api']->delete_basket($app['request'], $basket_id); - - return $app['response']($result); - } -)->assert('basket_id', '\d+'); -$app->post('/baskets/{wrong_basket_id}/delete/', $bad_request_exception); - - -/** - * Route : /feeds/list/FORMAT/ - * - * Method : POST - * - * Parameters : - * - */ -// public function search_publications(\Symfony\Component\HttpFoundation\Request $app['request']); - - -$route = '/feeds/list/'; -$app->get( - $route, function() use ($app) - { - $result = $app['api']->search_publications($app['request'], $app['p4user']); - - return $app['response']($result); - } -); - -/** - * Route : /feeds/PUBLICATION_ID/content/FORMAT/ - * - * Method : GET - * - * Parameters : - * PUBLICATION_ID : required INT - * - */ -// public function get_publication(\Symfony\Component\HttpFoundation\Request $app['request'], $publication_id); - -$route = '/feeds/{feed_id}/content/'; -$app->get( - $route, function($feed_id) use ($app) - { - $result = $app['api']->get_publication($app['request'], $feed_id, $app['p4user']); - - return $app['response']($result); - } -)->assert('feed_id', '\d+'); -$app->get('/feeds/{wrong_feed_id}/content/', $bad_request_exception); - -/** - * ******************************************************************* - * - * Route Errors - * - */ -$app->error(function (\Exception $e) use ($app) - { - - if ($e instanceof API_V1_exception_methodnotallowed) - $code = API_V1_result::ERROR_METHODNOTALLOWED; - elseif ($e instanceof Exception\MethodNotAllowedHttpException) - $code = API_V1_result::ERROR_METHODNOTALLOWED; - elseif ($e instanceof API_V1_exception_badrequest) - $code = API_V1_result::ERROR_BAD_REQUEST; - elseif ($e instanceof API_V1_exception_forbidden) - $code = API_V1_result::ERROR_FORBIDDEN; - elseif ($e instanceof API_V1_exception_unauthorized) - $code = API_V1_result::ERROR_UNAUTHORIZED; - elseif ($e instanceof API_V1_exception_internalservererror) - $code = API_V1_result::ERROR_INTERNALSERVERERROR; -// elseif ($e instanceof API_V1_exception_notfound) -// $code = API_V1_result::ERROR_NOTFOUND; - elseif ($e instanceof Exception_NotFound) - $code = API_V1_result::ERROR_NOTFOUND; - elseif ($e instanceof Exception\NotFoundHttpException) - $code = API_V1_result::ERROR_NOTFOUND; - else - $code = API_V1_result::ERROR_INTERNALSERVERERROR; - - $result = $app['api']->get_error_message($app['request'], $code); - - return $app['response']($result); - }); -//// public function get_version(); -//// -//// -//// /** -//// * Route : /records/DATABOX_ID/RECORD_ID/addtobasket/FORMAT/ -//// * -//// * Method : POST -//// * -//// * Parameters : -//// * DATABOX_ID : required INT -//// * RECORD_ID : required INT -//// * -//// */ -//// public function add_record_tobasket(\Symfony\Component\HttpFoundation\Request $app['request'], $databox_id, $record_id); -//// -//// -//// /** -//// * Route : /feeds/PUBLICATION_ID/remove/FORMAT/ -//// * -//// * Method : GET -//// * -//// * Parameters : -//// * PUBLICATION_ID : required INT -//// * -//// */ -//// public function remove_publications(\Symfony\Component\HttpFoundation\Request $app['request'], $publication_id); -//// -//// -//// /** -//// * Route : /users/search/FORMAT/ -//// * -//// * Method : POST-GET -//// * -//// * Parameters : -//// * -//// */ -//// public function search_users(\Symfony\Component\HttpFoundation\Request $app['request']); -//// -//// /** -//// * Route : /users/USER_ID/access/FORMAT/ -//// * -//// * Method : GET -//// * -//// * Parameters : -//// * USER_ID : required INT -//// * -//// */ -//// public function get_user_acces(\Symfony\Component\HttpFoundation\Request $app['request'], $usr_id); -//// -//// /** -//// * Route : /users/add/FORMAT/ -//// * -//// * Method : POST -//// * -//// * Parameters : -//// * -//// */ -//// public function add_user(\Symfony\Component\HttpFoundation\Request $app['request']); -return $app; - -}); diff --git a/lib/classes/module/console/aboutAuthors.class.php b/lib/classes/module/console/aboutAuthors.class.php index 50e9698a6d..212e090a37 100644 --- a/lib/classes/module/console/aboutAuthors.class.php +++ b/lib/classes/module/console/aboutAuthors.class.php @@ -37,9 +37,9 @@ class module_console_aboutAuthors extends Command public function execute(InputInterface $input, OutputInterface $output) { - $output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../AUTHORS')); + $output->writeln(file_get_contents(__DIR__ . '/../../../../AUTHORS')); - return; + return 0; } } diff --git a/lib/classes/module/console/aboutLicense.class.php b/lib/classes/module/console/aboutLicense.class.php index 246140dbbc..57df72cc13 100644 --- a/lib/classes/module/console/aboutLicense.class.php +++ b/lib/classes/module/console/aboutLicense.class.php @@ -37,9 +37,9 @@ class module_console_aboutLicense extends Command public function execute(InputInterface $input, OutputInterface $output) { - $output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../LICENSE')); + $output->writeln(file_get_contents(__DIR__ . '/../../../../LICENSE')); - return; + return 0; } } diff --git a/lib/classes/module/console/checkExtension.class.php b/lib/classes/module/console/checkExtension.class.php new file mode 100644 index 0000000000..35fcfd9117 --- /dev/null +++ b/lib/classes/module/console/checkExtension.class.php @@ -0,0 +1,248 @@ +setDescription('Delete a documentation field from a Databox'); + + $this->addOption('usr_id', 'u', InputOption::VALUE_OPTIONAL, 'Usr_id to use. If no user, get the first available'); + + $this->addOption('query', '', InputOption::VALUE_OPTIONAL, 'The query', 'last'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + + if (!extension_loaded('phrasea2')) + printf("Missing Extension php-phrasea"); + + $appbox = \appbox::get_instance(); + $registry = $appbox->get_registry(); + + $usr_id = $input->getOption('usr_id'); + + try + { + $TestUser = \User_Adapter::getInstance($usr_id, $appbox); + } + catch (\Exception $e) + { + $output->writeln("Wrong user !"); + + return 1; + } + + $output->writeln( + sprintf( + "\nWill do the check with user %s (%s)\n" + , $TestUser->get_display_name() + , $TestUser->get_email() + ) + ); + + $output->writeln("PHRASEA FUNCTIONS"); + + foreach (get_extension_funcs("phrasea2") as $function) + { + $output->writeln("$function"); + } + + require (__DIR__ . '/../../../../config/connexion.inc'); + + + $output->writeln("\n-- phrasea_conn --"); + + if (phrasea_conn($hostname, $port, $user, $password, $dbname) !== true) + { + $output->writeln("Failed ! got no connection"); + + return 1; + } + else + { + $output->writeln("Succes ! got connection"); + } + + $output->writeln(""); + + $output->writeln("\n-- phrasea_info --"); + + foreach (phrasea_info() as $key => $value) + { + $output->writeln("\t$key => $value"); + } + + + $output->writeln(""); + + $output->writeln("\n-- phrasea_create_session --"); + + $sessid = phrasea_create_session((string) $TestUser->get_id()); + + if (ctype_digit((string) $sessid)) + { + $output->writeln("Succes ! got session id $sessid"); + } + else + { + $output->writeln("Failed ! got no session id"); + + return 1; + } + + $output->writeln("\n-- phrasea_open_session --"); + + $ph_session = phrasea_open_session($sessid, $usr_id); + + if ($ph_session) + { + $output->writeln("Succes ! got session "); + } + else + { + $output->writeln("Failed ! got no session "); + + return 1; + } + + $output->writeln("\n-- phrasea_clear_cache --"); + + $ret = phrasea_clear_cache($sessid); + + if ($sessid) + { + $output->writeln("Succes ! got session "); + } + else + { + $output->writeln("Failed ! got no session "); + + return 1; + } + + $tbases = array(); + + foreach ($ph_session["bases"] as $phbase) + { + $tcoll = array(); + foreach ($phbase["collections"] as $coll) + { + $tcoll[] = 0 + $coll["base_id"]; + } + if (sizeof($tcoll) > 0) + { + $kbase = "S" . $phbase["sbas_id"]; + $tbases[$kbase] = array(); + $tbases[$kbase]["sbas_id"] = $phbase["sbas_id"]; + $tbases[$kbase]["searchcoll"] = $tcoll; + $tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0; + + $qp = new searchEngine_adapter_phrasea_queryParser(); + $treeq = $qp->parsequery($input->getOption('query')); + $arrayq = $qp->makequery($treeq); + + $tbases[$kbase]["arrayq"] = $arrayq; + } + } + + + $output->writeln("\n-- phrasea_query --"); + + $nbanswers = 0; + foreach ($tbases as $kb => $base) + { + $tbases[$kb]["results"] = NULL; + + $ret = phrasea_query2( + $ph_session["session_id"] + , $base["sbas_id"] + , $base["searchcoll"] + , $base["arrayq"] + , $registry->get('GV_sit') + , $usr_id + , FALSE + , PHRASEA_MULTIDOC_DOCONLY + ); + + + if ($ret) + { + $output->writeln("Succes ! got result on sbas_id " . $base["sbas_id"]); + } + else + { + $output->writeln("Failed ! No results on sbas_id " . $base["sbas_id"]); + + return 1; + } + + $tbases[$kb]["results"] = $ret; + + $nbanswers += $tbases[$kb]["results"]["nbanswers"]; + } + + + $output->writeln("Got a total of $nbanswers answers"); + + $output->writeln("\n-- phrasea_fetch_results --"); + + $rs = phrasea_fetch_results($sessid, $usr_id, 1, true, '[[em]]', '[[/em]]'); + + if ($rs) + { + $output->writeln("Succes ! got result "); + } + else + { + $output->writeln("Failed ! got no result "); + + return 1; + } + + $output->writeln("\n-- phrasea_close_session --"); + + $rs = phrasea_close_session($sessid); + + if ($rs) + { + $output->writeln("Succes ! closed ! "); + } + else + { + $output->writeln("Failed ! not closed "); + + return 1; + } + + return 0; + } + +} diff --git a/lib/classes/module/console/fieldsDelete.class.php b/lib/classes/module/console/fieldsDelete.class.php new file mode 100644 index 0000000000..b94f70c366 --- /dev/null +++ b/lib/classes/module/console/fieldsDelete.class.php @@ -0,0 +1,98 @@ +setDescription('Delete a documentation field from a Databox'); + + $this->addOption('sbas_id', 's', InputOption::VALUE_REQUIRED, 'Databox sbas_id'); + + $this->addOption('meta_struct_id', 'm', InputOption::VALUE_REQUIRED, 'Databox meta structure Id'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + + if (!$input->getOption('sbas_id')) + throw new \Exception('Missing argument sbas_id'); + + if (!$input->getOption('meta_struct_id')) + throw new \Exception('Missing argument meta_struct_id'); + + try + { + $databox = \databox::get_instance((int) $input->getOption('sbas_id')); + } + catch (\Exception $e) + { + $output->writeln("Invalid databox id "); + + return 1; + } + + try + { + $field = $databox->get_meta_structure()->get_element((int) $input->getOption('meta_struct_id')); + } + catch (\Exception $e) + { + $output->writeln("Invalid meta struct id "); + + return 1; + } + + + $dialog = $this->getHelperSet()->get('dialog'); + $continue = mb_strtolower( + $dialog->ask( + $output + , "About to delete " . $field->get_name() . " (y/N)" + , 'n' + ) + ); + + if($continue != 'y') + { + $output->writeln("Request canceled by user"); + + return 1; + } + + $output->writeln("Deleting ... "); + + $field->delete(); + + $output->writeln("Done with success !"); + + return 0; + } + +} diff --git a/lib/classes/module/console/fieldsList.class.php b/lib/classes/module/console/fieldsList.class.php new file mode 100644 index 0000000000..b1a5e14be5 --- /dev/null +++ b/lib/classes/module/console/fieldsList.class.php @@ -0,0 +1,70 @@ +setDescription('List all databox fields'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + + $appbox = \appbox::get_instance(\bootstrap::getCore()); + + foreach ($appbox->get_databoxes() as $databox) + { + /* @var $databox \databox */ + $output->writeln( + sprintf( + "\n ---------------- \nOn databox %s (sbas_id %d) :\n" + , $databox->get_viewname() + , $databox->get_sbas_id() + ) + ); + + foreach ($databox->get_meta_structure()->get_elements() as $field) + { + $output->writeln( + sprintf( + " %2d - %s (%s) %s" + , $field->get_id() + , $field->get_name() + , $field->get_type() + , ($field->is_multi() ? 'multi' : '') + ) + ); + } + } + + return 0; + } + +} diff --git a/lib/classes/module/console/fieldsMerge.class.php b/lib/classes/module/console/fieldsMerge.class.php new file mode 100644 index 0000000000..d3042a4732 --- /dev/null +++ b/lib/classes/module/console/fieldsMerge.class.php @@ -0,0 +1,284 @@ +setDescription('Merge databox structure fields'); + + $this->addOption( + 'source' + , 'f' + , InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY + , 'Metadata structure ids for source' + , array() + ); + + $this->addOption( + 'destination' + , 'd' + , InputOption::VALUE_REQUIRED + , 'Metadata structure id destination' + ); + + $this->addOption( + 'sbas_id' + , 's' + , InputOption::VALUE_REQUIRED + , 'Databox sbas_id' + ); + + $this->addOption( + 'separator' + , '' + , InputOption::VALUE_OPTIONAL + , 'Separator for concatenation (if destination is monovalued)' + , ';' + ); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln(""); + + if (!$input->getOption('sbas_id')) + throw new \Exception('Missing argument sbas_id'); + + try + { + $databox = \databox::get_instance((int) $input->getOption('sbas_id')); + } + catch (\Exception $e) + { + $output->writeln("Invalid databox id "); + + return 1; + } + + $sources = array(); + + foreach ($input->getOption('source') as $source_id) + { + $sources[] = $databox->get_meta_structure()->get_element($source_id); + } + + if (count($sources) === 0) + throw new \Exception('No sources to proceed'); + + if (!$input->getOption('destination')) + throw new \Exception('Missing argument destination'); + + $separator = ' ' . $input->getOption('separator') . ' '; + + $destination = $databox->get_meta_structure()->get_element($input->getOption('destination')); + + $types = $multis = array(); + + foreach ($sources as $source) + { + array_push($types, $source->get_type()); + array_push($multis, $source->is_multi()); + } + + $types = array_unique($types); + $multis = array_unique($multis); + + if (count(array_unique($types)) > 1) + { + $output->writeln( + sprintf("Warning, trying to merge inconsistent types : %s\n" + , implode(', ', $types) + ) + ); + } + + if (count(array_unique($multis)) > 1) + { + $output->writeln( + sprintf( + "Warning, trying to merge mono and multi values fields\n" + ) + ); + } + + $field_names = array(); + foreach ($sources as $source) + { + $field_names[] = $source->get_name(); + } + + if (count($multis) == 1) + { + if ($multis[0] === false && !$destination->is_multi()) + { + $output->writeln( + sprintf( + "You are going to merge mono valued fields in a " + . "monovalued field, fields will be " + . "concatenated in the following order : %s" + , implode($separator, $field_names) + ) + ); + $this->displayHelpConcatenation($output); + } + elseif ($multis[0] === true && !$destination->is_multi()) + { + $output->writeln( + sprintf( + "You are going to merge multi valued fields in a " + . "monovalued field, fields will be " + . "concatenated in the following order : %s" + , implode(' ', $field_names) + ) + ); + $this->displayHelpConcatenation($output); + } + elseif ($multis[0] === false && $destination->is_multi()) + { + $output->writeln( + sprintf( + "You are going to merge mono valued fields in a " + . "multivalued field" + ) + ); + } + elseif ($multis[0] === true && $destination->is_multi()) + { + $output->writeln( + sprintf( + "You are going to merge multi valued fields in a " + . "multivalued field" + ) + ); + } + } + elseif ($destination->is_multi()) + { + $output->writeln( + sprintf( + "You are going to merge mixed valued fields in a " + . "multivalued field" + ) + ); + } + else + { + $output->writeln( + sprintf( + "You are going to merge mixed valued fields in a " + . "monovalued field, fields will be " + . "concatenated in the following order : %s" + , implode($separator, $field_names) + ) + ); + $this->displayHelpConcatenation($output); + } + + $start = 0; + $quantity = 100; + + do + { + $sql = 'SELECT record_id FROM record + ORDER BY record_id LIMIT ' . $start . ', ' . $quantity; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $results = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($results as $row) + { + $record = $databox->get_record($row['record_id']); + + $datas = array(); + + foreach ($sources as $source) + { + try + { + $value = $record->get_caption()->get_field($source->get_name())->get_value(); + } + catch (\Exception $e) + { + $value = array(); + } + if (!is_array($value)) + { + $value = array($value); + } + + $datas = array_merge($datas, $value); + } + + $datas = array_unique($datas); + + if (!$destination->is_multi()) + { + $datas = array(implode($separator, $datas)); + } + + try + { + $record->get_caption()->get_field($destination->get_name())->set_value($datas); + } + catch (\Exception $e) + { + $record->set_metadatas( + array( + array( + 'meta_struct_id' => $destination->get_id() + , 'meta_id' => null + , 'value' => $datas + ) + ) + , true + ); + } + unset($record); + } + + $start += $quantity; + } + while (count($results) > 0); + + return 0; + } + + protected function displayHelpConcatenation(OutputInterface $output) + { + + $output->writeln("\nYou can choose the concatenation order in the " + . "commandline (first option is first value) and set a separator " + . "with the --separator option)"); + + return $this; + } + +} diff --git a/lib/classes/module/console/fieldsRename.class.php b/lib/classes/module/console/fieldsRename.class.php new file mode 100644 index 0000000000..adc1a691f3 --- /dev/null +++ b/lib/classes/module/console/fieldsRename.class.php @@ -0,0 +1,106 @@ +setDescription('Rename a documentation field from a Databox'); + + $this->addOption('sbas_id', 's', InputOption::VALUE_REQUIRED, 'Databox sbas_id'); + + $this->addOption('meta_struct_id', 'm', InputOption::VALUE_REQUIRED, 'Databox meta structure Id'); + + $this->addOption('name', 'n', InputOption::VALUE_REQUIRED, 'The new name'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + + if (!$input->getOption('sbas_id')) + throw new \Exception('Missing argument sbas_id'); + + if (!$input->getOption('meta_struct_id')) + throw new \Exception('Missing argument meta_struct_id'); + + if (!$input->getOption('name')) + throw new \Exception('Missing argument name'); + + $new_name = $input->getOption('name'); + + try + { + $databox = \databox::get_instance((int) $input->getOption('sbas_id')); + } + catch (\Exception $e) + { + $output->writeln("Invalid databox id "); + + return 1; + } + + try + { + $field = $databox->get_meta_structure()->get_element((int) $input->getArgument('meta_struct_id')); + } + catch (\Exception $e) + { + $output->writeln("Invalid meta struct id "); + + return 1; + } + + + $dialog = $this->getHelperSet()->get('dialog'); + $continue = mb_strtolower( + $dialog->ask( + $output + , "About to rename " . $field->get_name() . " into ".$new_name." (y/N)" + , 'n' + ) + ); + + if($continue != 'y') + { + $output->writeln("Request canceled by user"); + + return 1; + } + + $output->writeln("Renaming ... "); + + $field->set_name($new_name); + $field->save(); + + $output->writeln("Done with success !"); + + return 0; + } + +} diff --git a/lib/classes/module/console/fileEnsureDevSetting.class.php b/lib/classes/module/console/fileEnsureDevSetting.class.php new file mode 100644 index 0000000000..01e8cf8056 --- /dev/null +++ b/lib/classes/module/console/fileEnsureDevSetting.class.php @@ -0,0 +1,922 @@ +setDescription('Ensure development settings'); + + $this->addArgument('conf', InputArgument::OPTIONAL, 'The file to check', null); + $this->addOption('strict', 's', InputOption::VALUE_NONE, 'Wheter to fail on alerts or not'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $specifications = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification(); + + $environnement = $input->getArgument('conf'); + + $this->configuration = \Alchemy\Phrasea\Core\Configuration::build($specifications, $environnement); + + if (!$this->configuration->isInstalled()) + { + $output->writeln(sprintf("\nPhraseanet is not installed\n")); + } + + $this->checkParse($output); + $output->writeln(sprintf("Will Ensure Production Settings on %s", $this->configuration->getEnvironnement())); + + $this->runTests($output); + + $retval = $this->errors; + if ($input->getOption('strict')) + { + $retval += $this->alerts; + } + + if ($retval > 0) + { + $output->writeln("\nSome errors found in your conf"); + } + else + { + $output->writeln("\nYour dev settings are setted correctly ! Enjoy"); + } + $output->writeln('End'); + + return $retval; + } + + private function runTests(OutputInterface $output) + { + foreach ($this->testSuite as $test) + { + $display = ""; + switch ($test) + { + case 'checkPhraseanetScope' : + $display = "Phraseanet Configuration"; + break; + case 'checkDatabaseScope' : + $display = "Database"; + break; + case 'checkTeamplateEngineService' : + $display = "Template Engine"; + break; + case 'checkOrmService' : + $display = "ORM"; + break; + case 'checkCacheService' : + $display = "Cache"; + break; + case 'checkOpcodeCacheService' : + $display = "Opcode"; + break; + default: + throw new \Exception('Unknown test'); + break; + } + + $output->writeln(sprintf("\n||| %s", mb_strtoupper($display))); + + call_user_func(array($this, $test), $output); + } + } + + private function checkParse(OutputInterface $output) + { + + if (!$this->configuration->getConfigurations()) + { + throw new \Exception("Unable to load configurations\n"); + } + if (!$this->configuration->getConnexions()) + { + throw new \Exception("Unable to load connexions\n"); + } + if (!$this->configuration->getServices()) + { + throw new \Exception("Unable to load services\n"); + } + + return; + } + + private function checkCacheService(OutputInterface $output) + { + $cache = $this->configuration->getCache(); + + + if ($this->probeCacheService($output, $cache)) + { + if ($this->recommendedCacheService($output, $cache, true)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'Cache server recommended'; + $this->alerts++; + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", 'MainCache', $work_message); + + + $this->printConf($output, "\t" . 'service', $cache, false, $verification); + $this->verifyCacheOptions($output, $cache); + } + + private function checkOpcodeCacheService(OutputInterface $output) + { + $cache = $this->configuration->getOpcodeCache(); + + + if ($this->probeCacheService($output, $cache)) + { + if ($this->recommendedCacheService($output, $cache, false)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'No cache required'; + $this->errors++; + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", 'OpcodeCache', $work_message); + + + $this->printConf($output, "\t" . 'service', $cache, false, $verification); + $this->verifyCacheOptions($output, $cache); + } + + private function checkPhraseanetScope(OutputInterface $output) + { + $required = array('servername', 'maintenance', 'debug', 'display_errors', 'database'); + + $phraseanet = $this->configuration->getPhraseanet(); + + foreach ($phraseanet->all() as $conf => $value) + { + switch ($conf) + { + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + case 'servername': + $url = $value; + $required = array_diff($required, array($conf)); + + $parseUrl = parse_url($url); + + if (empty($url)) + { + $message = "should not be empty"; + $this->errors++; + } + elseif ($url == 'http://sub.domain.tld/') + { + $this->alerts++; + $message = "may be wrong"; + } + elseif (!filter_var($url, FILTER_VALIDATE_URL)) + { + $message = "not valid"; + $this->errors++; + } + else + { + $message = "OK"; + } + $this->printConf($output, $conf, $value, false, $message); + break; + case 'maintenance': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== false) + { + $message = 'Should be true'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'debug': + case 'display_errors': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== true) + { + $message = 'Should be true'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'database': + $required = array_diff($required, array($conf)); + try + { + $service = $this->configuration->getConnexion($value); + if ($this->verifyDatabaseConnexion($service)) + { + $message = 'OK'; + } + else + { + $message = 'Connection not available'; + $this->errors++; + } + } + catch (\Exception $e) + { + $message = 'Unknown connection'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + private function checkDatabaseScope(OutputInterface $output) + { + $connexionName = $this->configuration->getPhraseanet()->get('database'); + $connexion = $this->configuration->getConnexion($connexionName); + + try + { + if ($this->verifyDatabaseConnexion($connexion)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + } + catch (\Exception $e) + { + + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify connection %s : %s", $connexionName, $work_message)); + + $required = array('driver'); + + if (!$connexion->has('driver')) + { + $output->writeln("\nConnection has no driver"); + $this->errors++; + } + elseif ($connexion->get('driver') == 'pdo_mysql') + { + $required = array('driver', 'dbname', 'charset', 'password', 'user', 'port', 'host'); + } + elseif ($connexion->get('driver') == 'pdo_sqlite') + { + $required = array('driver', 'path', 'charset'); + } + else + { + $output->writeln("\nYour driver is not managed"); + $this->errors++; + } + + foreach ($connexion->all() as $conf => $value) + { + switch ($conf) + { + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + case 'charset': + $required = array_diff($required, array($conf)); + $message = 'OK'; + if ($value !== 'UTF8') + { + $message = 'Not recognized'; + $this->alerts++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + case 'path': + $required = array_diff($required, array($conf)); + $message = is_writable(dirname($value)) ? 'OK' : 'Not writeable'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'dbname': + case 'user': + case 'host': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'port': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!ctype_digit($value)) + { + $message = 'Should be ctype_digit'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'password': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $value = '***********'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'driver': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== 'pdo_mysql') + { + $message = 'MySQL recommended'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + protected function verifyDatabaseConnexion(\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag $connexion) + { + try + { + $config = new \Doctrine\DBAL\Configuration(); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connexion->all(), $config); + + return true; + } + catch (\Exception $e) + { + + } + + return false; + } + + private function checkTeamplateEngineService(OutputInterface $output) + { + $templateEngineName = $this->configuration->getTemplating(); + $configuration = $this->configuration->getService($templateEngineName); + + try + { + Core\Service\Builder::create(\bootstrap::getCore(), $configuration); + $work_message = 'Works !'; + } + catch (\Exception $e) + { + $work_message = 'Failed - could not load template engine !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify Template engine %s : %s", $templateEngineName, $work_message)); + + if (!$configuration->has('type')) + { + $output->writeln("\nConfiguration has no type"); + $this->errors++; + } + elseif ($configuration->get('type') == 'TemplateEngine\\Twig') + { + $required = array('debug', 'charset', 'strict_variables', 'autoescape', 'optimizer'); + } + else + { + $output->writeln("\nYour type is not managed"); + $this->errors++; + } + + + + foreach ($configuration->all() as $conf => $value) + { + switch ($conf) + { + case 'type': + $message = 'OK'; + + if ($value !== 'TemplateEngine\\Twig') + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'options': + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, 'unknown', false, 'Not recognized'); + break; + } + } + + foreach ($configuration->get('options') as $conf => $value) + { + switch ($conf) + { + case 'debug'; + case 'strict_variables'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== true) + { + $message = 'Should be false'; + $this->errors++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + case 'autoescape'; + case 'optimizer'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== true) + { + $message = 'Should be true'; + $this->errors++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + case 'charset'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== 'utf-8') + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, "\t" . $conf, $value, false, 'Not recognized'); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + private function checkOrmService(OutputInterface $output) + { + $ormName = $this->configuration->getOrm(); + $configuration = $this->configuration->getService($ormName); + + try + { + $service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration); + $work_message = 'Works !'; + } + catch (\Exception $e) + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify ORM engine %s : %s", $ormName, $work_message)); + + + + if (!$configuration->has('type')) + { + $output->writeln("\nConfiguration has no type"); + $this->errors++; + } + elseif ($configuration->get('type') == 'Orm\\Doctrine') + { + $required = array('debug', 'dbal', 'cache'); + } + else + { + $output->writeln("\nYour type is not managed"); + $this->errors++; + } + + + + foreach ($configuration->all() as $conf => $value) + { + switch ($conf) + { + case 'type': + $message = $value == 'Orm\\Doctrine' ? 'OK' : 'Not recognized'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'options': + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, 'unknown', false, 'Not recognized'); + break; + } + } + + + foreach ($configuration->get('options') as $conf => $value) + { + switch ($conf) + { + case 'log': + $message = 'OK'; + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'cache': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be Array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + + $required_caches = array('query', 'result', 'metadata'); + foreach ($value as $name => $cache_type) + { + $required_caches = array_diff($required_caches, array($name)); + + foreach ($cache_type as $key_cache => $value_cache) + { + switch ($key_cache) + { + case 'service': + if ($this->probeCacheService($output, $value_cache)) + { + $server = $name === 'result'; + if ($this->recommendedCacheService($output, $value_cache, $server)) + { + $work_message = 'Works !'; + } + else + { + $this->errors++; + $work_message = 'No cache required'; + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", $name, $work_message); + + + $this->printConf($output, "\t" . $key_cache, $value_cache, false, $verification); + $this->verifyCacheOptions($output, $value_cache); + break; + default: + $this->alerts++; + $this->printConf($output, "\t" . $key_cache, $value_cache, false, 'Not recognized'); + break; + } + if (!isset($cache_type['service'])) + { + $output->writeln('Miss service for %s', $cache_type); + $this->errors++; + } + } + } + + if (count($required_caches) > 0) + { + $output->writeln(sprintf('Miss required caches %s', implode(', ', $required_caches))); + $this->errors++; + } + break; + case 'debug': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== true) + { + $message = 'Should be true'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'dbal': + $required = array_diff($required, array($conf)); + try + { + $connexion = $this->configuration->getConnexion($value); + $this->verifyDatabaseConnexion($connexion); + $message = 'OK'; + } + catch (\Exception $e) + { + $message = 'Failed'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + protected function verifyCacheOptions(OutputInterface $output, $ServiceName) + { + try + { + $conf = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $conf + ); + } + catch (\Exception $e) + { + return false; + } + + $required_options = array(); + + switch ($Service->getType()) + { + default: + break; + case 'memcache': + $required_options = array('host', 'port'); + break; + } + + if ($required_options) + { + foreach ($conf->get('options') as $conf => $value) + { + switch ($conf) + { + case 'host'; + $required_options = array_diff($required_options, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $this->printConf($output, "\t\t" . $conf, $value, false, $message); + break; + case 'port'; + $required_options = array_diff($required_options, array($conf)); + $message = 'OK'; + + if (!ctype_digit($value)) + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, "\t\t" . $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, "\t\t" . $conf, $value, false, 'Not recognized'); + break; + } + } + } + + if (count($required_options) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required_options))); + $this->errors++; + } + } + + protected function probeCacheService(OutputInterface $output, $ServiceName) + { + try + { + $originalConfiguration = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $originalConfiguration + ); + } + catch (\Exception $e) + { + return false; + } + + if ($Service->getDriver()->isServer()) + { + switch ($Service->getType()) + { + default: + return false; + break; + case 'memcache': + if (!@memcache_connect($Service->getHost(), $Service->getPort())) + { + return false; + } + break; + } + } + + return true; + } + + protected function recommendedCacheService(OutputInterface $output, $ServiceName, $server) + { + try + { + $originalConfiguration = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $originalConfiguration + ); + } + catch (\Exception $e) + { + return false; + } + + return $Service->getType() === 'array'; + } + + private function printConf($output, $scope, $value, $scopage = false, $message = '') + { + if (is_array($value)) + { + foreach ($value as $key => $val) + { + if ($scopage) + $key = $scope . ":" . $key; + $this->printConf($output, $key, $val, $scopage, ''); + } + } + elseif (is_bool($value)) + { + if ($value === false) + { + $value = 'false'; + } + elseif ($value === true) + { + $value = 'true'; + } + $output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message)); + } + elseif (!empty($value)) + { + $output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message)); + } + } + +} diff --git a/lib/classes/module/console/fileEnsureProductionSetting.class.php b/lib/classes/module/console/fileEnsureProductionSetting.class.php new file mode 100644 index 0000000000..3716bb6972 --- /dev/null +++ b/lib/classes/module/console/fileEnsureProductionSetting.class.php @@ -0,0 +1,934 @@ +setDescription('Ensure production settings'); + + $this->addArgument('conf', InputArgument::OPTIONAL, 'The file to check', null); + $this->addOption('strict', 's', InputOption::VALUE_NONE, 'Wheter to fail on alerts or not'); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $specifications = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification(); + + $environnement = $input->getArgument('conf'); + + $this->configuration = \Alchemy\Phrasea\Core\Configuration::build($specifications, $environnement); + + if (!$this->configuration->isInstalled()) + { + $output->writeln(sprintf("\nPhraseanet is not installed\n")); + } + + $this->checkParse($output); + $output->writeln(sprintf("Will Ensure Production Settings on %s", $this->configuration->getEnvironnement())); + + $this->runTests($output); + + $retval = $this->errors; + if ($input->getOption('strict')) + { + $retval += $this->alerts; + } + + if ($retval > 0) + { + $output->writeln("\nSome errors found in your conf"); + } + else + { + $output->writeln("\nYour production settings are setted correctly ! Enjoy"); + } + $output->writeln('End'); + + return $retval; + } + + private function runTests(OutputInterface $output) + { + foreach ($this->testSuite as $test) + { + $display = ""; + switch ($test) + { + case 'checkPhraseanetScope' : + $display = "Phraseanet Configuration"; + break; + case 'checkDatabaseScope' : + $display = "Database"; + break; + case 'checkTeamplateEngineService' : + $display = "Template Engine"; + break; + case 'checkOrmService' : + $display = "ORM"; + break; + case 'checkCacheService' : + $display = "Cache"; + break; + case 'checkOpcodeCacheService' : + $display = "Opcode"; + break; + default: + throw new \Exception('Unknown test'); + break; + } + + $output->writeln(sprintf("\n||| %s", mb_strtoupper($display))); + + call_user_func(array($this, $test), $output); + } + } + + private function checkParse(OutputInterface $output) + { + + if (!$this->configuration->getConfigurations()) + { + throw new \Exception("Unable to load configurations\n"); + } + if (!$this->configuration->getConnexions()) + { + throw new \Exception("Unable to load connexions\n"); + } + if (!$this->configuration->getServices()) + { + throw new \Exception("Unable to load services\n"); + } + + return; + } + + private function checkCacheService(OutputInterface $output) + { + $cache = $this->configuration->getCache(); + + + if ($this->probeCacheService($output, $cache)) + { + if ($this->recommendedCacheService($output, $cache, true)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'Cache server recommended'; + $this->alerts++; + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", 'MainCache', $work_message); + + + $this->printConf($output, "\t" . 'service', $cache, false, $verification); + $this->verifyCacheOptions($output, $cache); + } + + private function checkOpcodeCacheService(OutputInterface $output) + { + $cache = $this->configuration->getOpcodeCache(); + + + if ($this->probeCacheService($output, $cache)) + { + if ($this->recommendedCacheService($output, $cache, false)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'Opcode recommended'; + $this->alerts++; + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", 'OpcodeCache', $work_message); + + + $this->printConf($output, "\t" . 'service', $cache, false, $verification); + $this->verifyCacheOptions($output, $cache); + } + + private function checkPhraseanetScope(OutputInterface $output) + { + $required = array('servername', 'maintenance', 'debug', 'display_errors', 'database'); + + $phraseanet = $this->configuration->getPhraseanet(); + + foreach ($phraseanet->all() as $conf => $value) + { + switch ($conf) + { + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + case 'servername': + $url = $value; + $required = array_diff($required, array($conf)); + + $parseUrl = parse_url($url); + + if (empty($url)) + { + $message = "should not be empty"; + $this->errors++; + } + elseif ($url == 'http://sub.domain.tld/') + { + $this->alerts++; + $message = "may be wrong"; + } + elseif (!filter_var($url, FILTER_VALIDATE_URL)) + { + $message = "not valid"; + $this->errors++; + } + elseif ($parseUrl["scheme"] !== "https") + { + $this->alerts++; + $message = "should be https"; + } + else + { + $message = "OK"; + } + $this->printConf($output, $conf, $value, false, $message); + break; + case 'maintenance': + case 'debug': + case 'display_errors': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== false) + { + $message = 'Should be false'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'database': + $required = array_diff($required, array($conf)); + try + { + $service = $this->configuration->getConnexion($value); + if ($this->verifyDatabaseConnexion($service)) + { + $message = 'OK'; + } + else + { + $message = 'Connection not available'; + $this->errors++; + } + } + catch (\Exception $e) + { + $message = 'Unknown connection'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + private function checkDatabaseScope(OutputInterface $output) + { + $connexionName = $this->configuration->getPhraseanet()->get('database'); + $connexion = $this->configuration->getConnexion($connexionName); + + try + { + if ($this->verifyDatabaseConnexion($connexion)) + { + $work_message = 'Works !'; + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + } + catch (\Exception $e) + { + + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify connection %s : %s", $connexionName, $work_message)); + + $required = array('driver'); + + if (!$connexion->has('driver')) + { + $output->writeln("\nConnection has no driver"); + $this->errors++; + } + elseif ($connexion->get('driver') == 'pdo_mysql') + { + $required = array('driver', 'dbname', 'charset', 'password', 'user', 'port', 'host'); + } + elseif ($connexion->get('driver') == 'pdo_sqlite') + { + $required = array('driver', 'path', 'charset'); + } + else + { + $output->writeln("\nYour driver is not managed"); + $this->errors++; + } + + foreach ($connexion->all() as $conf => $value) + { + switch ($conf) + { + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + case 'charset': + $required = array_diff($required, array($conf)); + $message = 'OK'; + if ($value !== 'UTF8') + { + $message = 'Not recognized'; + $this->alerts++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + case 'path': + $required = array_diff($required, array($conf)); + $message = is_writable(dirname($value)) ? 'OK' : 'Not writeable'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'dbname': + case 'user': + case 'host': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'port': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!ctype_digit($value)) + { + $message = 'Should be ctype_digit'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'password': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $value = '***********'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'driver': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== 'pdo_mysql') + { + $message = 'MySQL recommended'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + protected function verifyDatabaseConnexion(\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag $connexion) + { + try + { + $config = new \Doctrine\DBAL\Configuration(); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connexion->all(), $config); + + return true; + } + catch (\Exception $e) + { + + } + + return false; + } + + private function checkTeamplateEngineService(OutputInterface $output) + { + $templateEngineName = $this->configuration->getTemplating(); + $configuration = $this->configuration->getService($templateEngineName); + + try + { + Core\Service\Builder::create(\bootstrap::getCore(), $configuration); + $work_message = 'Works !'; + } + catch (\Exception $e) + { + $work_message = 'Failed - could not load template engine !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify Template engine %s : %s", $templateEngineName, $work_message)); + + if (!$configuration->has('type')) + { + $output->writeln("\nConfiguration has no type"); + $this->errors++; + } + elseif ($configuration->get('type') == 'TemplateEngine\\Twig') + { + $required = array('debug', 'charset', 'strict_variables', 'autoescape', 'optimizer'); + } + else + { + $output->writeln("\nYour type is not managed"); + $this->errors++; + } + + + + foreach ($configuration->all() as $conf => $value) + { + switch ($conf) + { + case 'type': + $message = 'OK'; + + if($value !== 'TemplateEngine\\Twig') + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'options': + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, 'unknown', false, 'Not recognized'); + break; + } + } + + foreach ($configuration->get('options') as $conf => $value) + { + switch ($conf) + { + case 'debug'; + case 'strict_variables'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== false) + { + $message = 'Should be false'; + $this->errors++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + case 'autoescape'; + case 'optimizer'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== true) + { + $message = 'Should be true'; + $this->errors++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + case 'charset'; + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== 'utf-8') + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, "\t" . $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, "\t" . $conf, $value, false, 'Not recognized'); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + private function checkOrmService(OutputInterface $output) + { + $ormName = $this->configuration->getOrm(); + $configuration = $this->configuration->getService($ormName); + + try + { + $service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration); + $work_message = 'Works !'; + } + catch (\Exception $e) + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $output->writeln(sprintf("\t--> Verify ORM engine %s : %s", $ormName, $work_message)); + + + + if (!$configuration->has('type')) + { + $output->writeln("\nConfiguration has no type"); + $this->errors++; + } + elseif ($configuration->get('type') == 'Orm\\Doctrine') + { + $required = array('debug', 'dbal', 'cache'); + } + else + { + $output->writeln("\nYour type is not managed"); + $this->errors++; + } + + + + foreach ($configuration->all() as $conf => $value) + { + switch ($conf) + { + case 'type': + $message = $value == 'Orm\\Doctrine' ? 'OK' : 'Not recognized'; + $this->printConf($output, $conf, $value, false, $message); + break; + case 'options': + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, 'unknown', false, 'Not recognized'); + break; + } + } + + + foreach ($configuration->get('options') as $conf => $value) + { + switch ($conf) + { + case 'log': + $message = 'OK'; + + if ($value !== false) + { + $message = 'Should be deactivated'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'cache': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if (!is_array($value)) + { + $message = 'Should be Array'; + $this->errors++; + } + + $this->printConf($output, $conf, 'array()', false, $message); + + $required_caches = array('query', 'result', 'metadata'); + foreach ($value as $name => $cache_type) + { + $required_caches = array_diff($required_caches, array($name)); + + foreach ($cache_type as $key_cache => $value_cache) + { + switch ($key_cache) + { + case 'service': + if ($this->probeCacheService($output, $value_cache)) + { + $server = $name === 'result'; + if ($this->recommendedCacheService($output, $value_cache, $server)) + { + $work_message = 'Works !'; + } + else + { + $this->alerts++; + if ($server) + { + $work_message = 'Cache server recommended'; + } + else + { + $work_message = 'Opcode cache recommended'; + } + } + } + else + { + $work_message = 'Failed - could not connect !'; + $this->errors++; + } + + $verification = sprintf("\t--> Verify %s : %s", $name, $work_message); + + + $this->printConf($output, "\t" . $key_cache, $value_cache, false, $verification); + $this->verifyCacheOptions($output, $value_cache); + break; + default: + $this->alerts++; + $this->printConf($output, "\t" . $key_cache, $value_cache, false, 'Not recognized'); + break; + } + if (!isset($cache_type['service'])) + { + $output->writeln('Miss service for %s', $cache_type); + $this->errors++; + } + } + } + + if (count($required_caches) > 0) + { + $output->writeln(sprintf('Miss required caches %s', implode(', ', $required_caches))); + $this->errors++; + } + break; + case 'debug': + $required = array_diff($required, array($conf)); + $message = 'OK'; + + if ($value !== false) + { + $message = 'Should be false'; + $this->errors++; + } + + $this->printConf($output, $conf, $value, false, $message); + break; + case 'dbal': + $required = array_diff($required, array($conf)); + try + { + $connexion = $this->configuration->getConnexion($value); + $this->verifyDatabaseConnexion($connexion); + $message = 'OK'; + } + catch (\Exception $e) + { + $message = 'Failed'; + $this->errors++; + } + $this->printConf($output, $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, $conf, $value, false, 'Not recognized'); + break; + } + } + + if (count($required) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required))); + $this->errors++; + } + + return; + } + + protected function verifyCacheOptions(OutputInterface $output, $ServiceName) + { + try + { + $conf = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $conf + ); + } + catch (\Exception $e) + { + return false; + } + + $required_options = array(); + + switch ($Service->getType()) + { + default: + break; + case 'memcache': + $required_options = array('host', 'port'); + break; + } + + if ($required_options) + { + foreach ($conf->get('options') as $conf => $value) + { + switch ($conf) + { + case 'host'; + $required_options = array_diff($required_options, array($conf)); + $message = 'OK'; + + if (!is_scalar($value)) + { + $message = 'Should be scalar'; + $this->errors++; + } + + $this->printConf($output, "\t\t" . $conf, $value, false, $message); + break; + case 'port'; + $required_options = array_diff($required_options, array($conf)); + $message = 'OK'; + + if (!ctype_digit($value)) + { + $message = 'Not recognized'; + $this->alerts++; + } + + $this->printConf($output, "\t\t" . $conf, $value, false, $message); + break; + default: + $this->alerts++; + $this->printConf($output, "\t\t" . $conf, $value, false, 'Not recognized'); + break; + } + } + } + + if (count($required_options) > 0) + { + $output->writeln(sprintf('Miss required keys %s', implode(', ', $required_options))); + $this->errors++; + } + } + + protected function probeCacheService(OutputInterface $output, $ServiceName) + { + try + { + $originalConfiguration = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $originalConfiguration + ); + } + catch (\Exception $e) + { + return false; + } + + if ($Service->getDriver()->isServer()) + { + switch ($Service->getType()) + { + default: + return false; + break; + case 'memcache': + if (!@memcache_connect($Service->getHost(), $Service->getPort())) + { + return false; + } + break; + } + } + + return true; + } + + protected function recommendedCacheService(OutputInterface $output, $ServiceName, $server) + { + try + { + $originalConfiguration = $this->configuration->getService($ServiceName); + + $Service = Core\Service\Builder::create( + \bootstrap::getCore(), $originalConfiguration + ); + } + catch (\Exception $e) + { + return false; + } + + if ($Service->getType() === 'array') + { + return false; + } + + return $server === $Service->getDriver()->isServer(); + } + + private function printConf($output, $scope, $value, $scopage = false, $message = '') + { + if (is_array($value)) + { + foreach ($value as $key => $val) + { + if ($scopage) + $key = $scope . ":" . $key; + $this->printConf($output, $key, $val, $scopage, ''); + } + } + elseif (is_bool($value)) + { + if ($value === false) + { + $value = 'false'; + } + elseif ($value === true) + { + $value = 'true'; + } + $output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message)); + } + elseif (!empty($value)) + { + $output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message)); + } + } + +} diff --git a/lib/classes/module/console/schedulerStart.class.php b/lib/classes/module/console/schedulerStart.class.php index 8dd81c9ca4..39616efa37 100644 --- a/lib/classes/module/console/schedulerStart.class.php +++ b/lib/classes/module/console/schedulerStart.class.php @@ -1,4 +1,5 @@ writeln('Phraseanet is not set up'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $scheduler = new task_Scheduler(); $scheduler->run($zinput, $output); //, !$input->getOption('nolog'), !$input->getOption('notasklog')); - return; + try + { + $scheduler = new task_Scheduler(); + $scheduler->run($output, true); + } + catch (\Exception $e) + { + return 1; + } } } diff --git a/lib/classes/module/console/schedulerState.class.php b/lib/classes/module/console/schedulerState.class.php index 4861e02224..c0508144fd 100644 --- a/lib/classes/module/console/schedulerState.class.php +++ b/lib/classes/module/console/schedulerState.class.php @@ -24,6 +24,7 @@ use Symfony\Component\Console\Command\Command; class module_console_schedulerState extends Command { + public function __construct($name = null) { parent::__construct($name); @@ -35,26 +36,39 @@ class module_console_schedulerState extends Command public function execute(InputInterface $input, OutputInterface $output) { - if(!setup::is_installed()) + if (!setup::is_installed()) { - throw new RuntimeException('Phraseanet is not set up'); + $output->writeln('Phraseanet is not set up'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; - $appbox = appbox::get_instance(); - $task_manager = new task_manager($appbox); + try + { + $appbox = appbox::get_instance(\bootstrap::getCore()); + $task_manager = new task_manager($appbox); + $state = $task_manager->get_scheduler_state(); + if ($state['schedstatus'] == 'started') + { + $output->writeln(sprintf( + 'Scheduler is %s on pid %d' + , $state['schedstatus'] + , $state['schedpid'] + )); + } + else + { + $output->writeln(sprintf('Scheduler is %s', $state['schedstatus'])); + } - $state = $task_manager->get_scheduler_state(); - - if ($state['schedstatus'] == 'started') - $output->writeln(sprintf( - 'Scheduler is %s on pid %d' - , $state['schedstatus'] - , $state['schedpid'] - )); - else - $output->writeln(sprintf('Scheduler is %s', $state['schedstatus'])); + return 0; + } + catch(\Exception $e) + { + return 1; + } return; } diff --git a/lib/classes/module/console/schedulerStop.class.php b/lib/classes/module/console/schedulerStop.class.php index b806770dd1..8e9c9408c7 100644 --- a/lib/classes/module/console/schedulerStop.class.php +++ b/lib/classes/module/console/schedulerStop.class.php @@ -33,19 +33,30 @@ class module_console_schedulerStop extends Command return $this; } + public function execute(InputInterface $input, OutputInterface $output) { - if(!setup::is_installed()) + if (!setup::is_installed()) { - throw new RuntimeException('Phraseanet is not set up'); + $output->writeln('Phraseanet is not set up'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; - $appbox = appbox::get_instance(); - $task_manager = new task_manager($appbox); + try + { + $appbox = appbox::get_instance(\bootstrap::getCore()); + $task_manager = new task_manager($appbox); + $task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP); - $task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP); + return 0; + } + catch (\Exception $e) + { + return 1; + } return; } diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.class.php b/lib/classes/module/console/sphinxGenerateSuggestion.class.php new file mode 100644 index 0000000000..40133e3559 --- /dev/null +++ b/lib/classes/module/console/sphinxGenerateSuggestion.class.php @@ -0,0 +1,162 @@ +setDescription('Generate suggestions for Sphinx Search Engine'); + + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + define('FREQ_THRESHOLD', 10); + define('SUGGEST_DEBUG', 0); + + $appbox = \appbox::get_instance(\bootstrap::getCore()); + $registry = $appbox->get_registry(); + + $params = phrasea::sbas_params(); + + foreach ($params as $sbas_id => $p) + { + $index = crc32( + str_replace( + array('.', '%') + , '_' + , sprintf('%s_%s_%s_%s', $p['host'], $p['port'], $p['user'], $p['dbname']) + ) + ); + + $tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt'; + + $databox = databox::get_instance($sbas_id); + + $output->writeln("process Databox " . $databox->get_viewname() . " / $index\n"); + + if(!is_executable("/usr/local/bin/indexer")) + { + $output->writeln("'/usr/local/bin/indexer' is not executable"); + + return 1; + } + + if(!file_exists($tmp_file)) + { + $output->writeln(" file '".$tmp_file."' does not exist"); + + return 1; + } + + $cmd = '/usr/local/bin/indexer metadatas' . $index . ' --buildstops ' . $tmp_file . ' 1000000 --buildfreqs'; + exec($cmd); + + try + { + $connbas = connection::getPDOConnection($sbas_id); + } + catch (Exception $e) + { + continue; + } + + $sql = 'TRUNCATE suggest'; + $stmt = $connbas->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = $this->BuildDictionarySQL($output, file_get_contents($tmp_file)); + + if (trim($sql) !== '') + { + $stmt = $connbas->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + } + + unlink($tmp_file); + } + + return 0; + } + + protected function BuildTrigrams($keyword) + { + $t = "__" . $keyword . "__"; + + $trigrams = ""; + for ($i = 0; $i < strlen($t) - 2; $i++) + $trigrams .= substr($t, $i, 3) . " "; + + return $trigrams; + } + + protected function BuildDictionarySQL(OutputInterface $output, $in) + { + $out = ''; + + $n = 0; + $lines = explode("\n", $in); + foreach ($lines as $line) + { + if (trim($line) === '') + continue; + list ( $keyword, $freq ) = explode(" ", trim($line)); + + if ($freq < FREQ_THRESHOLD || strstr($keyword, "_") !== false || strstr($keyword, "'") !== false) + continue; + + if (ctype_digit($keyword)) + { + continue; + } + if (mb_strlen($keyword) < 3) + { + continue; + } + + $trigrams = $this->BuildTrigrams($keyword); + + if ($n++) + $out .= ",\n"; + $out .= "( $n, '$keyword', '$trigrams', $freq )"; + } + + if (trim($out) !== '') + { + $out = "INSERT INTO suggest VALUES " . $out . ";"; + } + + $output->writeln(sprintf("Generated %d suggestions", $n)); + + return $out; + } + +} diff --git a/lib/classes/module/console/systemBackupDB.class.php b/lib/classes/module/console/systemBackupDB.class.php index f477da44c3..5f437c8369 100644 --- a/lib/classes/module/console/systemBackupDB.class.php +++ b/lib/classes/module/console/systemBackupDB.class.php @@ -31,7 +31,7 @@ class module_console_systemBackupDB extends Command $dir = sprintf( '%s/config/' - , dirname(dirname(dirname(dirname(dirname(__FILE__))))) + , dirname(dirname(dirname(dirname(__DIR__)))) ); $this->setDescription('Backup Phraseanet Databases'); @@ -45,23 +45,27 @@ class module_console_systemBackupDB extends Command { if (!setup::is_installed()) { - throw new RuntimeException('Phraseanet is not set up'); + $output->writeln('Argument must be an Id.'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $output->write('Phraseanet is going to be backup...', true); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); - $this->dump_base($appbox, $input, $output); + $ok = true; + + $ok = $this->dump_base($appbox, $input, $output) && $ok; foreach ($appbox->get_databoxes() as $databox) { - $this->dump_base($databox, $input, $output); + $ok = $this->dump_base($databox, $input, $output) && $ok; } - return; + return (int) !$ok; } protected function dump_base(base $base, InputInterface $input, OutputInterface $output) @@ -91,11 +95,19 @@ class module_console_systemBackupDB extends Command system($command); if (file_exists($filename) && filesize($filename) > 0) + { $output->writeln('OK'); + + return true; + } else + { $output->writeln('Failed'); - return; + return false; + } + + } } diff --git a/lib/classes/module/console/systemClearCache.class.php b/lib/classes/module/console/systemClearCache.class.php index 262f20fb83..ebb853dcd0 100644 --- a/lib/classes/module/console/systemClearCache.class.php +++ b/lib/classes/module/console/systemClearCache.class.php @@ -44,10 +44,10 @@ class module_console_systemClearCache extends Command ->exclude('.git') ->exclude('.svn') ->in(array( - dirname(__FILE__) . '/../../../../tmp/cache_minify/' - , dirname(__FILE__) . '/../../../../tmp/cache_twig/' - )) - ; + __DIR__ . '/../../../../tmp/cache_minify/' + , __DIR__ . '/../../../../tmp/cache_twig/' + )); + $count = 1; foreach ($finder as $file) { @@ -59,12 +59,12 @@ class module_console_systemClearCache extends Command $finder ->directories() ->in(array( - dirname(__FILE__) . '/../../../../tmp/cache_minify' - , dirname(__FILE__) . '/../../../../tmp/cache_twig' + __DIR__ . '/../../../../tmp/cache_minify' + , __DIR__ . '/../../../../tmp/cache_twig' )) ->exclude('.git') - ->exclude('.svn') - ; + ->exclude('.svn'); + foreach ($finder as $file) { $dirs[$file->getPathname()] = $file->getPathname(); @@ -83,17 +83,13 @@ class module_console_systemClearCache extends Command if(setup::is_installed()) { - $registry = registry::get_instance(); - $cache = cache_adapter::get_instance($registry); - if($cache->ping()) - { - $cache->flush(); - } + $Core = \bootstrap::getCore(); + $Core['CacheService']->flushAll(); } $output->write('Finished !', true); - return; + return 0; } } diff --git a/lib/classes/module/console/systemConfigCheck.class.php b/lib/classes/module/console/systemConfigCheck.class.php index ea69682c97..8242dd7e59 100644 --- a/lib/classes/module/console/systemConfigCheck.class.php +++ b/lib/classes/module/console/systemConfigCheck.class.php @@ -42,15 +42,17 @@ class module_console_systemConfigCheck extends Command $output->writeln('YOU MUST ENABLE GETTEXT SUPPORT TO USE PHRASEANET'); $output->writeln('Canceled'); - return; + return 1; } + $ok = true; + if (setup::is_installed()) { $registry = registry::get_instance(); $output->writeln(_('*** CHECK BINARY CONFIGURATION ***')); - $this->processConstraints(setup::check_binaries($registry), $output); + $ok = $this->processConstraints(setup::check_binaries($registry), $output) && $ok; $output->writeln(""); } else @@ -58,51 +60,67 @@ class module_console_systemConfigCheck extends Command $registry = new Setup_Registry(); } + + $output->writeln(_('*** FILESYSTEM CONFIGURATION ***')); - $this->processConstraints(setup::check_writability($registry), $output); + $ok = $this->processConstraints(setup::check_writability($registry), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK CACHE OPCODE ***')); - $this->processConstraints(setup::check_cache_opcode(), $output); + $ok = $this->processConstraints(setup::check_cache_opcode(), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK CACHE SERVER ***')); - $this->processConstraints(setup::check_cache_server(), $output); + $ok = $this->processConstraints(setup::check_cache_server(), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK PHP CONFIGURATION ***')); - $this->processConstraints(setup::check_php_configuration(), $output); + $ok = $this->processConstraints(setup::check_php_configuration(), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK PHP EXTENSIONS ***')); - $this->processConstraints(setup::check_php_extension(), $output); + $ok = $this->processConstraints(setup::check_php_extension(), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK PHRASEA ***')); - $this->processConstraints(setup::check_phrasea(), $output); + $ok = $this->processConstraints(setup::check_phrasea(), $output) && $ok; $output->writeln(""); $output->writeln(_('*** CHECK SYSTEM LOCALES ***')); - $this->processConstraints(setup::check_system_locales(), $output); + $ok = $this->processConstraints(setup::check_system_locales(), $output) && $ok; $output->writeln(""); $output->write('Finished !', true); - return; + return (int)!$ok; } protected function processConstraints(Setup_ConstraintsIterator $constraints, OutputInterface &$output) { + $hasError = false; foreach ($constraints as $constraint) { - $this->processConstraint($constraint, $output); + if (!$hasError && !$this->processConstraint($constraint, $output)) + { + $hasError = true; + } } + + return !$hasError; } protected function processConstraint(Setup_Constraint $constraint, OutputInterface &$output) { + $ok = true; if ($constraint->is_ok()) + { $output->writeln("\t\t" . $constraint->get_message() . ''); + } elseif ($constraint->is_blocker()) + { $output->writeln("\t!!!\t" . $constraint->get_message() . ''); + $ok = false; + } else + { $output->writeln("\t/!\\\t" . $constraint->get_message() . ''); + } - return; + return $ok; } } diff --git a/lib/classes/module/console/systemExport.class.php b/lib/classes/module/console/systemExport.class.php new file mode 100644 index 0000000000..55c611388f --- /dev/null +++ b/lib/classes/module/console/systemExport.class.php @@ -0,0 +1,311 @@ +setDescription('Export all phraseanet records to a directory'); + + /** + * To implement + */ +// $this->addOption('useoriginalname', 'o', InputOption::VALUE_OPTIONAL +// , 'Use original name for dest files', false); + + /** + * To implement + */ +// $this->addOption('excludefield', 'f', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY +// , 'Exclude field from XML', array()); + + /** + * To implement + */ +// $this->addOption('excludestatus', '', InputOption::VALUE_OPTIONAL +// , 'Exclude Status', false); + + $this->addOption('docperdir', 'd', InputOption::VALUE_OPTIONAL + , 'Maximum number of files per dir', 100); + + $this->addOption('caption', 'c', InputOption::VALUE_OPTIONAL + , 'Export Caption (XML)', false); + + $this->addOption('limit', 'l', InputOption::VALUE_OPTIONAL + , 'Limit files quantity (for test purposes)', false); + + $this->addOption('base_id', 'b', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY + , 'Restrict on base_ids', array()); + + $this->addOption('sbas_id', 's', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY + , 'Restrict on sbas_ids', array()); + + $this->addArgument('directory', InputOption::VALUE_REQUIRED + , 'The directory where to export'); + + $this->addOption('sanitize', '', InputOption::VALUE_REQUIRED + , 'Sanitize filenames. Set to 0 to disable', true); + + return $this; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $docPerDir = max(1, (int) $input->getOption('docperdir')); + + /** + * + * To implement + * + $useOriginalName = !!$input->getOption('useoriginalname'); + $excludeFields = $input->getOption('excludefield'); + $exportStatus = !$input->getOption('excludestatus'); + * + */ + + $Caption = $input->getOption('caption'); + + $limit = ctype_digit($input->getOption('limit')) ? max(0, (int) $input->getOption('limit')) : false; + + $restrictBaseIds = $input->getOption('base_id'); + + $restrictSbasIds = $input->getOption('sbas_id'); + + $sanitize = $input->getOption('sanitize'); + + + $export_directory = $input->getArgument('directory'); + + if (!$export_directory) + { + throw new Exception('Missing directory argument'); + } + + $export_directory = realpath(substr($export_directory, 0, 1) === '/' ? $export_directory : getcwd() . '/' . $export_directory . '/'); + + if (!$export_directory) + { + throw new Exception('Export directory does not exists or is not accessible'); + } + + if (!is_writable($export_directory)) + { + throw new Exception('Export directory is not writable'); + } + + /** + * Sanitize + */ + foreach ($restrictBaseIds as $key => $base_id) + { + $restrictBaseIds[$key] = (int) $base_id; + } + foreach ($restrictSbasIds as $key => $sbas_id) + { + $restrictSbasIds[$key] = (int) $sbas_id; + } + + + if (count($restrictSbasIds) > 0) + { + $output->writeln("Export datas from selected sbas_ids"); + } + elseif (count($restrictBaseIds) > 0) + { + $output->writeln("Export datas from selected base_ids"); + } + + $appbox = \appbox::get_instance(); + + $total = $errors = 0; + + $unicode = new \unicode(); + + foreach ($appbox->get_databoxes() as $databox) + { + $output->writeln(sprintf("Processing %s", $databox->get_viewname())); + + if (count($restrictSbasIds) > 0 && !in_array($databox->get_sbas_id(), $restrictSbasIds)) + { + $output->writeln(sprintf("Databox not selected, bypassing ...")); + continue; + } + + $go = true; + $coll_ids = array(); + + if (count($restrictBaseIds) > 0) + { + $go = false; + foreach ($databox->get_collections() as $collection) + { + if (in_array($collection->get_base_id(), $restrictBaseIds)) + { + + $go = true; + $coll_ids[] = $collection->get_coll_id(); + } + } + } + + if (!$go) + { + $output->writeln(sprintf("Collections not selected, bypassing ...")); + continue; + } + + $local_export = $export_directory + . '/' . $unicode->remove_nonazAZ09($databox->get_viewname(), true, true) + . '/'; + + system_file::mkdir($local_export); + + $sql = 'SELECT record_id FROM record WHERE parent_record_id = 0 '; + + if (count($coll_ids) > 0) + { + $sql .= ' AND coll_id IN (' . implode(', ', $coll_ids) . ') '; + } + + $sql .= ' ORDER BY record_id ASC '; + + if ($limit) + { + $sql .= ' LIMIT 0, ' . $limit; + } + + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + + $done = 0; + $current_total = count($rs); + $total += $current_total; + $l = strlen((string) $current_total) + 1; + + $dir_format = 'datas%' . strlen((string) ceil($current_total / $docPerDir)) . 'd'; + + $dir_increment = 0; + foreach ($rs as $row) + { + $record = $databox->get_record($row['record_id']); + if (($done % $docPerDir) === 0) + { + $dir_increment++; + $in_dir_files = array(); + $current_dir = $local_export . sprintf($dir_format, $dir_increment) . '/'; + system_file::mkdir($current_dir); + } + + if ($sanitize) + { + $filename = $unicode->remove_nonazAZ09($record->get_original_name(), true, true, true); + } + else + { + $filename = $record->get_original_name(); + } + + $this->generateDefinitiveFilename($in_dir_files, $filename); + + $output_file = $current_dir . $filename; + + if (!$this->processRecords($record, $output_file, $Caption)) + { + $errors++; + } + + $done++; + + $output->write(sprintf("\r#%" . $l . "d record remaining", $current_total - $done)); + } + $output->writeln(" | " . $current_total . " records done\n"); + } + + $output->writeln("$total records done, $errors errors occured"); + + return 0; + } + + protected function generateDefinitiveFilename(array &$existing, &$filename) + { + $definitive_filename = $filename; + $suffix = 2; + while (array_key_exists($definitive_filename, $existing)) + { + $pathinfo = pathinfo($filename); + + $definitive_filename = $pathinfo['filename'] . '_' . $suffix . + (isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : ''); + $suffix++; + } + + $existing[$filename] = $filename; + $filename = $definitive_filename; + + return; + } + + protected function processRecords(\record_adapter $record, $outfile, $caption) + { + + try + { + $file = new system_file($record->get_subdef('document')->get_pathfile()); + } + catch (\Exception_Media_SubdefNotFound $e) + { + return false; + } + + copy($file->getPathname(), $outfile); + + $dest_file = new system_file($outfile); + + touch( + $dest_file->getPathname() + , $record->get_creation_date()->format('U') + , $record->get_modification_date()->format('U') + ); + + switch (strtolower($caption)) + { + case 'xml': + $pathinfo = pathinfo($dest_file->getPathname()); + $xml_file = dirname($outfile) . '/' . $pathinfo['filename'] . '.xml'; + file_put_contents($xml_file, $record->get_xml()); + break; + default: + break; + } + + return true; + } + +} diff --git a/lib/classes/module/console/systemMailCheck.class.php b/lib/classes/module/console/systemMailCheck.class.php index 60449227d4..80fbc28dff 100644 --- a/lib/classes/module/console/systemMailCheck.class.php +++ b/lib/classes/module/console/systemMailCheck.class.php @@ -43,7 +43,7 @@ class module_console_systemMailCheck extends Command public function execute(InputInterface $input, OutputInterface $output) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $output->writeln("Processing..."); @@ -65,7 +65,7 @@ class module_console_systemMailCheck extends Command $output->write('Finished !', true); - return; + return 0; } protected function manage_group($email, $users, $output, $appbox) diff --git a/lib/classes/module/console/systemTemplateGenerator.class.php b/lib/classes/module/console/systemTemplateGenerator.class.php index 5ca41ac1ba..fcd5442011 100644 --- a/lib/classes/module/console/systemTemplateGenerator.class.php +++ b/lib/classes/module/console/systemTemplateGenerator.class.php @@ -36,16 +36,16 @@ class module_console_systemTemplateGenerator extends Command public function execute(InputInterface $input, OutputInterface $output) { - require_once dirname(__FILE__) . '/../../../../lib/vendor/Twig/lib/Twig/Autoloader.php'; - require_once dirname(__FILE__) . '/../../../../lib/vendor/Twig-extensions/lib/Twig/Extensions/Autoloader.php'; + require_once __DIR__ . '/../../../../lib/vendor/Twig/lib/Twig/Autoloader.php'; + require_once __DIR__ . '/../../../../lib/vendor/Twig-extensions/lib/Twig/Extensions/Autoloader.php'; Twig_Autoloader::register(); Twig_Extensions_Autoloader::register(); - $tplDir = dirname(__FILE__) . '/../../../../templates/'; - $tmpDir = dirname(__FILE__) . '/../../../../tmp/cache_twig/'; + $tplDir = __DIR__ . '/../../../../templates/'; + $tmpDir = __DIR__ . '/../../../../tmp/cache_twig/'; $loader = new Twig_Loader_Filesystem($tplDir); $twig = new Twig_Environment($loader, array( @@ -54,7 +54,9 @@ class module_console_systemTemplateGenerator extends Command )); $twig->addExtension(new Twig_Extensions_Extension_I18n()); - + /** + * @todo clean all duplicate filters + */ $twig->addFilter('serialize', new Twig_Filter_Function('serialize')); $twig->addFilter('sbas_names', new Twig_Filter_Function('phrasea::sbas_names')); $twig->addFilter('sbas_name', new Twig_Filter_Function('phrasea::sbas_names')); @@ -78,9 +80,11 @@ class module_console_systemTemplateGenerator extends Command $twig->addFilter('key_exists', new Twig_Filter_Function('array_key_exists')); $twig->addFilter('array_keys', new Twig_Filter_Function('array_keys')); $twig->addFilter('round', new Twig_Filter_Function('round')); + $twig->addFilter('get_class', new Twig_Filter_Function('get_class')); $twig->addFilter('formatdate', new Twig_Filter_Function('phraseadate::getDate')); $twig->addFilter('getPrettyDate', new Twig_Filter_Function('phraseadate::getPrettyString')); $twig->addFilter('prettyDate', new Twig_Filter_Function('phraseadate::getPrettyString')); + $twig->addFilter('prettyString', new Twig_Filter_Function('phraseadate::getPrettyString')); $twig->addFilter('formatoctet', new Twig_Filter_Function('p4string::format_octet')); $twig->addFilter('getDate', new Twig_Filter_Function('phraseadate::getDate')); $twig->addFilter('geoname_name_from_id', new Twig_Filter_Function('geonames::name_from_id')); @@ -118,7 +122,7 @@ class module_console_systemTemplateGenerator extends Command $output->writeln(""); - return; + return $n_error; } } diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php index 553ddd32ea..9c8b24fa95 100644 --- a/lib/classes/module/console/systemUpgrade.class.php +++ b/lib/classes/module/console/systemUpgrade.class.php @@ -1,4 +1,5 @@ writeln('This version of Phraseanet requires a config/config.yml, config/connexion.yml, config/service.yml'); + $output->writeln('Would you like it to be created based on your settings ?'); + + $dialog = $this->getHelperSet()->get('dialog'); + do { - - $output->writeln('This version of Phraseanet requires a config/config.inc'); - $output->writeln('Would you like it to be created based on your settings ?'); - - $dialog = $this->getHelperSet()->get('dialog'); - do - { - $continue = mb_strtolower($dialog->ask($output, '' . _('Create automatically') . ' (Y/n)', 'y')); - } - while (!in_array($continue, array('y', 'n'))); - - if ($continue == 'y') - { - require __DIR__ . "/../../../../config/_GV.php"; - - $datas = 'ask($output, '' . _('Create automatically') . ' (Y/n)', 'y')); } + while (!in_array($continue, array('y', 'n'))); + if ($continue == 'y') + { + try + { + $connexionInc = new \SplFileObject(__DIR__ . '/../../../../config/connexion.inc'); + $configInc = new \SplFileObject(__DIR__ . '/../../../../config/config.inc'); + + $Core->getConfiguration()->upgradeFromOldConf($configInc, $connexionInc); + } + catch (\Exception $e) + { + + } + } + else + { + throw new RuntimeException('Phraseanet is not set up'); + } } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $output->write('Phraseanet is going to be upgraded', true); $dialog = $this->getHelperSet()->get('dialog'); @@ -92,8 +87,9 @@ class module_console_systemUpgrade extends Command { try { + $Core = \bootstrap::getCore(); $output->write('Upgrading...', true); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance($Core); if (count(User_Adapter::get_wrong_email_users($appbox)) > 0) { @@ -101,10 +97,11 @@ class module_console_systemUpgrade extends Command } $upgrader = new Setup_Upgrade($appbox); - $advices = $appbox->forceUpgrade($upgrader); + $advices = $appbox->forceUpgrade($upgrader); } - catch (Exception $e) + catch (\Exception $e) { + $output->writeln(sprintf('An error occured while upgrading : %s ', $e->getMessage())); } } diff --git a/lib/classes/module/console/tasklist.class.php b/lib/classes/module/console/tasklist.class.php index 58fd108ed0..4ec9646b9a 100644 --- a/lib/classes/module/console/tasklist.class.php +++ b/lib/classes/module/console/tasklist.class.php @@ -37,34 +37,45 @@ class module_console_tasklist extends Command public function execute(InputInterface $input, OutputInterface $output) { - if(!setup::is_installed()) + if (!setup::is_installed()) { - throw new RuntimeException('Phraseanet is not set up'); + $output->writeln('Phraseanet is not set up'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; - $appbox = appbox::get_instance(); - $task_manager = new task_manager($appbox); - $tasks = $task_manager->get_tasks(); - - if(count($tasks) === 0) - $output->writeln ('No tasks on your install !'); - - foreach($tasks as $task) + try { - $this->print_task($task, $output); - } + $appbox = appbox::get_instance(\bootstrap::getCore()); + $task_manager = new task_manager($appbox); + $tasks = $task_manager->get_tasks(); - return $this; + if (count($tasks) === 0) + { + $output->writeln('No tasks on your install !'); + } + + foreach ($tasks as $task) + { + $this->print_task($task, $output); + } + + return 0; + } + catch (\Exception $e) + { + return 1; + } } - protected function print_task(task_abstract $task, OutputInterface &$output) { - $message = $task->get_task_id()."\t".($task->get_status() )."\t".$task->get_title(); + $message = $task->get_task_id() . "\t" . ($task->get_status() ) . "\t" . $task->get_title(); $output->writeln($message); return $this; } + } diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index 31714db34a..346127624d 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -67,12 +67,14 @@ class module_console_taskrun extends Command public function execute(InputInterface $input, OutputInterface $output) { - if(!setup::is_installed()) + if (!setup::is_installed()) { - throw new RuntimeException('Phraseanet is not set up'); + $output->writeln('Phraseanet is not set up'); + + return 1; } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $task_id = (int) $input->getArgument('task_id'); @@ -104,8 +106,10 @@ class module_console_taskrun extends Command $this->task->log(sprintf("%s [%d] taskrun : returned from 'run()', get_status()=%s \n", __FILE__, __LINE__, $this->task->get_status())); - return $this; - } + if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL) + { + $runner = task_abstract::RUNNER_MANUAL; + } public function tick_handler() { @@ -131,4 +135,4 @@ $this->task->log(sprintf("%s [%d] taskrun : returned from 'run()', get_status()= } } - \ No newline at end of file + diff --git a/lib/classes/module/prod.class.php b/lib/classes/module/prod.class.php deleted file mode 100644 index 6d010026b2..0000000000 --- a/lib/classes/module/prod.class.php +++ /dev/null @@ -1,172 +0,0 @@ - array(), - 'dates' => array(), - 'fields' => array() - ); - - $bases = $fields = $dates = array(); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $searchSet = $user->getPrefs('search'); - - foreach ($user->ACL()->get_granted_sbas() as $databox) - { - $sbas_id = $databox->get_sbas_id(); - - $bases[$sbas_id] = array( - 'thesaurus' => (trim($databox->get_thesaurus()) != ""), - 'cterms' => false, - 'collections' => array(), - 'sbas_id' => $sbas_id - ); - - foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) - { - $selected = ($searchSet && - isset($searchSet->bases) && - isset($searchSet->bases->$sbas_id)) ? (in_array($coll->get_base_id(), $searchSet->bases->$sbas_id)) : true; - $bases[$sbas_id]['collections'][] = - array( - 'selected' => $selected, - 'base_id' => $coll->get_base_id() - ); - } - - $meta_struct = $databox->get_meta_structure(); - foreach ($meta_struct as $meta) - { - if (!$meta->is_indexable()) - continue; - $id = $meta->get_id(); - $name = $meta->get_name(); - if ($meta->get_type() == 'date') - { - if (isset($dates[$name])) - $dates[$name]['sbas'][] = $sbas_id; - else - $dates[$name] = array('sbas' => array($sbas_id), 'fieldname' => $name); - } - - if (isset($fields[$name])) - { - $fields[$name]['sbas'][] = $sbas_id; - } - else - { - $fields[$name] = array( - 'sbas' => array($sbas_id) - , 'fieldname' => $name - , 'type' => $meta->get_type() - , 'id' => $id - ); - } - } - - if (!$bases[$sbas_id]['thesaurus']) - continue; - if (!$user->ACL()->has_right_on_sbas($sbas_id, 'bas_modif_th')) - continue; - - if (simplexml_load_string($databox->get_cterms())) - { - $bases[$sbas_id]['cterms'] = true; - } - } - - $search_datas['fields'] = $fields; - $search_datas['dates'] = $dates; - $search_datas['bases'] = $bases; - - return $search_datas; - } - - function getLanguage($lng = false) - { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $lng = $lng ? $lng : Session_Handler::get_locale(); - $registry = $appbox->get_registry(); - - $out = array(); - $out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); - $out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?'); - $out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); - $out['serverName'] = $registry->get('GV_ServerName'); - $out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'); - $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); - $out['hideMessage'] = _('phraseanet::Ne plus afficher ce message'); - $out['confirmGroup'] = _('Supprimer egalement les documents rattaches a ces regroupements'); - $out['confirmDelete'] = _('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?'); - $out['cancel'] = _('boutton::annuler'); - $out['deleteTitle'] = _('boutton::supprimer'); - $out['edit_hetero'] = _('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''); - $out['confirm_abandon'] = _('prod::editing::annulation: abandonner les modification ?'); - $out['loading'] = _('phraseanet::chargement'); - $out['valider'] = _('boutton::valider'); - $out['annuler'] = _('boutton::annuler'); - $out['rechercher'] = _('boutton::rechercher'); - $out['renewRss'] = _('boutton::renouveller'); - $out['candeletesome'] = _('Vous n\'avez pas les droits pour supprimer certains documents'); - $out['candeletedocuments'] = _('Vous n\'avez pas les droits pour supprimer ces documents'); - $out['needTitle'] = _('Vous devez donner un titre'); - $out['newPreset'] = _('Nouveau modele'); - $out['fermer'] = _('boutton::fermer'); - $out['feed_require_fields'] = _('Vous n\'avez pas rempli tous les champ requis'); - $out['feed_require_feed'] = _('Vous n\'avez pas selectionne de fil de publication'); - $out['removeTitle'] = _('panier::Supression d\'un element d\'un reportage'); - $out['confirmRemoveReg'] = _('panier::Attention, vous etes sur le point de supprimer un element du reportage. Merci de confirmer votre action.'); - $out['advsearch_title'] = _('phraseanet::recherche avancee'); - $out['bask_rename'] = _('panier:: renommer le panier'); - $out['reg_wrong_sbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre'); - $out['error'] = _('phraseanet:: Erreur'); - $out['warningDenyCgus'] = _('cgus :: Attention, si vous refuser les CGUs de cette base, vous n\'y aures plus acces'); - $out['cgusRelog'] = _('cgus :: Vous devez vous reauthentifier pour que vos parametres soient pris en compte.'); - $out['editDelMulti'] = _('edit:: Supprimer %s du champ dans les records selectionnes'); - $out['editAddMulti'] = _('edit:: Ajouter %s au champ courrant pour les records selectionnes'); - $out['editDelSimple'] = _('edit:: Supprimer %s du champ courrant'); - $out['editAddSimple'] = _('edit:: Ajouter %s au champ courrant'); - $out['cantDeletePublicOne'] = _('panier:: vous ne pouvez pas supprimer un panier public'); - $out['wrongsbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre'); - $out['max_record_selected'] = _('Vous ne pouvez pas selectionner plus de 400 enregistrements'); - $out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez'); - $out['error_test_publi'] = _('Erreur : soit les parametres sont incorrects, soit le serveur distant ne repond pas'); - $out['test_publi_ok'] = _('Les parametres sont corrects, le serveur distant est operationnel'); - $out['some_not_published'] = _('Certaines publications n\'ont pu etre effectuees, verifiez vos parametres'); - $out['error_not_published'] = _('Aucune publication effectuee, verifiez vos parametres'); - $out['warning_delete_publi'] = _('Attention, en supprimant ce preregalge, vous ne pourrez plus modifier ou supprimer de publications prealablement effectues avec celui-ci'); - $out['some_required_fields'] = _('edit::certains documents possedent des champs requis non remplis. Merci de les remplir pour valider votre editing'); - $out['nodocselected'] = _('Aucun document selectionne'); - - return p4string::jsonencode($out); - } - -} diff --git a/lib/classes/module/report.class.php b/lib/classes/module/report.class.php index d052c83597..bcf132578b 100644 --- a/lib/classes/module/report.class.php +++ b/lib/classes/module/report.class.php @@ -245,7 +245,7 @@ class module_report */ public function __construct($d1, $d2, $sbas_id, $collist) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $this->dmin = $d1; $this->dmax = $d2; diff --git a/lib/classes/module/report/activity.class.php b/lib/classes/module/report/activity.class.php index 6411fc531d..ccfb27d58c 100644 --- a/lib/classes/module/report/activity.class.php +++ b/lib/classes/module/report/activity.class.php @@ -341,7 +341,7 @@ class module_report_activity extends module_report $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $login = User_Adapter::getInstance($usr, appbox::get_instance())->get_display_name(); + $login = User_Adapter::getInstance($usr, appbox::get_instance(\bootstrap::getCore()))->get_display_name(); $this->setChamp($rs); ($config) ? $this->setConfigColumn($config) : @@ -453,7 +453,6 @@ class module_report_activity extends module_report $this->result[$i]['total'] += 1; $total['tot_dl'] += 1; - } $nb_row = $i + 1; @@ -479,7 +478,7 @@ class module_report_activity extends module_report * @param string $on choose the field on what you want the result * @return array */ - public function getConnexionBase($tab = false, $on= "") + public function getConnexionBase($tab = false, $on = "") { //default group on user column if (empty($on)) @@ -577,7 +576,7 @@ class module_report_activity extends module_report * @param array $tab config for the html table * @return array */ - public function getDetailDownload($tab = false, $on="") + public function getDetailDownload($tab = false, $on = "") { empty($on) ? $on = "user" : ""; //by default always report on user @@ -638,19 +637,37 @@ class module_report_activity extends module_report foreach ($rs as $row) { $user = $row[$on]; - if (($save_user != $user) && !is_null($user)) + if (($save_user != $user) && !is_null($user) && !empty($user)) + { + if ($i >= 0) + { + if (($this->result[$i]['nbprev'] + $this->result[$i]['nbdoc']) == 0 || ($this->result[$i]['poiddoc'] + $this->result[$i]['poidprev']) == 0) + { + unset($this->result[$i]); + } + + if (isset($this->result[$i]['poiddoc']) && isset($this->result[$i]['poidprev'])) + { + $this->result[$i]['poiddoc'] = p4string::format_octets($this->result[$i]['poiddoc']); + $this->result[$i]['poidprev'] = p4string::format_octets($this->result[$i]['poidprev']); + } + } + + $i++; + + $this->result[$i]['nbprev'] = 0; + $this->result[$i]['poidprev'] = 0; + $this->result[$i]['nbdoc'] = 0; + $this->result[$i]['poiddoc'] = 0; + } + //doc info if ($row['final'] == 'document' && !is_null($user) && !is_null($row['usrid'])) { $this->result[$i]['nbdoc'] = (!is_null($row['nb']) ? $row['nb'] : 0); - $this->result[$i]['poiddoc'] = (!is_null($row['poid']) ? - p4string::format_octets($row['poid']) : 0); - if (!isset($this->result[$i]['nbprev'])) - $this->result[$i]['nbprev'] = 0; - if (!isset($this->result[$i]['poidprev'])) - $this->result[$i]['poidprev'] = 0; + $this->result[$i]['poiddoc'] = (!is_null($row['poid']) ? $row['poid'] : 0); $this->result[$i]['user'] = empty($row[$on]) ? "" . _('report:: non-renseigne') . "" : $row[$on]; $total['nbdoc'] += $this->result[$i]['nbdoc']; @@ -658,26 +675,25 @@ class module_report_activity extends module_report $this->result[$i]['usrid'] = $row['usrid']; } //preview info - if ($row['final'] == 'preview' && + if (($row['final'] == 'preview' || $row['final'] == 'thumbnail') && !is_null($user) && !is_null($row['usrid'])) { - if (!isset($this->result[$i]['nbdoc'])) - $this->result[$i]['nbdoc'] = 0; - if (!isset($this->result[$i]['poiddoc'])) - $this->result[$i]['poiddoc'] = 0; - $this->result[$i]['nbprev'] = (!is_null($row['nb']) ? $row['nb'] : 0); - $this->result[$i]['poidprev'] = (!is_null($row['poid']) ? - p4string::format_octets($row['poid']) : 0); + + $this->result[$i]['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0); + $this->result[$i]['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0); + $this->result[$i]['user'] = empty($row[$on]) ? "" . _('report:: non-renseigne') . "" : $row[$on]; - $total['nbprev'] += $this->result[$i]['nbprev']; + $total['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0); $total['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0); $this->result[$i]['usrid'] = $row['usrid']; } + $save_user = $user; } + unset($this->result[$i]); $nb_row = $i + 1; $this->total = $nb_row; @@ -739,7 +755,7 @@ class module_report_activity extends module_report $this->setChamp($rs); $this->initDefaultConfigColumn($this->champ); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $i = 0; foreach ($rs as $row) diff --git a/lib/classes/module/report/add.class.php b/lib/classes/module/report/add.class.php index 1ddc94fee2..2f8c27828e 100644 --- a/lib/classes/module/report/add.class.php +++ b/lib/classes/module/report/add.class.php @@ -77,7 +77,7 @@ class module_report_add extends module_report $ret = array(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); foreach ($rs as $row) { diff --git a/lib/classes/module/report/dashboard/feed.class.php b/lib/classes/module/report/dashboard/feed.class.php index 5d244a262f..c2d4a5cd90 100644 --- a/lib/classes/module/report/dashboard/feed.class.php +++ b/lib/classes/module/report/dashboard/feed.class.php @@ -66,7 +66,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI */ public static function getInstance($sbasid, $sbas_coll, $dmin, $dmax) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax); try diff --git a/lib/classes/module/report/edit.class.php b/lib/classes/module/report/edit.class.php index ef6b61c4f8..7cbf7fe768 100644 --- a/lib/classes/module/report/edit.class.php +++ b/lib/classes/module/report/edit.class.php @@ -47,7 +47,7 @@ class module_report_edit extends module_report public function __construct($arg1, $arg2, $sbas_id, $collist) { parent::__construct($arg1, $arg2, $sbas_id, $collist); - $this->title = _('report:: document ajoute'); + $this->title = _('report:: edited documents'); } /** @@ -76,7 +76,7 @@ class module_report_edit extends module_report $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $ret = array(); foreach ($rs as $row) diff --git a/lib/classes/module/report/push.class.php b/lib/classes/module/report/push.class.php index 527104e93d..55a1429c87 100644 --- a/lib/classes/module/report/push.class.php +++ b/lib/classes/module/report/push.class.php @@ -47,7 +47,7 @@ class module_report_push extends module_report public function __construct($arg1, $arg2, $sbas_id, $collist) { parent::__construct($arg1, $arg2, $sbas_id, $collist); - $this->title = _('report:: document ajoute'); + $this->title = _('report:: pushed documents'); } /** diff --git a/lib/classes/module/report/sqldownload.class.php b/lib/classes/module/report/sqldownload.class.php index bc54ddccf4..ad65a5f641 100644 --- a/lib/classes/module/report/sqldownload.class.php +++ b/lib/classes/module/report/sqldownload.class.php @@ -70,7 +70,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo $this->sql .= $this->filter->getOrderFilter() ? : ''; -// var_dump(str_replace(array_keys($this->params), array_values($this->params), $this->sql), $this->sql, $this->params); $stmt = $this->connbas->prepare($this->sql); $stmt->execute($this->params); $this->total_row = $stmt->rowCount(); diff --git a/lib/classes/module/report/validate.class.php b/lib/classes/module/report/validate.class.php index 59e417bf40..39927d4af7 100644 --- a/lib/classes/module/report/validate.class.php +++ b/lib/classes/module/report/validate.class.php @@ -47,7 +47,7 @@ class module_report_validate extends module_report public function __construct($arg1, $arg2, $sbas_id, $collist) { parent::__construct($arg1, $arg2, $sbas_id, $collist); - $this->title = _('report:: document ajoute'); + $this->title = _('report:: validated documents'); } /** diff --git a/lib/classes/p4file.class.php b/lib/classes/p4file.class.php index ec485570ed..0f6ba525b7 100644 --- a/lib/classes/p4file.class.php +++ b/lib/classes/p4file.class.php @@ -65,7 +65,7 @@ class p4file public static function archiveFile(system_file &$system_file, $base_id, $delete=true, $name=false) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/lib/classes/patch/320aa.class.php b/lib/classes/patch/320aa.class.php index a3b28f1fe6..5468abc4d5 100644 --- a/lib/classes/patch/320aa.class.php +++ b/lib/classes/patch/320aa.class.php @@ -54,9 +54,9 @@ class patch_320aa implements patchInterface function apply(base &$appbox) { - if(is_file(dirname(__FILE__) . '/../../../config/_GV.php')) - require dirname(__FILE__) . '/../../../config/_GV.php'; - require dirname(__FILE__) . '/../../../lib/conf.d/_GV_template.inc'; + if(is_file(__DIR__ . '/../../../config/_GV.php')) + require __DIR__ . '/../../../config/_GV.php'; + require __DIR__ . '/../../../lib/conf.d/_GV_template.inc'; define('GV_STATIC_URL', ''); define('GV_sphinx', false); diff --git a/lib/classes/patch/320g.class.php b/lib/classes/patch/320h.class.php similarity index 88% rename from lib/classes/patch/320g.class.php rename to lib/classes/patch/320h.class.php index 9b730317e8..1d4866eabf 100644 --- a/lib/classes/patch/320g.class.php +++ b/lib/classes/patch/320h.class.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class patch_320g implements patchInterface +class patch_320h implements patchInterface { /** @@ -54,7 +54,7 @@ class patch_320g implements patchInterface function apply(base &$appbox) { - $sql = 'INSERT INTO bridge_site (id, `type`) VALUES (null, "dailymotion")'; + $sql = 'DELETE FROM basusr WHERE actif = "0"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/360.class.php b/lib/classes/patch/360.class.php new file mode 100644 index 0000000000..186e1427c5 --- /dev/null +++ b/lib/classes/patch/360.class.php @@ -0,0 +1,276 @@ +release; + } + + public function require_all_upgrades() + { + return true; + } + + /** + * + * @return Array + */ + function concern() + { + return $this->concern; + } + + function apply(base &$appbox) + { + $tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'); + + foreach ($tables as $table) + { + $sql = 'DELETE FROM ' . $table; + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + } + + + $stories = array(); + + $sql = 'SELECT sbas_id, rid as record_id, usr_id + FROM ssel + WHERE temporaryType = "1"'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $current = array(); + + foreach ($rs_s as $row_story) + { + $serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id']; + + if (isset($current[$serial])) + { + $stories[] = $row_story; + } + + $current[$serial] = $serial; + } + + $sql = 'DELETE FROM ssel + WHERE temporaryType="1" AND record_id = :record_id + AND usr_id = :usr_id AND sbas_id = :sbas_id'; + $stmt = $appbox->get_connection()->prepare($sql); + + foreach ($stories as $row) + { + $params = array( + ':usr_id' => $row['usr_id'], + ':sbas_id' => $row['sbas_id'], + ':record_id' => $row['record_id'] + ); + $stmt->execute($params); + } + + $stmt->closeCursor(); + + $sql = 'INSERT INTO StoryWZ + ( + SELECT null as id, sbas_id, rid as record_id, usr_id, date as created + FROM ssel + WHERE temporaryType = "1" + )'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = 'INSERT INTO Baskets + ( + SELECT ssel_id as id, name, descript as description, usr_id, 1 as is_read + , pushFrom as pusher_id, + 0 as archived, date as created, updater as updated + FROM ssel + WHERE temporaryType = "0" + )'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + + $sql = 'SELECT ssel_id FROM ssel WHERE temporaryType = "0"'; + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $sselcont_ids = array(); + + foreach ($rs as $row) + { + $sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id + FROM sselcont c, bas b, ssel s + WHERE s.temporaryType = "0" AND b.base_id = c.base_id + AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(array(':ssel_id' => $row['ssel_id'])); + $rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $current = array(); + + foreach ($rs_be as $row_sselcont) + { + $serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id']; + + if (isset($current[$serial])) + { + $sselcont_ids[] = $row_sselcont['sselcont_id']; + } + + $current[$serial] = $serial; + } + } + + $sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id'; + $stmt = $appbox->get_connection()->prepare($sql); + + foreach ($sselcont_ids as $sselcont_id) + { + $stmt->execute(array(':sselcont_id' => $sselcont_id)); + } + + $stmt->closeCursor(); + + $sql = 'INSERT INTO BasketElements + ( + SELECT sselcont_id as id, c.ssel_id as basket_id, record_id, b.sbas_id, c.ord, + s.date as created, s.updater as updated + FROM sselcont c, ssel s, bas b + WHERE temporaryType = "0" AND b.base_id = c.base_id AND s.ssel_id = c.ssel_id + )'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = 'UPDATE Baskets SET pusher_id = NULL WHERE pusher_id = 0'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + + $sql = 'INSERT INTO ValidationSessions + ( + SELECT null as id, v.ssel_id as basket_id ,created_on as created + ,updated_on as updated ,expires_on as expires + ,v.usr_id as initiator_id + FROM ssel s, validate v + WHERE v.ssel_id = s.ssel_id AND v.usr_id = s.usr_id + )'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = 'INSERT INTO ValidationParticipants + ( + SELECT v.id as id, v.usr_id + , 1 AS is_aware, confirmed as is_confirmed, 1 as can_agree + , can_see_others, last_reminder AS reminded + , vs.`id` AS ValidationSession_id + FROM validate v, ssel s, ValidationSessions vs + WHERE s.ssel_id = v.ssel_id AND vs.basket_id = v.ssel_id + )'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + + $sql = 'SELECT usr_id, basket_id, p.id as participant_id + FROM ValidationParticipants p, ValidationSessions s + WHERE p.ValidationSession_Id = s.id'; + + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + + $sql = 'INSERT INTO ValidationDatas ( + SELECT d.id , :participant_id as participant_id, d.sselcont_id, d.agreement, + d.note, d.updated_on as updated + FROM validate v, validate_datas d, sselcont c + WHERE c.sselcont_id = d.sselcont_id AND v.id = d.validate_id + AND v.usr_id = :usr_id AND v.ssel_id = :basket_id + )'; + $stmt = $appbox->get_connection()->prepare($sql); + foreach ($rs as $row) + { + $params = array( + ':participant_id' => $row['participant_id'], + ':basket_id' => $row['basket_id'], + ':usr_id' => $row['usr_id'], + ); + $stmt->execute($params); + } + + $stmt->closeCursor(); + + $sql = 'UPDATE ValidationDatas + SET agreement = NULL where agreement = "0"'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = 'UPDATE ValidationDatas + SET agreement = "0" where agreement = "-1"'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + return true; + } + +} diff --git a/lib/classes/patch/3602.class.php b/lib/classes/patch/3602.class.php new file mode 100644 index 0000000000..150b5d47b6 --- /dev/null +++ b/lib/classes/patch/3602.class.php @@ -0,0 +1,73 @@ +release; + } + + public function require_all_upgrades() + { + return true; + } + + /** + * + * @return Array + */ + function concern() + { + return $this->concern; + } + + function apply(base &$databox) + { + try + { + $sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`'; + + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + } + catch(\PDOException $e) + { + + } + + return true; + } + +} diff --git a/lib/classes/patch/3603.class.php b/lib/classes/patch/3603.class.php new file mode 100644 index 0000000000..5565454fa6 --- /dev/null +++ b/lib/classes/patch/3603.class.php @@ -0,0 +1,68 @@ +release; + } + + public function require_all_upgrades() + { + return true; + } + + /** + * + * @return Array + */ + function concern() + { + return $this->concern; + } + + function apply(base &$appbox) + { + + $sql = 'UPDATE usr SET usr_mail = NULL + WHERE usr_mail IS NOT NULL AND usr_login LIKE "(#deleted%"'; + + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + return true; + } + +} diff --git a/lib/classes/phrasea.class.php b/lib/classes/phrasea.class.php index 985784b7d2..cfc2856d13 100644 --- a/lib/classes/phrasea.class.php +++ b/lib/classes/phrasea.class.php @@ -103,9 +103,19 @@ class phrasea return $retval; } - public static function start() + public static function start(\Alchemy\Phrasea\Core $Core) { - require (dirname(__FILE__) . '/../../config/connexion.inc'); + $configuration = $Core->getConfiguration(); + + $choosenConnexion = $configuration->getPhraseanet()->get('database'); + + $connexion = $configuration->getConnexion($choosenConnexion); + + $hostname = $connexion->get('host'); + $port = $connexion->get('port'); + $user = $connexion->get('user'); + $password = $connexion->get('password'); + $dbname = $connexion->get('dbname'); if (!extension_loaded('phrasea2')) printf("Missing Extension php-phrasea"); @@ -117,7 +127,7 @@ class phrasea function getHome($type='PUBLI', $context='prod') { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); @@ -215,7 +225,7 @@ class phrasea public static function clear_sbas_params() { self::$_sbas_params = null; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache(self::CACHE_SBAS_PARAMS); return true; @@ -227,7 +237,7 @@ class phrasea return self::$_sbas_params; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); try { self::$_sbas_params = $appbox->get_data_from_cache(self::CACHE_SBAS_PARAMS); @@ -263,18 +273,12 @@ class phrasea if (!$usr_id) return false; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $user = User_Adapter::getInstance($usr_id, $appbox); return count($user->ACL()->get_granted_base()) > 0; } - public static function load_events() - { - $events = eventsmanager_broker::getInstance(appbox::get_instance()); - $events->start(); - } - public static function use_i18n($locale, $textdomain = 'phraseanet') { $codeset = "UTF-8"; @@ -283,7 +287,7 @@ class phrasea putenv('LANGUAGE=' . $locale . '.' . $codeset); bind_textdomain_codeset($textdomain, 'UTF-8'); - bindtextdomain($textdomain, dirname(__FILE__) . '/../../locale/'); + bindtextdomain($textdomain, __DIR__ . '/../../locale/'); setlocale(LC_ALL , $locale . '.UTF-8' , $locale . '.UTF8' @@ -321,7 +325,7 @@ class phrasea { if (!self::$_bas2sbas) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); try { self::$_bas2sbas = $appbox->get_data_from_cache(self::CACHE_SBAS_FROM_BAS); @@ -371,7 +375,7 @@ class phrasea public static function reset_baseDatas() { self::$_coll2bas = self::$_bas2coll = self::$_bas_names = self::$_bas2sbas = null; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache( array( self::CACHE_BAS_2_COLL @@ -387,7 +391,7 @@ class phrasea public static function reset_sbasDatas() { self::$_sbas_names = self::$_sbas_params = self::$_bas2sbas = null; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $appbox->delete_data_from_cache( array( self::CACHE_SBAS_NAMES @@ -423,7 +427,7 @@ class phrasea { if (!self::$_sbas_names) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); try { self::$_sbas_names = $appbox->get_data_from_cache(self::CACHE_SBAS_NAMES); @@ -452,7 +456,7 @@ class phrasea { if (!self::$_bas_names) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); try { self::$_bas_names = $appbox->get_data_from_cache(self::CACHE_BAS_NAMES); @@ -492,12 +496,14 @@ class phrasea $request = http_request::getInstance(); if ($request->is_ajax()) { - exit(sprintf('error %d : Content unavailable', (int) $code)); + $Response = new \Symfony\Component\HttpFoundation\Response(sprintf('error %d : Content unavailable', (int) $code), $code); + $Response->send(); + exit(); } else { $request->set_code($code); - include(dirname(__FILE__) . '/../../www/include/error.php'); + include(__DIR__ . '/../../www/include/error.php'); } die(); break; diff --git a/lib/classes/queries.class.php b/lib/classes/queries.class.php index 0b63629061..9dd906eb5b 100644 --- a/lib/classes/queries.class.php +++ b/lib/classes/queries.class.php @@ -20,7 +20,7 @@ class queries public static function tree_topics() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -71,7 +71,7 @@ class queries public static function topics_exists() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -88,7 +88,7 @@ class queries public static function dropdown_topics() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -221,7 +221,7 @@ class queries public static function history() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $conn = $appbox->get_connection(); diff --git a/lib/classes/random.class.php b/lib/classes/random.class.php index 24a615b66f..5a73b0fb31 100644 --- a/lib/classes/random.class.php +++ b/lib/classes/random.class.php @@ -11,18 +11,28 @@ class random { + /** * */ - const NUMBERS = "0123456789"; + + const NUMBERS = "0123456789"; /** * */ - const LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; /** * */ const LETTERS_AND_NUMBERS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const TYPE_FEED_ENTRY = 'FEED_ENTRY'; + const TYPE_PASSWORD = 'password'; + const TYPE_DOWNLOAD = 'download'; + const TYPE_MAIL_DOWNLOAD = 'mail-download'; + const TYPE_EMAIL = 'email'; + const TYPE_VIEW = 'view'; + const TYPE_VALIDATE = 'validate'; + const TYPE_RSS = 'rss'; /** * @@ -34,15 +44,15 @@ class random { $conn = connection::getPDOConnection(); - $date = new DateTime(); - $date = phraseadate::format_mysql($date); + $date = new DateTime(); + $date = phraseadate::format_mysql($date); $registry = registry::get_instance(); - $sql = 'SELECT * FROM tokens WHERE expire_on < :date + $sql = 'SELECT * FROM tokens WHERE expire_on < :date AND datas IS NOT NULL AND (type="download" OR type="email")'; $stmt = $conn->prepare($sql); $stmt->execute(array(':date' => $date)); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) { @@ -57,7 +67,7 @@ class random } } - $sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")'; + $sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")'; $stmt = $conn->prepare($sql); $stmt->execute(array(':date' => $date)); $stmt->closeCursor(); @@ -85,8 +95,8 @@ class random $password = ""; if (!in_array($possible, array(self::LETTERS_AND_NUMBERS, self::LETTERS, self::NUMBERS))) - $possible = self::LETTERS_AND_NUMBERS; - $i = 0; + $possible = self::LETTERS_AND_NUMBERS; + $i = 0; $possible_length = strlen($possible); while ($i < $length) { @@ -106,18 +116,32 @@ class random * @param mixed content $datas * @return boolean */ - public static function getUrlToken($type, $usr, DateTime $end_date = null, $datas='') + public static function getUrlToken($type, $usr, DateTime $end_date = null, $datas = '') { self::cleanTokens(); - $conn = connection::getPDOConnection(); - $token = $test = false; + $conn = connection::getPDOConnection(); + $token = $test = false; - if (!in_array($type, array('password', 'download', 'mail-download', 'email', 'view', 'validate', 'rss'))) - throw new Exception_InvalidArgument(); + switch ($type) + { + case self::TYPE_DOWNLOAD: + case self::TYPE_PASSWORD: + case self::TYPE_MAIL_DOWNLOAD: + case self::TYPE_EMAIL: + case self::TYPE_VALIDATE: + case self::TYPE_VIEW: + case self::TYPE_RSS: + case self::TYPE_FEED_ENTRY: + + break; + default: + throw new Exception_InvalidArgument(); + break; + } $n = 1; - $sql = 'SELECT id FROM tokens WHERE value = :test '; + $sql = 'SELECT id FROM tokens WHERE value = :test '; $stmt = $conn->prepare($sql); while ($n < 100) { @@ -134,16 +158,16 @@ class random if ($token) { - $sql = 'INSERT INTO tokens (id, value, type, usr_id, created_on, expire_on, datas) + $sql = 'INSERT INTO tokens (id, value, type, usr_id, created_on, expire_on, datas) VALUES (null, :token, :type, :usr, NOW(), :end_date, :datas)'; $stmt = $conn->prepare($sql); $params = array( - ':token' => $token - , ':type' => $type - , ':usr' => ($usr ? $usr : '-1') - , ':end_date' => ($end_date instanceof DateTime ? phraseadate::format_mysql($end_date) : null) - , ':datas' => ((trim($datas) != '') ? $datas : null) + ':token' => $token + , ':type' => $type + , ':usr' => ($usr ? $usr : '-1') + , ':end_date' => ($end_date instanceof DateTime ? phraseadate::format_mysql($end_date) : null) + , ':datas' => ((trim($datas) != '') ? $datas : null) ); $stmt->execute($params); $stmt->closeCursor(); @@ -159,7 +183,7 @@ class random try { $conn = connection::getPDOConnection(); - $sql = 'DELETE FROM tokens WHERE value = :token'; + $sql = 'DELETE FROM tokens WHERE value = :token'; $stmt = $conn->prepare($sql); $stmt->execute(array(':token' => $token)); $stmt->closeCursor(); @@ -202,12 +226,12 @@ class random self::cleanTokens(); $conn = connection::getPDOConnection(); - $sql = 'SELECT * FROM tokens + $sql = 'SELECT * FROM tokens WHERE value = :token AND (expire_on > NOW() OR expire_on IS NULL)'; $stmt = $conn->prepare($sql); $stmt->execute(array(':token' => $token)); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if (!$row) diff --git a/lib/classes/record/Interface.class.php b/lib/classes/record/Interface.class.php index 5583384643..69678b155b 100644 --- a/lib/classes/record/Interface.class.php +++ b/lib/classes/record/Interface.class.php @@ -95,8 +95,6 @@ interface record_Interface public function set_binary_status($status); - public function get_reg_name(); - public function get_hd_file(); public function delete(); diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index 8eba74d921..bd8d3323d1 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -369,7 +369,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $dstatus = databox_status::getDisplayStatus(); $sbas_id = $this->get_sbas_id(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); @@ -476,23 +476,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function move_to_collection(collection &$collection, appbox &$appbox) { - $sql = 'UPDATE sselcont - SET base_id = :base_id - WHERE record_id = :record_id - AND base_id IN (SELECT base_id FROM bas WHERE sbas_id = :sbas_id)'; - - $params = array( - ':base_id' => $collection->get_base_id(), - ':record_id' => $this->get_record_id(), - ':sbas_id' => $this->get_sbas_id() - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - basket_adapter::revoke_baskets_record($this, $appbox); - $sql = "UPDATE record SET coll_id = :coll_id WHERE record_id =:record_id"; $params = array( @@ -524,6 +507,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { return null; } + try { return $this->get_subdef('thumbnailGIF'); @@ -613,15 +597,21 @@ class record_adapter implements record_Interface, cache_cacheableInterface public function get_subdef($name) { $name = strtolower($name); + if (!in_array($name, $this->get_available_subdefs())) + { throw new Exception_Media_SubdefNotFound (); + } if (isset($this->subdefs[$name])) - + { return $this->subdefs[$name]; + } if (!$this->subdefs) + { $this->subdefs = array(); + } $substitute = ($name !== 'document'); @@ -757,11 +747,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface if ($data) { if (isset($this->technical_datas[$data])) - + { return $this->technical_datas[$data]; + } else - + { return false; + } } return $this->technical_datas; @@ -801,16 +793,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface foreach ($caption->get_fields() as $field) { - if ($field->is_multi()) - $values = $field->get_value(); - else - $values = array($field->get_value()); + $values = $field->get_values(); foreach ($values as $value) { $elem = $dom_doc->createElement($field->get_name()); - $elem->appendChild($dom_doc->createTextNode($value)); - $elem->setAttribute('meta_id', $field->get_meta_id()); + $elem->appendChild($dom_doc->createTextNode($value->getValue())); + $elem->setAttribute('meta_id', $value->getId()); $elem->setAttribute('meta_struct_id', $field->get_meta_struct_id()); $description->appendChild($elem); } @@ -846,21 +835,39 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $this->original_name = $original_name; - foreach ($this->get_caption()->get_fields() as $field) + foreach ($this->get_databox()->get_meta_structure()->get_elements() as $data_field) { - if ($field->get_databox_field()->get_source() != metadata_description_PHRASEANET_tffilename::get_source()) + if ($data_field->get_metadata_source() != metadata_description_PHRASEANET_tffilename::get_source()) { continue; } - $this->set_metadatas( - array( - 'meta_struct_id' => $field->get_meta_struct_id() - , 'meta_id' => get_meta_id - , 'value' => array($original_name) - ) - , true + /** + * Replacing original name in multi values is non sense + */ + if (!$data_field->is_multi()) + { + continue; + } + + try + { + $field = $this->get_caption()->get_field($data_field->get_name())->get_meta_id(); + $value = array_pop($field->get_values()); + $meta_id = $value->getId(); + } + catch (\Exception $e) + { + $meta_id = null; + } + + $metas = array( + 'meta_struct_id' => $field->get_meta_struct_id() + , 'meta_id' => $meta_id + , 'value' => $original_name ); + + $this->set_metadatas($metas, true); } $sql = 'UPDATE record @@ -886,11 +893,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_title($highlight = false, searchEngine_adapter $searchEngine = null) { - $sbas_id = $this->get_sbas_id(); - $record_id = $this->get_record_id(); - $title = ''; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $fields = $this->get_databox()->get_meta_structure(); @@ -1067,7 +1071,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface try { - $appbox = \appbox::get_instance(); + $appbox = \appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $connbas = connection::getPDOConnection($this->get_sbas_id()); @@ -1185,29 +1189,55 @@ class record_adapter implements record_Interface, cache_cacheableInterface } } - if (!is_array($params['value'])) - throw new Exception(); + if (!is_scalar($params['value'])) + { + throw new Exception('Metadata value should be scalar'); + } $databox_field = databox_field::get_instance($databox, $params['meta_struct_id']); + $caption_field = new caption_field($databox_field, $this); + + $vocab = $vocab_id = null; + + if (isset($params['vocabularyId']) && $databox_field->getVocabularyControl()) + { + try + { + $vocab = $databox_field->getVocabularyControl(); + $vocab_id = $params['vocabularyId']; + $vocab->validate($vocab_id); + } + catch (\Exception $e) + { + $vocab = $vocab_id = null; + } + } + + if (trim($params['meta_id']) !== '') { - $tmp_val = trim(implode('', $params['value'])); - $caption_field = new caption_field($databox_field, $this, $params['meta_id']); + $tmp_val = trim($params['value']); + + $caption_field_value = $caption_field->get_value($params['meta_id']); if ($tmp_val === '') { - $caption_field->delete(); - unset($caption_field); + $caption_field_value->delete(); + unset($caption_field_value); } else { - $caption_field->set_value($params['value']); + $caption_field_value->set_value($params['value']); + if ($vocab && $vocab_id) + { + $caption_field_value->setVocab($vocab, $vocab_id); + } } } else { - $caption_field = caption_field::create($databox_field, $this, $params['value']); + $caption_field_value = caption_Field_Value::create($databox_field, $this, $params['value'], $vocab, $vocab_id); } $this->caption_record = null; @@ -1226,7 +1256,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface foreach ($metadatas as $param) { if (!is_array($param)) - throw new Exception_InvalidArgument(); + { + throw new Exception_InvalidArgument('Invalid metadatas argument'); + } $db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']); @@ -1351,41 +1383,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface return $this; } - /** - * - * @return string - */ - public function get_reg_name() - { - if (!$this->is_grouping()) - - return false; - - $balisename = ''; - - $struct = $this->databox->get_structure(); - - if ($sxe = simplexml_load_string($struct)) - { - $z = $sxe->xpath('/record/description'); - if ($z && is_array($z)) - { - foreach ($z[0] as $ki => $vi) - { - if ($vi['regname'] == '1') - { - $balisename = $ki; - break; - } - } - } - } - $regname = ''; - if ($sxe = simplexml_load_string($this->get_xml())) - $regname = (string) $sxe->description->$balisename; - - return $regname; - } /** * @@ -1447,7 +1444,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface try { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $log_id = $session->get_logger($databox)->get_id(); @@ -1502,8 +1499,48 @@ class record_adapter implements record_Interface, cache_cacheableInterface , ':value' => $value )); } + $stmt->closeCursor(); + foreach ($record->get_databox()->get_meta_structure()->get_elements() as $data_field) + { + if ($data_field->get_metadata_source() != metadata_description_PHRASEANET_tfrecordid::get_source()) + { + + continue; + } + + /** + * Replacing record_id in multi values is non sense + */ + if (!$data_field->is_multi()) + { + continue; + } + + try + { + $field = $record->get_caption()->get_field($data_field->get_name())->get_meta_id(); + $value = array_pop($field->get_values()); + $meta_id = $value->getId(); + } + catch (\Exception $e) + { + $meta_id = null; + } + + $metas = array( + array( + 'meta_struct_id' => $data_field->get_id() + , 'meta_id' => $meta_id + , 'value' => array($record->get_record_id()) + ) + ); + + $record->set_metadatas($metas, true); + } + + return $record; } @@ -1568,7 +1605,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $connbas = $this->get_databox()->get_connection(); $sbas_id = $this->get_databox()->get_sbas_id(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); $conn = $appbox->get_connection(); @@ -1673,21 +1710,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface $stmt->execute(array(':record_id' => $this->get_record_id())); $stmt->closeCursor(); - $sql = 'SELECT s.ssel_id, c.sselcont_id, s.usr_id - FROM sselcont c, ssel s - WHERE c.base_id = :base_id AND c.record_id = :record_id - AND s.ssel_id = c.ssel_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':record_id' => $this->get_record_id(), ':base_id' => $this->get_base_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $em = bootstrap::getCore()->getEntityManager(); - foreach ($rs as $row) + $repository = $em->getRepository('\Entities\BasketElement'); + + /* @var $repository \Repositories\BasketElementRepository */ + foreach ($repository->findElementsByRecord($this) as $basket_element) { - $basket = basket_adapter::getInstance($appbox, $row['ssel_id'], $row['usr_id']); - $basket->remove_from_ssel($row['sselcont_id']); + $em->remove($basket_element); } - $stmt->closeCursor(); + $em->flush(); foreach ($ftodel as $f) @unlink($f); @@ -1807,8 +1840,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_data_from_cache($option = null) { - \cache_databox::refresh($this->get_sbas_id()); - $databox = $this->get_databox(); return $databox->get_data_from_cache($this->get_cache_key($option)); @@ -1895,38 +1926,14 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_container_baskets() { - if ($this->container_basket) + $Core = bootstrap::getCore(); + $em = $Core->getEntityManager(); - return $this->container_basket; + $repo = $em->getRepository('\Entities\Basket'); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + /* @var $$repo \Repositories\BasketRepository */ - $baskets = array(); - $sql = 'SELECT s.ssel_id FROM ssel s, sselcont c - WHERE s.ssel_id = c.ssel_id - AND c.base_id = :base_id AND record_id = :record_id - AND usr_id = :usr_id AND temporaryType="0"'; - - $params = array( - ':base_id' => $this->get_base_id() - , ':record_id' => $this->get_record_id() - , ':usr_id' => $session->get_usr_id() - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $baskets[$row['ssel_id']] = basket_adapter::getInstance($appbox, $row['ssel_id'], $session->get_usr_id()); - } - - $this->container_basket = $baskets; - - return $this->container_basket; + return $repo->findContainingRecordForUser($this, $Core->getAuthenticatedUser()); } /** @@ -1968,7 +1975,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface if (!$this->is_grouping()) throw new Exception('This record is not a grouping'); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $sql = 'SELECT record_id FROM regroup g @@ -2011,7 +2018,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_grouping_parents() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $sql = 'SELECT r.record_id FROM regroup g @@ -2047,4 +2054,87 @@ class record_adapter implements record_Interface, cache_cacheableInterface return $set; } + public function hasChild(\record_adapter $record) + { + return $this->get_children()->offsetExists($record->get_serialize_key()); + } + + public function appendChild(\record_adapter $record) + { + if (!$this->is_grouping()) + throw new \Exception('Only stories can append children'); + + $connbas = $this->get_databox()->get_connection(); + + $ord = 0; + + $sql = "SELECT (max(ord)+1) as ord + FROM regroup WHERE rid_parent = :parent_record_id"; + + $stmt = $connbas->prepare($sql); + + $stmt->execute(array(':parent_record_id' => $this->get_record_id())); + + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + $stmt->closeCursor(); + + if ($row) + { + $ord = is_null($row["ord"]) ? 0 : $row["ord"]; + } + + $sql = 'INSERT INTO regroup (id, rid_parent, rid_child, dateadd, ord) + VALUES (null, :parent_record_id, :record_id, NOW(), :ord)'; + + $params = array( + ':parent_record_id' => $this->get_record_id() + , ':record_id' => $record->get_record_id() + , ':ord' => $ord + ); + + $stmt = $connbas->prepare($sql); + $stmt->execute($params); + + $stmt->closeCursor(); + + $sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id'; + $stmt = $connbas->prepare($sql); + $stmt->execute(array(':record_id' => $this->get_record_id())); + $stmt->closeCursor(); + + $this->delete_data_from_cache(); + + return $this; + } + + public function removeChild(\record_adapter $record) + { + if (!$this->is_grouping()) + throw new \Exception('Only stories can append children'); + + $connbas = $this->get_databox()->get_connection(); + + $sql = "DELETE FROM regroup WHERE rid_parent = :parent_record_id + AND rid_child = :record_id"; + + $params = array( + ':parent_record_id' => $this->get_record_id() + , ':record_id' => $record->get_record_id() + ); + + $stmt = $connbas->prepare($sql); + $stmt->execute($params); + $stmt->closeCursor(); + + $sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id'; + $stmt = $connbas->prepare($sql); + $stmt->execute(array(':record_id' => $this->get_record_id())); + $stmt->closeCursor(); + + $this->delete_data_from_cache(); + + return $this; + } + } diff --git a/lib/classes/record/exportElement.class.php b/lib/classes/record/exportElement.class.php index 37aa9be27a..874b4e59bf 100644 --- a/lib/classes/record/exportElement.class.php +++ b/lib/classes/record/exportElement.class.php @@ -73,7 +73,7 @@ class record_exportElement extends record_adapter $this->downloadable = $downloadable = array(); $this->orderable = $orderable = array(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $sd = $this->get_subdefs(); diff --git a/lib/classes/record/orderElement.class.php b/lib/classes/record/orderElement.class.php index a65004a7cf..bc9623e842 100644 --- a/lib/classes/record/orderElement.class.php +++ b/lib/classes/record/orderElement.class.php @@ -56,7 +56,7 @@ class record_orderElement extends record_adapter { if ($this->order_master_id) { - $user = User_Adapter::getInstance($this->order_master_id, appbox::get_instance()); + $user = User_Adapter::getInstance($this->order_master_id, appbox::get_instance(\bootstrap::getCore())); return $user->get_display_name(); } diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index 3d025bac91..f16e35c5ef 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -86,16 +86,17 @@ class record_preview extends record_adapter * @param boolean $reload_train * @return record_preview */ - public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine =null, $query='') + public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine = null, $query = '') { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); + $Core = bootstrap::getCore(); $number = null; $this->env = $env; switch ($env) { case "RESULT": - $results = $search_engine->query_per_offset($query, (int) ($pos), 1); + $results = $search_engine->query_per_offset($query, (int) ($pos), 1); $mypreview = array(); if ($results->get_datas()->is_empty()) @@ -104,22 +105,22 @@ class record_preview extends record_adapter } foreach ($results->get_datas() as $record) { - $number = $pos; - $sbas_id = $record->get_sbas_id(); + $number = $pos; + $sbas_id = $record->get_sbas_id(); $record_id = $record->get_record_id(); break; } break; case "REG": - $contId = explode('_', $contId); - $sbas_id = $contId[0]; + $contId = explode('_', $contId); + $sbas_id = $contId[0]; $record_id = $contId[1]; $this->container = new record_adapter($sbas_id, $record_id); if ($pos == 0) { $number = 0; - $title = _('preview:: regroupement '); + $title = _('preview:: regroupement '); } else { @@ -127,52 +128,57 @@ class record_preview extends record_adapter $children = $this->container->get_children(); foreach ($children as $child) { - $sbas_id = $child->get_sbas_id(); + $sbas_id = $child->get_sbas_id(); $record_id = $child->get_record_id(); if ($child->get_number() == $pos) break; } - $number = $pos; + $number = $pos; $this->total = $children->get_count(); } break; case "BASK": - $basket = basket_adapter::getInstance($appbox, $contId, $appbox->get_session()->get_usr_id()); + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); - $this->container = $basket; - $this->total = count($basket->get_elements()); + /* @var $repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($contId, $Core->getAuthenticatedUser(), false); + + /* @var $Basket \Entities\Basket */ + $this->container = $Basket; + $this->total = $Basket->getElements()->count(); $i = 0; $first = true; - foreach ($basket->get_elements() as $element) + foreach ($Basket->getElements() as $element) { + /* @var $element \Entities\BasketElement */ $i++; if ($first) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); - $this->name = $basket->get_name(); - $number = $element->get_order(); + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); + $this->name = $Basket->getName(); + $number = $element->getOrd(); } - $first = false; + $first = false; - if ($element->get_order() == $pos) + if ($element->getOrd() == $pos) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); - $this->name = $basket->get_name(); - $number = $element->get_order(); + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); + $this->name = $Basket->getName(); + $number = $element->getOrd(); } } break; case "FEED": $entry = Feed_Entry_Adapter::load_from_id($appbox, $contId); -// $basket = basket_adapter::getInstance($appbox, $contId, $appbox->get_session()->get_usr_id()); $this->container = $entry; $this->total = count($entry->get_content()); - $i = 0; + $i = 0; $first = true; foreach ($entry->get_content() as $element) @@ -180,19 +186,19 @@ class record_preview extends record_adapter $i++; if ($first) { - $sbas_id = $element->get_record()->get_sbas_id(); + $sbas_id = $element->get_record()->get_sbas_id(); $record_id = $element->get_record()->get_record_id(); $this->name = $entry->get_title(); - $number = $element->get_ord(); + $number = $element->get_ord(); } - $first = false; + $first = false; if ($element->get_ord() == $pos) { - $sbas_id = $element->get_record()->get_sbas_id(); + $sbas_id = $element->get_record()->get_sbas_id(); $record_id = $element->get_record()->get_record_id(); $this->name = $entry->get_title(); - $number = $element->get_ord(); + $number = $element->get_ord(); } } break; @@ -202,7 +208,7 @@ class record_preview extends record_adapter return $this; } - public function get_train($pos = 0, $query='', searchEngine_adapter $search_engine=null) + public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null) { if ($this->train) @@ -212,14 +218,14 @@ class record_preview extends record_adapter { case 'RESULT': $perPage = 56; - $index = ($pos - 3) < 0 ? 0 : ($pos - 3); - $page = (int) ceil($pos / $perPage); + $index = ($pos - 3) < 0 ? 0 : ($pos - 3); + $page = (int) ceil($pos / $perPage); $results = $search_engine->query_per_offset($query, $index, $perPage); $this->train = $results->get_datas(); break; case 'BASK': - $this->train = $this->container->get_elements(); + $this->train = $this->container->getElements(); break; case 'REG': $this->train = $this->container->get_children(); @@ -265,7 +271,7 @@ class record_preview extends record_adapter * * @return String */ - public function get_title($highlight = '', searchEngine_adapter $search_engine=null) + public function get_title($highlight = '', searchEngine_adapter $search_engine = null) { if ($this->title) @@ -278,15 +284,15 @@ class record_preview extends record_adapter case "RESULT": $this->title .= sprintf( - _('preview:: resultat numero %s '), '' . ($this->number + 1) - . ' : ' + _('preview:: resultat numero %s '), '' . ($this->number + 1) + . ' : ' ); $this->title .= parent::get_title($highlight, $search_engine); break; case "BASK": $this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine) - . ' (' . $this->get_number() . '/' . $this->total . ') '; + . ' (' . $this->get_number() . '/' . $this->total . ') '; break; case "REG": $title = parent::get_title(); @@ -297,7 +303,7 @@ class record_preview extends record_adapter else { $this->title .= sprintf( - _('%s %d/%d '), $title, $this->get_number() . '/' . $this->total + '%s %s', $title, $this->get_number() . '/' . $this->total ); } break; @@ -325,21 +331,22 @@ class record_preview extends record_adapter public function get_short_history() { if (!is_null($this->short_history)) - + { return $this->short_history; + } $tab = array(); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = appbox::get_instance(\bootstrap::getCore()); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport'); $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site + $sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site FROM log_docs d, log l WHERE d.log_id = l.id AND d.record_id = :record_id '; @@ -349,14 +356,14 @@ class record_preview extends record_adapter { $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $params[':usr_id'] = $session->get_usr_id(); - $params[':site'] = $registry->get('GV_sit'); + $params[':site'] = $registry->get('GV_sit'); } $sql .= 'ORDER BY d.date, usrid DESC'; $stmt = $connsbas->prepare($sql); $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -390,20 +397,20 @@ class record_preview extends record_adapter } $tab[$hour][$site][$action][$row['usr_id']] = - array( - 'final' => array() - , 'comment' => array() - , 'user' => $user + array( + 'final' => array() + , 'comment' => array() + , 'user' => $user ); } if (!in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final'])) $tab[$hour][$site][$action][$row['usr_id']]['final'][] = - $row['final']; + $row['final']; if (!in_array($row['comment'], $tab[$hour][$site][$action][$row['usr_id']]['comment'])) $tab[$hour][$site][$action][$row['usr_id']]['comment'][] = - $row['comment']; + $row['comment']; } $this->short_history = array_reverse($tab); @@ -418,14 +425,16 @@ class record_preview extends record_adapter public function get_view_popularity() { if (!is_null($this->view_popularity)) - + { return $this->view_popularity; - $appbox = appbox::get_instance(); + } + + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $registry = $appbox->get_registry(); if (!$report && !$registry->get('GV_google_api')) @@ -436,16 +445,16 @@ class record_preview extends record_adapter } $views = $dwnls = array(); - $top = 1; - $day = 30; - $min = 0; + $top = 1; + $day = 30; + $min = 0; $average = 0; while ($day >= 0) { - $datetime = new DateTime('-' . $day . ' days'); - $date = date_format($datetime, 'Y-m-d'); + $datetime = new DateTime('-' . $day . ' days'); + $date = date_format($datetime, 'Y-m-d'); $views[$date] = $dwnls[$date] = 0; $day--; } @@ -458,14 +467,14 @@ class record_preview extends record_adapter GROUP BY datee ORDER BY datee ASC'; $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $stmt = $connsbas->prepare($sql); + $stmt = $connsbas->prepare($sql); $stmt->execute( - array( - ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') - ) + array( + ':record_id' => $this->get_record_id(), + ':site' => $registry->get('GV_sit') + ) ); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -473,8 +482,8 @@ class record_preview extends record_adapter if (isset($views[$row['datee']])) { $views[$row['datee']] = (int) $row['views']; - $top = max((int) $row['views'], $top); - $min = isset($min) ? min($row['views'], $min) : $row['views']; + $top = max((int) $row['views'], $top); + $min = isset($min) ? min($row['views'], $min) : $row['views']; $average += $row['views']; } } @@ -482,26 +491,26 @@ class record_preview extends record_adapter $topScale = round($top * 1.2); $average = $average / 30; - $max = round(($top) * 100 / ($topScale)); - $min = round($min * 100 / ($topScale)); + $max = round(($top) * 100 / ($topScale)); + $min = round($min * 100 / ($topScale)); $average = round($average * 100 / ($topScale)); - $width = 350; + $width = 350; $height = 150; - $url = 'http://chart.apis.google.com/chart?' . - 'chs=' . $width . 'x' . $height . - '&chd=t:' . implode(',', $views) . - '&cht=lc' . - '&chf=bg,s,00000000' . - '&chxt=x,y,r' . - '&chds=0,' . $topScale . - '&chls=2.0&chxtc=2,-350' . - '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' - . date_format(new DateTime('-15 days'), 'd M') . '|' - . date_format(new DateTime(), 'd M') . '|1:|0|' - . round($top / 2, 2) . '|' . $top - . '|2:|min|average|max' . - '&chxp=2,' . $min . ',' . $average . ',' . $max; + $url = 'http://chart.apis.google.com/chart?' . + 'chs=' . $width . 'x' . $height . + '&chd=t:' . implode(',', $views) . + '&cht=lc' . + '&chf=bg,s,00000000' . + '&chxt=x,y,r' . + '&chds=0,' . $topScale . + '&chls=2.0&chxtc=2,-350' . + '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' + . date_format(new DateTime('-15 days'), 'd M') . '|' + . date_format(new DateTime(), 'd M') . '|1:|0|' + . round($top / 2, 2) . '|' . $top + . '|2:|min|average|max' . + '&chxp=2,' . $min . ',' . $average . ',' . $max; $this->view_popularity = new media_adapter($url, $width, $height); @@ -516,14 +525,16 @@ class record_preview extends record_adapter public function get_refferer_popularity() { if (!is_null($this->refferer_popularity)) - + { return $this->refferer_popularity; - $appbox = appbox::get_instance(); + } + + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $registry = $appbox->get_registry(); if (!$report && !$registry->get('GV_google_api')) @@ -543,7 +554,7 @@ class record_preview extends record_adapter $stmt = $connsbas->prepare($sql); $stmt->execute(array(':record_id' => $this->get_record_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $referrers = array(); @@ -571,24 +582,24 @@ class record_preview extends record_adapter if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'permalink/') !== false) { if (strpos($row['referrer'], '/view/') !== false) - $row['referrer'] = _('report::presentation page preview'); + $row['referrer'] = _('report::presentation page preview'); else - $row['referrer'] = _('report::acces direct'); + $row['referrer'] = _('report::acces direct'); } if (!isset($referrers[$row['referrer']])) $referrers[$row['referrer']] = 0; $referrers[$row['referrer']] += (int) $row['views']; } - $width = 550; + $width = 550; $height = 100; $url = 'http://chart.apis.google.com/chart?' - . 'cht=p3&chf=bg,s,00000000&chd=t:' - . implode(',', $referrers) - . '&chs=' . $width . 'x' . $height - . '&chl=' - . urlencode(implode('|', array_keys($referrers))) . ''; + . 'cht=p3&chf=bg,s,00000000&chd=t:' + . implode(',', $referrers) + . '&chs=' . $width . 'x' . $height + . '&chl=' + . urlencode(implode('|', array_keys($referrers))) . ''; $this->refferer_popularity = new media_adapter($url, $width, $height); @@ -603,15 +614,17 @@ class record_preview extends record_adapter { if (!is_null($this->download_popularity)) - + { return $this->download_popularity; - $appbox = appbox::get_instance(); + } + + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $registry = $appbox->get_registry(); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $ret = false; if (!$report && !$registry->get('GV_google_api')) @@ -622,16 +635,16 @@ class record_preview extends record_adapter } $views = $dwnls = array(); - $top = 1; - $day = 30; - $min = 0; + $top = 1; + $day = 30; + $min = 0; $average = 0; while ($day >= 0) { - $datetime = new DateTime('-' . $day . ' days'); - $date = date_format($datetime, 'Y-m-d'); + $datetime = new DateTime('-' . $day . ' days'); + $date = date_format($datetime, 'Y-m-d'); $views[$date] = $dwnls[$date] = 0; $day--; } @@ -646,14 +659,14 @@ class record_preview extends record_adapter GROUP BY datee ORDER BY datee ASC'; $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $stmt = $connsbas->prepare($sql); + $stmt = $connsbas->prepare($sql); $stmt->execute( - array( - ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') - ) + array( + ':record_id' => $this->get_record_id(), + ':site' => $registry->get('GV_sit') + ) ); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $top = 10; @@ -663,23 +676,23 @@ class record_preview extends record_adapter if (isset($dwnls[$row['datee']])) { $dwnls[$row['datee']] = (int) $row['dwnl']; - $top = max(((int) $row['dwnl'] + 10), $top); + $top = max(((int) $row['dwnl'] + 10), $top); } } - $width = 250; + $width = 250; $height = 150; - $url = 'http://chart.apis.google.com/chart?' . - 'chs=' . $width . 'x' . $height . - '&chd=t:' . implode(',', $dwnls) . - '&cht=lc' . - '&chf=bg,s,00000000' . - '&chxt=x,y' . - '&chds=0,' . $top . - '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' - . date_format(new DateTime('-15 days'), 'd M') . '|' - . date_format(new DateTime(), 'd M') . '|1:|0|' - . round($top / 2) . '|' . $top . ''; + $url = 'http://chart.apis.google.com/chart?' . + 'chs=' . $width . 'x' . $height . + '&chd=t:' . implode(',', $dwnls) . + '&cht=lc' . + '&chf=bg,s,00000000' . + '&chxt=x,y' . + '&chds=0,' . $top . + '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' + . date_format(new DateTime('-15 days'), 'd M') . '|' + . date_format(new DateTime(), 'd M') . '|1:|0|' + . round($top / 2) . '|' . $top . ''; $ret = new media_adapter($url, $width, $height); $this->download_popularity = $ret; diff --git a/lib/classes/recordutils/image.class.php b/lib/classes/recordutils/image.class.php index dd526b3c15..92bc2fb577 100644 --- a/lib/classes/recordutils/image.class.php +++ b/lib/classes/recordutils/image.class.php @@ -392,7 +392,7 @@ class recordutils_image extends recordutils */ public static function watermark($bas, $rec, $hd=false) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); $sbas_id = phrasea::sbasFromBas($bas); diff --git a/lib/classes/registry.class.php b/lib/classes/registry.class.php index 71c2b8eed8..27691800ac 100644 --- a/lib/classes/registry.class.php +++ b/lib/classes/registry.class.php @@ -20,9 +20,10 @@ class registry implements registryInterface /** * - * @var cache_opcode_adapter + * @var \Alchemy\Phrasea\Cache\Cache */ protected $cache; + /** * * @var registry @@ -41,27 +42,32 @@ class registry implements registryInterface */ public static function get_instance() { - $prefix = crc32(dirname(__FILE__)); if (!self::$_instance instanceof self) - self::$_instance = new self(new cache_opcode_adapter($prefix)); + { + self::$_instance = new self(); + } return self::$_instance; } /** * - * @param cache_opcode_interface $cache + * @param \Alchemy\Phrasea\Cache\Cache $cache * @return registry */ - protected function __construct(cache_opcode_interface $cache) + protected function __construct() { - $this->cache = $cache; + $this->cache = new Alchemy\Phrasea\Cache\ArrayCache(); - require dirname(__FILE__) . '/../../config/config.inc'; - $this->cache->set('GV_RootPath', dirname(dirname(dirname(__FILE__))) . '/'); - $this->cache->set('GV_ServerName', p4string::addEndSlash($servername)); - $this->cache->set('GV_debug', !!$debug); - $this->cache->set('GV_maintenance', !!$maintenance); + $configuration = \Alchemy\Phrasea\Core\Configuration::build(); + + $this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/'); + if ($configuration->isInstalled()) + { + $this->cache->save('GV_ServerName', $configuration->getPhraseanet()->get('servername')); + $this->cache->save('GV_debug', $configuration->isDebug()); + $this->cache->save('GV_maintenance', $configuration->isMaintained()); + } return $this; } @@ -72,7 +78,7 @@ class registry implements registryInterface */ protected function load() { - if ($this->cache->get('registry_loaded') !== true) + if ($this->cache->fetch('registry_loaded') !== true) { $rs = array(); $loaded = false; @@ -110,10 +116,10 @@ class registry implements registryInterface break; } - $this->cache->set($row['key'], $value); + $this->cache->save($row['key'], $value); } if ($loaded === true) - $this->cache->set('registry_loaded', true); + $this->cache->save('registry_loaded', true); } @@ -127,15 +133,15 @@ class registry implements registryInterface */ public function get($key, $defaultvalue = null) { - if (!$this->cache->is_set($key)) + if (!$this->cache->contains($key)) $this->load(); - if(!$this->cache->is_set($key) && !is_null($defaultvalue)) + if (!$this->cache->contains($key) && !is_null($defaultvalue)) return $defaultvalue; else - return $this->cache->get($key); + return $this->cache->fetch($key); } /** @@ -144,17 +150,9 @@ class registry implements registryInterface * @param mixed $value * @return registry */ - public function set($key, $value, $type = 'string') + public function set($key, $value, $type) { $this->load(); - $delete_cache = false; - if ($key === 'GV_cache_server_type') - { - $current_cache = $this->get('GV_cache_server_type'); - if ($current_cache !== $value) - $delete_cache = true; - } - switch ($type) { @@ -186,13 +184,7 @@ class registry implements registryInterface $stmt->execute(array(':key' => $key, ':value' => $sql_value, ':type' => $type)); $stmt->closeCursor(); - $this->cache->set($key, $value); - - if ($delete_cache === true) - { - $cache = cache_adapter::get_instance($this); - $cache->flush(); - } + $this->cache->save($key, $value); return $this; } @@ -206,7 +198,7 @@ class registry implements registryInterface { $this->load(); - return $this->cache->is_set($key); + return $this->cache->contains($key); } /** @@ -224,7 +216,7 @@ class registry implements registryInterface $stmt->execute(array(':key' => $key)); $stmt->closeCursor(); - $this->cache->un_set($key); + $this->cache->delete($key); return $this; } diff --git a/lib/classes/registryInterface.class.php b/lib/classes/registryInterface.class.php index a51833fefb..3b0dfecc8e 100644 --- a/lib/classes/registryInterface.class.php +++ b/lib/classes/registryInterface.class.php @@ -19,7 +19,7 @@ interface registryInterface { public function get($key, $defaultvalue = null); - public function set($key, $value); + public function set($key, $value, $type); public function is_set($key); diff --git a/lib/classes/searchEngine/adapter/phrasea/engine.class.php b/lib/classes/searchEngine/adapter/phrasea/engine.class.php index b8ae74692e..55983f3d75 100644 --- a/lib/classes/searchEngine/adapter/phrasea/engine.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/engine.class.php @@ -247,7 +247,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract $query .= ' AND recordtype=' . $this->opt_record_type; } - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $sql = 'SELECT query, query_time FROM cache WHERE session_id = :ses_id'; @@ -325,7 +325,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract */ public function reset_cache() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); phrasea_clear_cache($session->get_ses_id()); $this->reseted = true; @@ -375,7 +375,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract */ protected function query() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -472,7 +472,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract */ protected function singleParse($sbas) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $this->qp[$sbas] = new searchEngine_adapter_phrasea_queryParser(Session_Handler::get_locale()); $this->qp[$sbas]->debug = false; @@ -504,7 +504,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract $qry .= trim($query); } - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); foreach ($appbox->get_databoxes() as $databox) { @@ -620,7 +620,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract { $ret = array(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $res = phrasea_fetch_results( $session->get_ses_id(), ($record->get_number() + 1), 1, true, "[[em]]", "[[/em]]" @@ -631,7 +631,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract return array(); $rs = $res['results']; $res = array_shift($rs); - if (!$res['xml']) + if (! isset($res['xml'])) return array(); $sxe = simplexml_load_string($res['xml']); @@ -645,7 +645,8 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract { $val[] = str_replace(array('[[em]]', '[[/em]]'), array('', ''), (string) $value); } - $val = implode(' '.$field['separator'].' ', $val); + $separator = $field['separator'] ? $field['separator'][0] : ''; + $val = implode(' '.$separator.' ', $val); } else { diff --git a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php index 09351847ac..2bfcd61aa7 100644 --- a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php @@ -19,73 +19,75 @@ class searchEngine_adapter_phrasea_queryParser { var $ops = array( - "et" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), - "and" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), - "ou" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), - "or" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), - "sauf" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), - "except" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), - "pres" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), - "near" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), - "avant" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), - "before" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), - "apres" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), - "after" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), - "dans" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false), - "in" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false) + "et" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), + "and" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), + "ou" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), + "or" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), + "sauf" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), + "except" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), + "pres" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), + "near" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), + "avant" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), + "before" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), + "apres" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), + "after" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), + "dans" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false), + "in" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false) ); - var $opk = array( - "<" => array("NODETYPE" => PHRASEA_OP_LT, "CANNUM" => false), - ">" => array("NODETYPE" => PHRASEA_OP_GT, "CANNUM" => false), - "<=" => array("NODETYPE" => PHRASEA_OP_LEQT, "CANNUM" => false), - ">=" => array("NODETYPE" => PHRASEA_OP_GEQT, "CANNUM" => false), - "<>" => array("NODETYPE" => PHRASEA_OP_NOTEQU, "CANNUM" => false), - "=" => array("NODETYPE" => PHRASEA_OP_EQUAL, "CANNUM" => false), - ":" => array("NODETYPE" => PHRASEA_OP_COLON, "CANNUM" => false) + var $opk = array( + "<" => array("NODETYPE" => PHRASEA_OP_LT, "CANNUM" => false), + ">" => array("NODETYPE" => PHRASEA_OP_GT, "CANNUM" => false), + "<=" => array("NODETYPE" => PHRASEA_OP_LEQT, "CANNUM" => false), + ">=" => array("NODETYPE" => PHRASEA_OP_GEQT, "CANNUM" => false), + "<>" => array("NODETYPE" => PHRASEA_OP_NOTEQU, "CANNUM" => false), + "=" => array("NODETYPE" => PHRASEA_OP_EQUAL, "CANNUM" => false), + ":" => array("NODETYPE" => PHRASEA_OP_COLON, "CANNUM" => false) ); - var $spw = array( - "all" => array( - "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false - ), - "last" => array( - "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true - ), - // "first" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), - // "premiers" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), - "tout" => array( - "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false - ), - "derniers" => array( - "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true - ) + var $spw = array( + "all" => array( + "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false + ), + "last" => array( + "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true + ), + // "first" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), + // "premiers" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), + "tout" => array( + "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false + ), + "derniers" => array( + "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true + ) ); var $quoted_defaultop = array( - "VALUE" => "default_avant", "NODETYPE" => PHRASEA_OP_BEFORE, "PNUM" => 0 + "VALUE" => "default_avant", "NODETYPE" => PHRASEA_OP_BEFORE, "PNUM" => 0 ); var $defaultop = array( - "VALUE" => "and", "NODETYPE" => PHRASEA_OP_AND, "PNUM" => NULL + "VALUE" => "and", "NODETYPE" => PHRASEA_OP_AND, "PNUM" => NULL ); var $defaultlast = 12; var $phq; - var $errmsg = ""; + var $errmsg = ""; + /** * * @var boolean */ - var $debug = false; + var $debug = false; + /** * un tableau qui contiendra des propositions de thesaurus * pour les termes de l'arbre simple * * @var array */ - var $proposals = Array("QRY" => "", "BASES" => array()); + var $proposals = Array("QRY" => "", "BASES" => array()); + /** * Current language for thesaurus * @var */ var $lng = null; - protected $unicode; function __construct($lng = "???") @@ -117,7 +119,7 @@ class searchEngine_adapter_phrasea_queryParser } } - $this->proposals = Array("QRY" => "", "BASES" => array()); + $this->proposals = Array("QRY" => "", "BASES" => array()); $this->phq = $this->mb_trim($phq, 'UTF-8'); if ($this->phq != "") @@ -178,7 +180,6 @@ class searchEngine_adapter_phrasea_queryParser function astable(&$tree) { $this->calc_complexity($tree); - // var_dump($tree); $txt = ""; $this->astable2($txt, $tree); $txt = "\n\n" . $txt . "\n
      \n"; @@ -199,7 +200,7 @@ class searchEngine_adapter_phrasea_queryParser } } - function astable2(&$out, &$tree, $depth=0) + function astable2(&$out, &$tree, $depth = 0) { switch ($tree["CLASS"]) { @@ -228,7 +229,7 @@ class searchEngine_adapter_phrasea_queryParser break; case "OPS": case "OPK": - $op = $tree["VALUE"]; + $op = $tree["VALUE"]; if (isset($tree["PNUM"])) $op .= "[" . $tree["PNUM"] . "]"; $out .= "\t$op\n"; @@ -246,7 +247,7 @@ class searchEngine_adapter_phrasea_queryParser print("
    \n"); } - function dumpDiv2(&$tree, $depth=0) + function dumpDiv2(&$tree, $depth = 0) { switch ($tree["CLASS"]) { @@ -355,7 +356,7 @@ class searchEngine_adapter_phrasea_queryParser } } - function priority_opk(&$tree, $depth=0) + function priority_opk(&$tree, $depth = 0) { if (!$tree) @@ -363,10 +364,10 @@ class searchEngine_adapter_phrasea_queryParser if ($tree["CLASS"] == "OPK" && ($tree["LB"]["CLASS"] == "OPS" || $tree["LB"]["CLASS"] == "OPK")) { // on a un truc du genre ((a ou b) < 5), on le transforme en (a ou (b < 5)) - $t = $tree["LB"]; + $t = $tree["LB"]; $tree["LB"] = $t["RB"]; - $t["RB"] = $tree; - $tree = $t; + $t["RB"] = $tree; + $tree = $t; } if (isset($tree["LB"])) $this->priority_opk($tree["LB"], $depth + 1); @@ -374,7 +375,7 @@ class searchEngine_adapter_phrasea_queryParser $this->priority_opk($tree["RB"], $depth + 1); } - function distrib_opk(&$tree, $depth=0) + function distrib_opk(&$tree, $depth = 0) { if (!$tree) @@ -382,18 +383,18 @@ class searchEngine_adapter_phrasea_queryParser if ($tree["CLASS"] == "OPK" && ($tree["RB"]["CLASS"] == "OPS")) { // on a un truc du genre (a = (5 ou 6)), on le transforme en ((a = 5) ou (a = 6)) - $tmp = array("CLASS" => $tree["CLASS"], - "NODETYPE" => $tree["NODETYPE"], - "VALUE" => $tree["VALUE"], - "PNUM" => $tree["PNUM"], - "LB" => $tree["LB"], - "RB" => $tree["RB"]["RB"], - "DEPTH" => $tree["LB"]["DEPTH"]); - $t = $tree["RB"]; + $tmp = array("CLASS" => $tree["CLASS"], + "NODETYPE" => $tree["NODETYPE"], + "VALUE" => $tree["VALUE"], + "PNUM" => $tree["PNUM"], + "LB" => $tree["LB"], + "RB" => $tree["RB"]["RB"], + "DEPTH" => $tree["LB"]["DEPTH"]); + $t = $tree["RB"]; $tree["RB"] = $t["LB"]; - $t["LB"] = $tree; - $t["RB"] = $tmp; - $tree = $t; + $t["LB"] = $tree; + $t["RB"] = $tmp; + $tree = $t; } if (isset($tree["LB"])) $this->distrib_opk($tree["LB"], $depth + 1); @@ -461,7 +462,6 @@ class searchEngine_adapter_phrasea_queryParser $copy = $tree; $this->_extendThesaurusOnTerms($tree, $copy, $useFullText, $useThesaurus, $keepfuzzy, 0, ""); - // var_dump($tree); $this->proposals["QRY"] = "" . $this->_queryAsHTML($tree) . ""; return($copy); @@ -474,7 +474,7 @@ class searchEngine_adapter_phrasea_queryParser if (!$useThesaurus) return; // full-text only : inchangé - if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) + if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) { if (isset($tree["CONTEXT"])) $copy = $this->_extendToThesaurus_Simple($tree, false, $keepfuzzy, $path); @@ -488,10 +488,10 @@ class searchEngine_adapter_phrasea_queryParser // on a 'field:value' , on traite 'value' $tree["RB"]["PATH"] = $copy["RB"]["PATH"] = $path . "R"; if (isset($tree["RB"]["CONTEXT"])) - $copy["CONTEXT"] = $tree["CONTEXT"] = $tree["RB"]["CONTEXT"]; + $copy["CONTEXT"] = $tree["CONTEXT"] = $tree["RB"]["CONTEXT"]; else if (!$keepfuzzy) - $copy["CONTEXT"] = $tree["CONTEXT"] = "*"; + $copy["CONTEXT"] = $tree["CONTEXT"] = "*"; $copy["RB"]["SREF"] = &$tree["RB"]; } @@ -522,7 +522,7 @@ class searchEngine_adapter_phrasea_queryParser function _extendToThesaurus_Simple(&$simple, $keepFullText, $keepfuzzy, $path) { $simple["PATH"] = $path; - $context = null; + $context = null; if (isset($simple["CONTEXT"])) { $context = $simple["CONTEXT"]; @@ -531,34 +531,34 @@ class searchEngine_adapter_phrasea_queryParser if ($keepFullText) { // on fait un OU entre la recherche ft et une recherche th - $tmp = array("CLASS" => "OPS", - "NODETYPE" => PHRASEA_OP_OR, - "VALUE" => "OR", - "PNUM" => null, - "DEPTH" => $simple["DEPTH"], - "LB" => $simple, - "RB" => array("CLASS" => "OPK", - "NODETYPE" => PHRASEA_OP_COLON, - "VALUE" => ":", - // "CONTEXT"=>$context, - "PNUM" => null, - "DEPTH" => $simple["DEPTH"] + 1, - "LB" => array("CLASS" => "SIMPLE", - "NODETYPE" => PHRASEA_KEYLIST, - "VALUE" => array("*"), - "DEPTH" => $simple["DEPTH"] + 2 - ), - "RB" => $simple - ) + $tmp = array("CLASS" => "OPS", + "NODETYPE" => PHRASEA_OP_OR, + "VALUE" => "OR", + "PNUM" => null, + "DEPTH" => $simple["DEPTH"], + "LB" => $simple, + "RB" => array("CLASS" => "OPK", + "NODETYPE" => PHRASEA_OP_COLON, + "VALUE" => ":", + // "CONTEXT"=>$context, + "PNUM" => null, + "DEPTH" => $simple["DEPTH"] + 1, + "LB" => array("CLASS" => "SIMPLE", + "NODETYPE" => PHRASEA_KEYLIST, + "VALUE" => array("*"), + "DEPTH" => $simple["DEPTH"] + 2 + ), + "RB" => $simple + ) ); // on vire le contexte du coté fulltext unset($tmp["LB"]["CONTEXT"]); // ajoute le contexte si nécéssaire if ($context !== null) - $tmp["RB"]["CONTEXT"] = $context; + $tmp["RB"]["CONTEXT"] = $context; else if (!$keepfuzzy) - $tmp["RB"]["CONTEXT"] = "*"; + $tmp["RB"]["CONTEXT"] = "*"; // corrige les profondeurs des 2 copies du 'simple' d'origine $tmp["LB"]["DEPTH"] += 1; $tmp["RB"]["RB"]["DEPTH"] += 2; @@ -569,25 +569,25 @@ class searchEngine_adapter_phrasea_queryParser else { // on remplace le ft par du th - $tmp = array("CLASS" => "OPK", - "NODETYPE" => PHRASEA_OP_COLON, - "VALUE" => ":", - // "CONTEXT"=>$context, - "PNUM" => null, - "DEPTH" => $simple["DEPTH"] + 1, - "LB" => array("CLASS" => "SIMPLE", - "NODETYPE" => PHRASEA_KEYLIST, - "VALUE" => array("*"), - "DEPTH" => $simple["DEPTH"] + 1 - ), - "RB" => $simple + $tmp = array("CLASS" => "OPK", + "NODETYPE" => PHRASEA_OP_COLON, + "VALUE" => ":", + // "CONTEXT"=>$context, + "PNUM" => null, + "DEPTH" => $simple["DEPTH"] + 1, + "LB" => array("CLASS" => "SIMPLE", + "NODETYPE" => PHRASEA_KEYLIST, + "VALUE" => array("*"), + "DEPTH" => $simple["DEPTH"] + 1 + ), + "RB" => $simple ); // ajoute le contexte si nécéssaire if ($context !== null) - $tmp["CONTEXT"] = $context; + $tmp["CONTEXT"] = $context; else if (!$keepfuzzy) - $tmp["CONTEXT"] = "*"; + $tmp["CONTEXT"] = "*"; // corrige la profondeur de la copie du 'simple' d'origine $tmp["RB"]["DEPTH"] += 1; // note une référence vers le terme d'origine @@ -598,13 +598,13 @@ class searchEngine_adapter_phrasea_queryParser return($tmp); } - function thesaurus2(&$tree, $bid, $name, &$domthe, $searchsynonyms=true, $depth=0) + function thesaurus2(&$tree, $bid, $name, &$domthe, $searchsynonyms = true, $depth = 0) { if ($this->debug) print("thesaurus2:\n\$tree=" . var_export($tree, true) . "\n"); if ($depth == 0) - $this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array()); + $this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array()); if (!$tree) @@ -625,18 +625,18 @@ class searchEngine_adapter_phrasea_queryParser return($ambigus); } - function propAsHTML(&$node, &$html, $path, $depth=0) + function propAsHTML(&$node, &$html, $path, $depth = 0) { global $parm; if ($depth > 0) { $tsy = array(); $lngfound = "?"; - for ($n = $node->firstChild; $n; $n = $n->nextSibling) + for ($n = $node->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "sy") { - $lng = $n->getAttribute("lng"); + $lng = $n->getAttribute("lng"); if (!array_key_exists($lng, $tsy)) $tsy[$lng] = array(); $zsy = array("v" => $n->getAttribute("v"), "w" => $n->getAttribute("w"), "k" => $n->getAttribute("k")); @@ -644,7 +644,7 @@ class searchEngine_adapter_phrasea_queryParser if ($lngfound == "?" || ($lng == $this->lng && $lngfound != $lng)) { $lngfound = $lng; - $syfound = $zsy; + $syfound = $zsy; } else { @@ -653,7 +653,7 @@ class searchEngine_adapter_phrasea_queryParser $tsy[$lng][] = $zsy; } } - $alt = ""; + $alt = ""; foreach ($tsy as $lng => $tsy2) { foreach ($tsy2 as $sy) @@ -664,8 +664,8 @@ class searchEngine_adapter_phrasea_queryParser } $thtml = $syfound["v"]; - $kjs = $syfound["k"] ? ("'" . p4string::MakeString($syfound["k"], "js") . "'") : "null"; - $wjs = "'" . p4string::MakeString($syfound["w"], "js") . "'"; + $kjs = $syfound["k"] ? ("'" . p4string::MakeString($syfound["k"], "js") . "'") : "null"; + $wjs = "'" . p4string::MakeString($syfound["w"], "js") . "'"; if ($node->getAttribute("term")) { @@ -684,29 +684,27 @@ class searchEngine_adapter_phrasea_queryParser if ($n->nodeType == XML_ELEMENT_NODE && $n->getAttribute("marked")) // only 'te' marked { $lngfound = '?'; - $syfound = '?'; - for ($n2 = $n->firstChild; $n2; $n2 = $n2->nextSibling) + $syfound = '?'; + for ($n2 = $n->firstChild; $n2; $n2 = $n2->nextSibling) { if ($n2->nodeName == 'sy') { $lng = $n2->getAttribute('lng'); if ($lngfound == "?" || ($lng == $this->lng && $lngfound != $lng)) { - $lngfound = $lng; - $syfound = $n2->getAttribute('w'); + $lngfound = $lng; + $syfound = $n2->getAttribute('w'); } } } $n->removeAttribute("marked"); - for ($i = 0; array_key_exists($syfound . $i, $tsort) && $i < 9999; $i++) + for ($i = 0; array_key_exists($syfound . $i, $tsort) && $i < 9999; $i++) ; $tsort[$syfound . $i] = $n; } } ksort($tsort); -// var_dump($tsort); - foreach ($tsort as $n) { $this->propAsHTML($n, $html, $path, $depth + 1); @@ -716,13 +714,11 @@ class searchEngine_adapter_phrasea_queryParser $html .= $tab . "
\n"; } - function _queryAsHTML($tree, $depth=0) + function _queryAsHTML($tree, $depth = 0) { - // printf("astext : "); - // var_dump($tree); if ($depth == 0) { - $ambiguites = array("n" => 0, "refs" => array()); + $ambiguites = array("n" => 0, "refs" => array()); } switch ($tree["CLASS"]) { @@ -734,7 +730,7 @@ class searchEngine_adapter_phrasea_queryParser $path = $tree["PATH"]; if (isset($tree["CONTEXT"])) $w .= ' [' . $tree["CONTEXT"] . ']'; - $txt = '"' . $w . '"'; + $txt = '"' . $w . '"'; } else { @@ -771,68 +767,6 @@ class searchEngine_adapter_phrasea_queryParser } } - /* - function _queryAsHTML($tree, $mouseCallback="void", $depth=0) - { - // printf("astext : "); - // var_dump($tree); - if($depth==0) - { - $ambiguites = array("n"=>0, "refs"=>array()); - } - switch($tree["CLASS"]) - { - case "SIMPLE": - case "QSIMPLE": - $w = is_array($tree["VALUE"]) ? implode(" ", $tree["VALUE"]) : $tree["VALUE"]; - $tab = "\n" . str_repeat("\t", $depth); - if(isset($tree["PATH"])) - { - $path = $tree["PATH"]; - if(isset($tree["CONTEXT"])) - $w .= " [" . $tree["CONTEXT"] . "]"; - $txt = $tab . ""; - $txt .= $tab . "\t\"" . $w . ""; - // $txt .= $tab . "\t\""; - $txt .= "\""; - $txt .= $tab . "\n"; - } - else - { - if(isset($tree["CONTEXT"])) - $w .= "[" . $tree["CONTEXT"] . "]"; - if($tree["CLASS"] == "QSIMPLE") - $txt = $tab . "\"" . $w . "\"\n"; - else - $txt = $tab . "" . $w . "\n"; - } - - return($txt); - break; - case "PHRASEA_KW_ALL": - return($tree["VALUE"][0]); - break; - case "PHRASEA_KW_LAST": - if($tree["PNUM"]!==null) - - return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); - else - - return($tree["VALUE"][0]); - break; - case "OPS": - case "OPK": - if(isset($tree["PNUM"])) - - return("(" . $this->_queryAsHTML($tree["LB"], $mouseCallback, $depth+1) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->_queryAsHTML($tree["RB"], $mouseCallback, $depth+1) . ")"); - else - - return("(" . $this->_queryAsHTML($tree["LB"], $mouseCallback, $depth+1) . " " . $tree["VALUE"] . " " . $this->_queryAsHTML($tree["RB"], $mouseCallback, $depth+1) . ")"); - break; - } - } - */ - function setTids(&$tree, $bid, &$domthe, $searchsynonyms) { if ($this->debug) @@ -841,8 +775,8 @@ class searchEngine_adapter_phrasea_queryParser // $this->proposals["BASES"]["b$bid"] = array("BID"=>$bid, "TERMS"=>array()); $ambigus = 0; - if (is_array($w = $tree["RB"]["VALUE"])) - $t = $w = implode(" ", $w); + if (is_array($w = $tree["RB"]["VALUE"])) + $t = $w = implode(" ", $w); if (isset($tree["CONTEXT"])) { @@ -873,7 +807,7 @@ class searchEngine_adapter_phrasea_queryParser if ($this->debug) printf("searching thesaurus with xpath='%s'
\n", $x); - $dxp = new DOMXPath($domthe); + $dxp = new DOMXPath($domthe); $nodes = $dxp->query($x); if (!isset($tree["RB"]["SREF"]["TIDS"])) @@ -897,7 +831,7 @@ class searchEngine_adapter_phrasea_queryParser $this->addtoTIDS($tree["RB"], $bid, $node); } } - $path = $tree["RB"]["SREF"]["PATH"]; + $path = $tree["RB"]["SREF"]["PATH"]; $prophtml = ""; $this->propAsHTML($domthe->documentElement, $prophtml, $path); $this->proposals["BASES"]["b$bid"]["TERMS"][$path]["HTML"] = $prophtml; @@ -1007,12 +941,12 @@ class searchEngine_adapter_phrasea_queryParser function addtoTIDS(&$extendednode, $bid, $DOMnode) // ajoute un tid en évitant les doublons { - $id = $DOMnode->getAttribute("id"); + $id = $DOMnode->getAttribute("id"); $pid = $DOMnode->parentNode->getAttribute("id"); $lng = $DOMnode->getAttribute("lng"); - $w = $DOMnode->getAttribute("w"); - $k = $DOMnode->getAttribute("k"); - $p = $DOMnode->parentNode->getAttribute("v"); // le terme général (pére) du terme recherché : utile pour la levée d'ambiguité + $w = $DOMnode->getAttribute("w"); + $k = $DOMnode->getAttribute("k"); + $p = $DOMnode->parentNode->getAttribute("v"); // le terme général (pére) du terme recherché : utile pour la levée d'ambiguité $path = $extendednode["SREF"]["PATH"]; if ($this->debug) @@ -1042,7 +976,7 @@ class searchEngine_adapter_phrasea_queryParser } } if (!$found) - $extendednode["SREF"]["TIDS"][] = array("bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p); + $extendednode["SREF"]["TIDS"][] = array("bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p); // on liste les propositions de thésaurus pour ce node (dans l'arbre simple) if (!isset($this->proposals["BASES"]["b$bid"]["TERMS"][$path])) @@ -1060,7 +994,7 @@ class searchEngine_adapter_phrasea_queryParser // on marque le terme principal $DOMnode->parentNode->setAttribute("term", "1"); // on commence par marquer les fils directs. rappel:$DOMnode pointe sur un sy - for ($node = $DOMnode->parentNode->firstChild; $node; $node = $node->nextSibling) + for ($node = $DOMnode->parentNode->firstChild; $node; $node = $node->nextSibling) { if ($node->nodeName == "te") { @@ -1073,30 +1007,27 @@ class searchEngine_adapter_phrasea_queryParser $id = $node->getAttribute("id"); if (!$id) break; // on a dépassé la racine du thésaurus - $node->setAttribute("marked", "1"); -// printf("<%s id='%s'
\n", $node->nodeName, $node->getAttribute("id")); + $node->setAttribute("marked", "1"); } } - function astext_ambigu($tree, &$ambiguites, $mouseCallback="void", $depth=0) + function astext_ambigu($tree, &$ambiguites, $mouseCallback = "void", $depth = 0) { - // printf("astext : "); - // var_dump($tree); if ($depth == 0) { - $ambiguites = array("n" => 0, "refs" => array()); + $ambiguites = array("n" => 0, "refs" => array()); } switch ($tree["CLASS"]) { case "SIMPLE": case "QSIMPLE": - $prelink = $postlink = ""; - $w = is_array($tree["VALUE"]) ? implode(" ", $tree["VALUE"]) : $tree["VALUE"]; - $tab = "\n" . str_repeat("\t", $depth); + $prelink = $postlink = ""; + $w = is_array($tree["VALUE"]) ? implode(" ", $tree["VALUE"]) : $tree["VALUE"]; + $tab = "\n" . str_repeat("\t", $depth); if (isset($tree["TIDS"]) && count($tree["TIDS"]) > 1) { - $ambiguites["refs"][$n = $ambiguites["n"]] = &$tree; - $txt = $tab . ""; + $ambiguites["refs"][$n = $ambiguites["n"]] = &$tree; + $txt = $tab . ""; $txt .= $tab . "\t\"" . $w . ""; $txt .= $tab . "\t\""; $txt .= $tab . "\n"; @@ -1137,7 +1068,7 @@ class searchEngine_adapter_phrasea_queryParser } } - function get_ambigu(&$tree, $mouseCallback="void", $depth=0) + function get_ambigu(&$tree, $mouseCallback = "void", $depth = 0) { if (!$tree) @@ -1155,14 +1086,14 @@ class searchEngine_adapter_phrasea_queryParser if ($depth == 0) { $t_ambiguites = array(); - $r = ($this->astext_ambigu($tree, $t_ambiguites, $mouseCallback)); + $r = ($this->astext_ambigu($tree, $t_ambiguites, $mouseCallback)); $t_ambiguites["query"] = $r; return($t_ambiguites); } } - function set_default(&$tree, &$emptyw, $depth=0) + function set_default(&$tree, &$emptyw, $depth = 0) { if (!$tree) @@ -1202,7 +1133,7 @@ class searchEngine_adapter_phrasea_queryParser } if (is_array($tree["RB"]["VALUE"])) { - $lw = ""; + $lw = ""; foreach ($tree["RB"]["VALUE"] as $w) $lw .= ( $lw == "" ? "" : " ") . $w; $tree["RB"]["VALUE"] = $lw; @@ -1225,8 +1156,8 @@ class searchEngine_adapter_phrasea_queryParser if (is_array($tree["VALUE"])) { $treetmp = null; - $pnum = 0; - for ($i = 0; $i < count($tree["VALUE"]); $i++) + $pnum = 0; + for ($i = 0; $i < count($tree["VALUE"]); $i++) { // gestion mot vide if (isset($emptyw[$tree["VALUE"][$i]]) || $tree["VALUE"][$i] == "?" || $tree["VALUE"][$i] == "*") @@ -1238,35 +1169,35 @@ class searchEngine_adapter_phrasea_queryParser { if ($treetmp == null) { - $treetmp = array("CLASS" => $tree["CLASS"], - "NODETYPE" => $tree["NODETYPE"], - "VALUE" => $tree["VALUE"][$i], - "PNUM" => $tree["PNUM"], - "DEPTH" => $tree["DEPTH"]); - $pnum = 0; + $treetmp = array("CLASS" => $tree["CLASS"], + "NODETYPE" => $tree["NODETYPE"], + "VALUE" => $tree["VALUE"][$i], + "PNUM" => $tree["PNUM"], + "DEPTH" => $tree["DEPTH"]); + $pnum = 0; } else { - $dop = $tree["CLASS"] == "QSIMPLE" ? $this->quoted_defaultop : $this->defaultop; - $treetmp = array("CLASS" => "OPS", - "VALUE" => $dop["VALUE"], - "NODETYPE" => $dop["NODETYPE"], - "PNUM" => $pnum, // peut-être écrasé par defaultop - "DEPTH" => $depth, - "LB" => $treetmp, - "RB" => array("CLASS" => $tree["CLASS"], - "NODETYPE" => $tree["NODETYPE"], - "VALUE" => $tree["VALUE"][$i], - "PNUM" => $tree["PNUM"], - "DEPTH" => $tree["DEPTH"]) + $dop = $tree["CLASS"] == "QSIMPLE" ? $this->quoted_defaultop : $this->defaultop; + $treetmp = array("CLASS" => "OPS", + "VALUE" => $dop["VALUE"], + "NODETYPE" => $dop["NODETYPE"], + "PNUM" => $pnum, // peut-être écrasé par defaultop + "DEPTH" => $depth, + "LB" => $treetmp, + "RB" => array("CLASS" => $tree["CLASS"], + "NODETYPE" => $tree["NODETYPE"], + "VALUE" => $tree["VALUE"][$i], + "PNUM" => $tree["PNUM"], + "DEPTH" => $tree["DEPTH"]) ); if (array_key_exists("PNUM", $dop)) $treetmp["PNUM"] = $dop["PNUM"]; - $pnum = 0; + $pnum = 0; } } } - $tree = $treetmp; + $tree = $treetmp; } } } @@ -1281,18 +1212,16 @@ class searchEngine_adapter_phrasea_queryParser while ($n > 0); } - function factor_or2(&$tree, $depth=0) + function factor_or2(&$tree, $depth = 0) { - // printf("
factor_or depth=%s sur
", $depth); - // var_dump($tree); $nmodif = 0; if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { if ($tree["NODETYPE"] == PHRASEA_OP_OR && ($tree["LB"]["CLASS"] == "SIMPLE" || $tree["LB"]["CLASS"] == "QSIMPLE") && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE")) { - $tree["CLASS"] = "SIMPLE"; + $tree["CLASS"] = "SIMPLE"; $tree["NODETYPE"] = PHRASEA_KEYLIST; - $tree["VALUE"] = is_array($tree["LB"]["VALUE"]) ? $tree["LB"]["VALUE"] : array($tree["LB"]["VALUE"]); + $tree["VALUE"] = is_array($tree["LB"]["VALUE"]) ? $tree["LB"]["VALUE"] : array($tree["LB"]["VALUE"]); if (is_array($tree["RB"]["VALUE"])) { foreach ($tree["RB"]["VALUE"] as $v) @@ -1302,11 +1231,8 @@ class searchEngine_adapter_phrasea_queryParser $tree["VALUE"][] = $tree["RB"]["VALUE"]; unset($tree["LB"]); unset($tree["RB"]); - // unset($tree["NODETYPE"]); unset($tree["PNUM"]); $nmodif++; - // printf("
donne
"); - // var_dump($tree); } else { @@ -1314,13 +1240,12 @@ class searchEngine_adapter_phrasea_queryParser $nmodif += $this->factor_or2($tree["RB"], $depth + 1); } } - // printf("
return %s
", $nmodif); + return($nmodif); } - function setNumValue(&$tree, SimpleXMLElement $sxml_struct, $depth=0) + function setNumValue(&$tree, SimpleXMLElement $sxml_struct, $depth = 0) { - // var_dump($tree); if ($tree["CLASS"] == "OPK") { if (isset($tree["RB"]) && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE") && ($tree["LB"]["CLASS"] == "SIMPLE" || $tree["LB"]["CLASS"] == "QSIMPLE")) @@ -1371,50 +1296,43 @@ class searchEngine_adapter_phrasea_queryParser ## creation branche gauche avec ">=" // print("changeNodeEquals2\n"); // print("creation branche gauche ( '>=' ) \n"); - $newTreeLB = array("CLASS" => "OPK", - "VALUE" => ">=", - "NODETYPE" => PHRASEA_OP_GEQT, - "PNUM" => NULL, - "DEPTH" => 0, - "LB" => $oneBranch["LB"], - "RB" => array("CLASS" => "SIMPLE", - "VALUE" => $this->isoDate($oneBranch["RB"]["VALUE"], false), - "NODETYPE" => PHRASEA_KEYLIST, - "PNUM" => NULL, - "DEPTH" => 0) + $newTreeLB = array("CLASS" => "OPK", + "VALUE" => ">=", + "NODETYPE" => PHRASEA_OP_GEQT, + "PNUM" => NULL, + "DEPTH" => 0, + "LB" => $oneBranch["LB"], + "RB" => array("CLASS" => "SIMPLE", + "VALUE" => $this->isoDate($oneBranch["RB"]["VALUE"], false), + "NODETYPE" => PHRASEA_KEYLIST, + "PNUM" => NULL, + "DEPTH" => 0) ); -// var_dump($newTreeLB); -// print("fin creation branche gauche ( '>=' ) \n"); - ## fin creation branche gauche ( ">=" ) - ## creation branche droite avec "<=" -// print("creation branche droite avec '<=' \n"); - $newTreeRB = array("CLASS" => "OPK", - "VALUE" => "<=", - "NODETYPE" => PHRASEA_OP_LEQT, - "PNUM" => NULL, - "DEPTH" => 0, - "LB" => $oneBranch["LB"], - "RB" => array("CLASS" => "SIMPLE", - "VALUE" => $this->isoDate($oneBranch["RB"]["VALUE"], true), - "NODETYPE" => PHRASEA_KEYLIST, - "PNUM" => NULL, - "DEPTH" => 0) + + $newTreeRB = array("CLASS" => "OPK", + "VALUE" => "<=", + "NODETYPE" => PHRASEA_OP_LEQT, + "PNUM" => NULL, + "DEPTH" => 0, + "LB" => $oneBranch["LB"], + "RB" => array("CLASS" => "SIMPLE", + "VALUE" => $this->isoDate($oneBranch["RB"]["VALUE"], true), + "NODETYPE" => PHRASEA_KEYLIST, + "PNUM" => NULL, + "DEPTH" => 0) ); -// var_dump($newTreeRB); // print("fin creation branche droite avec '<=' \n"); ## fin creation branche droite ( "<=" ) - $tree = array("CLASS" => "OPS", - "VALUE" => "et", - "NODETYPE" => PHRASEA_OP_AND, - "PNUM" => NULL, - "DEPTH" => 0, - "LB" => $newTreeLB, - "RB" => $newTreeRB); + $tree = array("CLASS" => "OPS", + "VALUE" => "et", + "NODETYPE" => PHRASEA_OP_AND, + "PNUM" => NULL, + "DEPTH" => 0, + "LB" => $newTreeLB, + "RB" => $newTreeRB); - // et on le retourne -// var_dump($tree); return $tree; } @@ -1422,23 +1340,23 @@ class searchEngine_adapter_phrasea_queryParser { if (strtoupper($type) == strtoupper("Date")) { - $dateEnIso = $this->isoDate($branch["VALUE"]); + $dateEnIso = $this->isoDate($branch["VALUE"]); $branch["VALUE"] = $dateEnIso; } } - function isoDate($onedate, $max=false) + function isoDate($onedate, $max = false) { $v_y = "1900"; $v_m = "01"; $v_d = "01"; - $v_h = $v_minutes = $v_s = "00"; + $v_h = $v_minutes = $v_s = "00"; if ($max) { - $v_h = $v_minutes = $v_s = "99"; + $v_h = $v_minutes = $v_s = "99"; } - $tmp = $onedate; + $tmp = $onedate; if (!is_array($tmp)) $tmp = explode(" ", $tmp); @@ -1519,31 +1437,31 @@ class searchEngine_adapter_phrasea_queryParser { case 14 : // date iso YYYYMMDDHHMMSS - $v_y = substr($tmp[0], 0, 4); - $v_m = substr($tmp[0], 4, 2); - $v_d = substr($tmp[0], 6, 2); - $v_h = substr($tmp[0], 8, 2); + $v_y = substr($tmp[0], 0, 4); + $v_m = substr($tmp[0], 4, 2); + $v_d = substr($tmp[0], 6, 2); + $v_h = substr($tmp[0], 8, 2); $v_minutes = substr($tmp[0], 10, 2); - $v_s = substr($tmp[0], 12, 2); + $v_s = substr($tmp[0], 12, 2); break; case 8 : // date iso YYYYMMDD - $v_y = substr($tmp[0], 0, 4); - $v_m = substr($tmp[0], 4, 2); - $v_d = substr($tmp[0], 6, 2); + $v_y = substr($tmp[0], 0, 4); + $v_m = substr($tmp[0], 4, 2); + $v_d = substr($tmp[0], 6, 2); break; case 6 : // date iso YYYYMM - $v_y = substr($tmp[0], 0, 4); - $v_m = substr($tmp[0], 4, 2); + $v_y = substr($tmp[0], 0, 4); + $v_m = substr($tmp[0], 4, 2); if ($max) - $v_d = "99"; + $v_d = "99"; else - $v_d = "00"; + $v_d = "00"; break; case 4 : // date iso YYYY - $v_y = $tmp[0]; + $v_y = $tmp[0]; if ($max) $v_m = "99"; @@ -1582,11 +1500,9 @@ class searchEngine_adapter_phrasea_queryParser return("" . $v_y . $v_m . $v_d . $v_h . $v_minutes . $v_s); } - function distrib_in(&$tree, $depth=0) + function distrib_in(&$tree, $depth = 0) { $opdistrib = array(PHRASEA_OP_AND, PHRASEA_OP_OR, PHRASEA_OP_EXCEPT, PHRASEA_OP_NEAR, PHRASEA_OP_BEFORE, PHRASEA_OP_AFTER); // ces opérateurs sont 'distribuables' autour d'un 'IN' - // printf("
distrib_in depth=%s sur
", $depth); - // var_dump($tree); if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { @@ -1606,25 +1522,24 @@ class searchEngine_adapter_phrasea_queryParser $m_o = $tree["NODETYPE"]; $m_n = $tree["PNUM"]; - $tree["CLASS"] = $tree["LB"]["CLASS"]; + $tree["CLASS"] = $tree["LB"]["CLASS"]; $tree["NODETYPE"] = $tree["LB"]["NODETYPE"]; - $tree["VALUE"] = $tree["LB"]["VALUE"]; - $tree["PNUM"] = $tree["LB"]["PNUM"]; + $tree["VALUE"] = $tree["LB"]["VALUE"]; + $tree["PNUM"] = $tree["LB"]["PNUM"]; - $tree["LB"]["CLASS"] = $m_t; + $tree["LB"]["CLASS"] = $m_t; $tree["LB"]["NODETYPE"] = $m_o; - $tree["LB"]["VALUE"] = $m_v; - $tree["LB"]["PNUM"] = $m_n; + $tree["LB"]["VALUE"] = $m_v; + $tree["LB"]["PNUM"] = $m_n; - $tree["RB"] = array("CLASS" => $m_t, - "NODETYPE" => $m_o, - "VALUE" => $m_v, - "PNUM" => $m_n, - "LB" => $tree["LB"]["RB"], - "RB" => $tree["RB"]); + $tree["RB"] = array("CLASS" => $m_t, + "NODETYPE" => $m_o, + "VALUE" => $m_v, + "PNUM" => $m_n, + "LB" => $tree["LB"]["RB"], + "RB" => $tree["RB"]); $tree["LB"]["RB"] = $tree["RB"]["RB"]; - // var_dump($tree); // return; } @@ -1639,22 +1554,22 @@ class searchEngine_adapter_phrasea_queryParser $m_o = $tree["NODETYPE"]; $m_n = $tree["PNUM"]; - $tree["CLASS"] = $tree["RB"]["CLASS"]; + $tree["CLASS"] = $tree["RB"]["CLASS"]; $tree["NODETYPE"] = $tree["RB"]["NODETYPE"]; - $tree["VALUE"] = $tree["RB"]["VALUE"]; - $tree["PNUM"] = $tree["RB"]["PNUM"]; + $tree["VALUE"] = $tree["RB"]["VALUE"]; + $tree["PNUM"] = $tree["RB"]["PNUM"]; - $tree["RB"]["CLASS"] = $m_t; + $tree["RB"]["CLASS"] = $m_t; $tree["RB"]["NODETYPE"] = $m_o; - $tree["RB"]["VALUE"] = $m_v; - $tree["RB"]["PNUM"] = $m_n; + $tree["RB"]["VALUE"] = $m_v; + $tree["RB"]["PNUM"] = $m_n; - $tree["LB"] = array("CLASS" => $m_t, - "NODETYPE" => $m_o, - "VALUE" => $m_v, - "PNUM" => $m_n, - "LB" => $tree["LB"], - "RB" => $tree["RB"]["LB"]); + $tree["LB"] = array("CLASS" => $m_t, + "NODETYPE" => $m_o, + "VALUE" => $m_v, + "PNUM" => $m_n, + "LB" => $tree["LB"], + "RB" => $tree["RB"]["LB"]); $tree["RB"]["LB"] = $tree["LB"]["LB"]; } @@ -1711,7 +1626,7 @@ class searchEngine_adapter_phrasea_queryParser { // printf("\n\n"); $tree = null; - while ($t = $this->nexttoken($inquote)) + while ($t = $this->nexttoken($inquote)) { if ($this->debug) printf("got token %s of class %s\n", $t["VALUE"], $t["CLASS"]); @@ -1759,18 +1674,18 @@ class searchEngine_adapter_phrasea_queryParser { $tree["RB"] = $this->maketree($depth + 1); if (!$tree["RB"]) - $tree = null; + $tree = null; } else { // ici on applique l'opérateur par défaut - $tree = array("CLASS" => "OPS", - "VALUE" => $this->defaultop["VALUE"], - "NODETYPE" => $this->defaultop["NODETYPE"], - "PNUM" => $this->defaultop["PNUM"], - "DEPTH" => $depth, - "LB" => $tree, - "RB" => $this->maketree($depth + 1)); + $tree = array("CLASS" => "OPS", + "VALUE" => $this->defaultop["VALUE"], + "NODETYPE" => $this->defaultop["NODETYPE"], + "PNUM" => $this->defaultop["PNUM"], + "DEPTH" => $depth, + "LB" => $tree, + "RB" => $this->maketree($depth + 1)); } } if (!$tree) @@ -1816,18 +1731,18 @@ class searchEngine_adapter_phrasea_queryParser { $tree["RB"] = $this->maketree($depth + 1, true); if (!$tree["RB"]) - $tree = null; + $tree = null; } else { // ici on applique l'opérateur par défaut - $tree = array("CLASS" => "OPS", - "VALUE" => $this->defaultop["VALUE"], - "NODETYPE" => $this->defaultop["NODETYPE"], - "PNUM" => $this->defaultop["PNUM"], - "DEPTH" => $depth, - "LB" => $tree, - "RB" => $this->maketree($depth + 1, true)); + $tree = array("CLASS" => "OPS", + "VALUE" => $this->defaultop["VALUE"], + "NODETYPE" => $this->defaultop["NODETYPE"], + "PNUM" => $this->defaultop["PNUM"], + "DEPTH" => $depth, + "LB" => $tree, + "RB" => $this->maketree($depth + 1, true)); } } if (!$tree) @@ -1879,7 +1794,6 @@ class searchEngine_adapter_phrasea_queryParser // if($this->debug) // { // printf("addtotree({tree}, \$t='%s', \$depth=%d, inquote=%s)\n", $t["VALUE"], $depth, $inquote?"true":"false"); -// var_dump($tree); // } if ($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") { @@ -1940,7 +1854,7 @@ class searchEngine_adapter_phrasea_queryParser return(null); } - return(array("CLASS" => "OPK", "VALUE" => $t["VALUE"], "NODETYPE" => $this->opk[$t["VALUE"]]["NODETYPE"], "PNUM" => null, "DEPTH" => $depth, "LB" => $tree, "RB" => null)); + return(array("CLASS" => "OPK", "VALUE" => $t["VALUE"], "NODETYPE" => $this->opk[$t["VALUE"]]["NODETYPE"], "PNUM" => null, "DEPTH" => $depth, "LB" => $tree, "RB" => null)); break; case "TOK_WORD": if ($t["CLASS"] == "TOK_WORD" && isset($this->ops[$t["VALUE"]]) && !$inquote) @@ -1978,17 +1892,17 @@ class searchEngine_adapter_phrasea_queryParser } } - return(array("CLASS" => "OPS", "VALUE" => $t["VALUE"], "NODETYPE" => $this->ops[$t["VALUE"]]["NODETYPE"], "PNUM" => $pnum, "DEPTH" => $depth, "LB" => $tree, "RB" => null)); + return(array("CLASS" => "OPS", "VALUE" => $t["VALUE"], "NODETYPE" => $this->ops[$t["VALUE"]]["NODETYPE"], "PNUM" => $pnum, "DEPTH" => $depth, "LB" => $tree, "RB" => null)); } else { // ce mot n'est pas un opérateur - $pnum = null; + $pnum = null; $nodetype = PHRASEA_KEYLIST; if ($t["CLASS"] == "TOK_WORD" && isset($this->spw[$t["VALUE"]]) && !$inquote) { // mais c'est un mot 'spécial' de phrasea ('last', 'all') - $type = $this->spw[$t["VALUE"]]["CLASS"]; + $type = $this->spw[$t["VALUE"]]["CLASS"]; $nodetype = $this->spw[$t["VALUE"]]["NODETYPE"]; if ($this->spw[$t["VALUE"]]["CANNUM"]) { @@ -2016,9 +1930,9 @@ class searchEngine_adapter_phrasea_queryParser function addsimple($t, $type, $nodetype, $pnum, $tree, $depth) { - $nok = 0; + $nok = 0; $registry = registry::get_instance(); - $w = $t["VALUE"]; + $w = $t["VALUE"]; if ($w != "?" && $w != "*") // on laisse passer les 'isolés' pour les traiter plus tard comme des mots vides { for ($i = 0; $i < strlen($w); $i++) @@ -2042,7 +1956,7 @@ class searchEngine_adapter_phrasea_queryParser } if (!$tree) { - return(array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth)); + return(array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth)); } switch ($tree["CLASS"]) { @@ -2052,17 +1966,17 @@ class searchEngine_adapter_phrasea_queryParser $tree["VALUE"][] = $t["VALUE"]; else { - $tree = array("CLASS" => "OPS", - "VALUE" => "et", - "NODETYPE" => PHRASEA_OP_AND, - "PNUM" => null, - "DEPTH" => $depth, - "LB" => $tree, - "RB" => array("CLASS" => $type, - "NODETYPE" => $nodetype, - "VALUE" => array($t["VALUE"]), - "PNUM" => $pnum, - "DEPTH" => $depth)); + $tree = array("CLASS" => "OPS", + "VALUE" => "et", + "NODETYPE" => PHRASEA_OP_AND, + "PNUM" => null, + "DEPTH" => $depth, + "LB" => $tree, + "RB" => array("CLASS" => $type, + "NODETYPE" => $nodetype, + "VALUE" => array($t["VALUE"]), + "PNUM" => $pnum, + "DEPTH" => $depth)); } return($tree); @@ -2070,7 +1984,7 @@ class searchEngine_adapter_phrasea_queryParser case "OPK": if ($tree["RB"] == null) { - $tree["RB"] = array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth); + $tree["RB"] = array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth); return($tree); } @@ -2084,43 +1998,43 @@ class searchEngine_adapter_phrasea_queryParser } if (($tree["RB"]["CLASS"] == "PHRASEA_KW_LAST" || $tree["RB"]["CLASS"] == "PHRASEA_KW_ALL") && $tree["RB"]["DEPTH"] == $depth) { - $tree["RB"] = array("CLASS" => "OPS", - "VALUE" => "et", - "NODETYPE" => PHRASEA_OP_AND, - "PNUM" => null, - "DEPTH" => $depth, - "LB" => $tree["RB"], - "RB" => array("CLASS" => $type, - "NODETYPE" => $nodetype, - "VALUE" => array($t["VALUE"]), - "PNUM" => $pnum, - "DEPTH" => $depth)); + $tree["RB"] = array("CLASS" => "OPS", + "VALUE" => "et", + "NODETYPE" => PHRASEA_OP_AND, + "PNUM" => null, + "DEPTH" => $depth, + "LB" => $tree["RB"], + "RB" => array("CLASS" => $type, + "NODETYPE" => $nodetype, + "VALUE" => array($t["VALUE"]), + "PNUM" => $pnum, + "DEPTH" => $depth)); return($tree); } - return(array("CLASS" => "OPS", - "VALUE" => $this->defaultop["VALUE"], - "NODETYPE" => $this->defaultop["NODETYPE"], - "PNUM" => $this->defaultop["PNUM"], - "DEPTH" => $depth, - "LB" => $tree, - "RB" => array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth) - )); + return(array("CLASS" => "OPS", + "VALUE" => $this->defaultop["VALUE"], + "NODETYPE" => $this->defaultop["NODETYPE"], + "PNUM" => $this->defaultop["PNUM"], + "DEPTH" => $depth, + "LB" => $tree, + "RB" => array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth) + )); } case "PHRASEA_KW_LAST": case "PHRASEA_KW_ALL": - return(array("CLASS" => "OPS", - "VALUE" => "et", - "NODETYPE" => PHRASEA_OP_AND, - "PNUM" => null, - "DEPTH" => $depth, - "LB" => $tree, - "RB" => array("CLASS" => $type, - "NODETYPE" => $nodetype, - "VALUE" => array($t["VALUE"]), - "PNUM" => $pnum, - "DEPTH" => $depth))); + return(array("CLASS" => "OPS", + "VALUE" => "et", + "NODETYPE" => PHRASEA_OP_AND, + "PNUM" => null, + "DEPTH" => $depth, + "LB" => $tree, + "RB" => array("CLASS" => $type, + "NODETYPE" => $nodetype, + "VALUE" => array($t["VALUE"]), + "PNUM" => $pnum, + "DEPTH" => $depth))); } } @@ -2129,7 +2043,7 @@ class searchEngine_adapter_phrasea_queryParser $this->phq = $s . " " . $this->phq; } - function nexttoken($inquote=false) + function nexttoken($inquote = false) { if ($this->phq == "") @@ -2144,7 +2058,7 @@ class searchEngine_adapter_phrasea_queryParser return(array("CLASS" => "TOK_VOID", "VALUE" => $c)); } - $c2 = $c . substr($this->phq, 1, 1); + $c2 = $c . substr($this->phq, 1, 1); if ($c2 == "<=" || $c2 == ">=" || $c2 == "<>") { $this->phq = $this->mb_ltrim(mb_substr($this->phq, 2, 99999, 'UTF-8'), 'UTF-8'); @@ -2241,10 +2155,10 @@ class searchEngine_adapter_phrasea_queryParser return(array("CLASS" => "TOK_QUOTE", "VALUE" => "\"")); break; default: - $l = mb_strlen($this->phq, 'UTF-8'); - $t = ""; + $l = mb_strlen($this->phq, 'UTF-8'); + $t = ""; $c_utf8 = ""; - for ($i = 0; $i < $l; $i++) + for ($i = 0; $i < $l; $i++) { if (!$this->unicode->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) { diff --git a/lib/classes/searchEngine/adapter/sphinx/engine.class.php b/lib/classes/searchEngine/adapter/sphinx/engine.class.php index 048236b7d9..d2e32aefa4 100644 --- a/lib/classes/searchEngine/adapter/sphinx/engine.class.php +++ b/lib/classes/searchEngine/adapter/sphinx/engine.class.php @@ -1,6 +1,6 @@ = 0); assert(is_int($perPage)); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $page = ceil($offset / $perPage) + 1; @@ -511,7 +511,7 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i if (!$this->current_index) $this->current_index = '*'; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $supposed_qry = mb_strtolower($this->query); $pieces = explode(" ", str_replace(array("all", "last", "et", "ou", "sauf", "and", "or", "except", "in", "dans", "'", '"', "(", ")", "_", "-"), ' ', $supposed_qry)); @@ -689,7 +689,7 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i */ public function build_excerpt($query, array $fields, record_adapter $record) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $selected_sbas_id = $record->get_sbas_id(); diff --git a/lib/classes/searchEngine/results.class.php b/lib/classes/searchEngine/results.class.php index 7b10634586..55046d1788 100644 --- a/lib/classes/searchEngine/results.class.php +++ b/lib/classes/searchEngine/results.class.php @@ -121,7 +121,7 @@ class searchEngine_results */ public function get_suggestions() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); return $this->engine->get_suggestions($session); diff --git a/lib/classes/set/export.class.php b/lib/classes/set/export.class.php index f98c3519f5..ee1290786b 100644 --- a/lib/classes/set/export.class.php +++ b/lib/classes/set/export.class.php @@ -34,27 +34,42 @@ class set_export extends set_abstract * @param int $sstid * @return set_export */ - public function __construct($lst, $sstid) + public function __construct($lst, $sstid, $storyWZid = null) { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $Core = bootstrap::getCore(); + + $appbox = appbox::get_instance($Core); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); - - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $Core->getAuthenticatedUser(); $download_list = array(); $remain_hd = array(); + if ($storyWZid) + { + $repository = $Core->getEntityManager()->getRepository('\\Entities\\StoryWZ'); + + $storyWZ = $repository->findByUserAndId($user, $storyWZid); + + $lst = $storyWZ->getRecord()->get_serialize_key(); + } + if ($sstid != "") { - $basket = basket_adapter::getInstance($appbox, $sstid, $user->get_id()); + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); - foreach ($basket->get_elements() as $basket_element) + /* @var $repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($sstid, $user, false); + + foreach ($Basket->getElements() as $basket_element) { - $base_id = $basket_element->get_record()->get_base_id(); - $record_id = $basket_element->get_record()->get_record_id(); + /* @var $basket_element \Entities\BasketElement */ + $base_id = $basket_element->getRecord()->get_base_id(); + $record_id = $basket_element->getRecord()->get_record_id(); if (!isset($remain_hd[$base_id])) { @@ -69,11 +84,11 @@ class set_export extends set_abstract } $current_element = $download_list[] = - new record_exportElement( - $basket_element->get_record()->get_sbas_id(), - $record_id, - $basket->get_name() . '/', - $remain_hd[$base_id] + new record_exportElement( + $basket_element->getRecord()->get_sbas_id(), + $record_id, + $Basket->getName() . '/', + $remain_hd[$base_id] ); $remain_hd[$base_id] = $current_element->get_remain_hd(); @@ -82,7 +97,7 @@ class set_export extends set_abstract else { $tmp_lst = explode(';', $lst); - $n = 1; + $n = 1; foreach ($tmp_lst as $basrec) { $basrec = explode('_', $basrec); @@ -100,11 +115,9 @@ class set_export extends set_abstract if ($record->is_grouping()) { - $regfield = basket_adapter::getRegFields($basrec[0], $record->get_caption()); - foreach ($record->get_children() as $child_basrec) { - $base_id = $child_basrec->get_base_id(); + $base_id = $child_basrec->get_base_id(); $record_id = $child_basrec->get_record_id(); if (!isset($remain_hd[$base_id])) @@ -112,7 +125,7 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $remain_hd[$base_id] = - $user->ACL()->remaining_download($base_id); + $user->ACL()->remaining_download($base_id); } else { @@ -121,11 +134,11 @@ class set_export extends set_abstract } $current_element = $download_list[] = - new record_exportElement( - $child_basrec->get_sbas_id(), - $record_id, - $regfield['regname'] . '_' . $n . '/', - $remain_hd[$base_id] + new record_exportElement( + $child_basrec->get_sbas_id(), + $record_id, + $record->get_title() . '_' . $n . '/', + $remain_hd[$base_id] ); $remain_hd[$base_id] = $current_element->get_remain_hd(); @@ -133,7 +146,7 @@ class set_export extends set_abstract } else { - $base_id = $record->get_base_id(); + $base_id = $record->get_base_id(); $record_id = $record->get_record_id(); if (!isset($remain_hd[$base_id])) @@ -141,7 +154,7 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $remain_hd[$base_id] = - $user->ACL()->remaining_download($base_id); + $user->ACL()->remaining_download($base_id); } else { @@ -149,13 +162,13 @@ class set_export extends set_abstract } } - $current_element = - $download_list[$basrec[0] . '_' . $basrec[1]] = - new record_exportElement( - $record->get_sbas_id(), - $record_id, - '', - $remain_hd[$base_id] + $current_element = + $download_list[$basrec[0] . '_' . $basrec[1]] = + new record_exportElement( + $record->get_sbas_id(), + $record_id, + '', + $remain_hd[$base_id] ); $remain_hd[$base_id] = $current_element->get_remain_hd(); @@ -180,10 +193,10 @@ class set_export extends set_abstract if (!isset($display_download[$name])) { $display_download[$name] = array( - 'size' => 0, - 'total' => 0, - 'available' => 0, - 'refused' => array() + 'size' => 0, + 'total' => 0, + 'available' => 0, + 'refused' => array() ); } @@ -195,12 +208,12 @@ class set_export extends set_abstract $display_download[$name]['label'] = $properties['label']; $this->total_download++; $display_download[$name]['size'] += - $download_element->get_size($name); + $download_element->get_size($name); } else { $display_download[$name]['refused'][] = - $download_element->get_thumbnail(); + $download_element->get_thumbnail(); } } foreach ($download_element->get_orderable() as $name => $properties) @@ -208,9 +221,9 @@ class set_export extends set_abstract if (!isset($display_orderable[$name])) { $display_orderable[$name] = array( - 'total' => 0, - 'available' => 0, - 'refused' => array() + 'total' => 0, + 'available' => 0, + 'refused' => array() ); } @@ -224,7 +237,7 @@ class set_export extends set_abstract else { $display_orderable[$name]['refused'][] = - $download_element->get_thumbnail(); + $download_element->get_thumbnail(); } } } @@ -237,10 +250,10 @@ class set_export extends set_abstract $display_ftp = array(); $hasadminright = $user->ACL()->has_right('addrecord') - || $user->ACL()->has_right('deleterecord') - || $user->ACL()->has_right('modifyrecord') - || $user->ACL()->has_right('coll_manage') - || $user->ACL()->has_right('coll_modify_struct'); + || $user->ACL()->has_right('deleterecord') + || $user->ACL()->has_right('modifyrecord') + || $user->ACL()->has_right('coll_manage') + || $user->ACL()->has_right('coll_modify_struct'); $this->ftp_datas = array(); @@ -253,7 +266,7 @@ class set_export extends set_abstract if ($hasadminright) { - $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, + $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, usr.pwdFTP,usr.destFTP,prefixFTPfolder,usr.passifFTP, usr.retryFTP,usr.usr_mail FROM (usr INNER JOIN basusr @@ -269,7 +282,7 @@ class set_export extends set_abstract } elseif ($registry->get('GV_ftp_for_user')) { - $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, + $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, usr.pwdFTP,usr.destFTP,prefixFTPfolder, usr.passifFTP,usr.retryFTP,usr.usr_mail FROM (usr INNER JOIN basusr @@ -285,43 +298,43 @@ class set_export extends set_abstract } $datas[] = array( - 'name' => _('export::ftp: reglages manuels'), - 'usr_id' => '0', - 'addrFTP' => '', - 'loginFTP' => '', - 'pwdFTP' => '', - 'ssl' => '0', - 'destFTP' => '', - 'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"), - 'passifFTP' => false, - 'retryFTP' => 5, - 'mailFTP' => '', - 'sendermail' => $user->get_email() + 'name' => _('export::ftp: reglages manuels'), + 'usr_id' => '0', + 'addrFTP' => '', + 'loginFTP' => '', + 'pwdFTP' => '', + 'ssl' => '0', + 'destFTP' => '', + 'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"), + 'passifFTP' => false, + 'retryFTP' => 5, + 'mailFTP' => '', + 'sendermail' => $user->get_email() ); $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) { $datas[] = array( - 'name' => $row["usr_login"], - 'usr_id' => $row['usr_id'], - 'addrFTP' => $row['addrFTP'], - 'loginFTP' => $row['loginFTP'], - 'pwdFTP' => $row['pwdFTP'], - 'ssl' => $row['sslFTP'], - 'destFTP' => $row['destFTP'], - 'prefixFTPfolder' => - (strlen(trim($row['prefixFTPfolder'])) > 0 ? - trim($row['prefixFTPfolder']) : - 'Export_' . date("Y-m-d_H.i.s")), - 'passifFTP' => ($row['passifFTP'] > 0), - 'retryFTP' => $row['retryFTP'], - 'mailFTP' => $row['usr_mail'], - 'sendermail' => $user->get_email() + 'name' => $row["usr_login"], + 'usr_id' => $row['usr_id'], + 'addrFTP' => $row['addrFTP'], + 'loginFTP' => $row['loginFTP'], + 'pwdFTP' => $row['pwdFTP'], + 'ssl' => $row['sslFTP'], + 'destFTP' => $row['destFTP'], + 'prefixFTPfolder' => + (strlen(trim($row['prefixFTPfolder'])) > 0 ? + trim($row['prefixFTPfolder']) : + 'Export_' . date("Y-m-d_H.i.s")), + 'passifFTP' => ($row['passifFTP'] > 0), + 'retryFTP' => $row['retryFTP'], + 'mailFTP' => $row['usr_mail'], + 'sendermail' => $user->get_email() ); } @@ -411,8 +424,8 @@ class set_export extends set_abstract { throw new Exception('No subdefs given'); } - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = appbox::get_instance(\bootstrap::getCore()); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); $unicode = new unicode(); @@ -431,11 +444,11 @@ class set_export extends set_abstract $id = count($files); $files[$id] = array( - 'base_id' => $download_element->get_base_id(), - 'record_id' => $download_element->get_record_id(), - 'original_name' => '', - 'export_name' => '', - 'subdefs' => array() + 'base_id' => $download_element->get_base_id(), + 'record_id' => $download_element->get_record_id(), + 'original_name' => '', + 'export_name' => '', + 'subdefs' => array() ); $sbas_id = phrasea::sbasFromBas($download_element->get_base_id()); @@ -445,12 +458,12 @@ class set_export extends set_abstract $desc = $download_element->get_xml(); $files[$id]['original_name'] = - $files[$id]['export_name'] = - $download_element->get_original_name(); + $files[$id]['export_name'] = + $download_element->get_original_name(); $files[$id]['original_name'] = - trim($files[$id]['original_name']) != '' ? - $files[$id]['original_name'] : $id; + trim($files[$id]['original_name']) != '' ? + $files[$id]['original_name'] : $id; $infos = pathinfo($files[$id]['original_name']); @@ -462,7 +475,7 @@ class set_export extends set_abstract $title = strip_tags($download_element->get_title()); $files[$id]['export_name'] = $unicode->remove_nonazAZ09($title, true); - $rename_done = true; + $rename_done = true; } else { @@ -470,7 +483,7 @@ class set_export extends set_abstract } $sizeMaxAjout = 0; - $sizeMaxExt = 0; + $sizeMaxExt = 0; $sd = $download_element->get_subdefs(); @@ -486,7 +499,7 @@ class set_export extends set_abstract } set_time_limit(100); - $subdef_export = $subdef_alive = false; + $subdef_export = $subdef_alive = false; $n_files++; @@ -497,32 +510,32 @@ class set_export extends set_abstract case 'caption': case 'caption-yaml': $subdef_export = true; - $subdef_alive = true; + $subdef_alive = true; break; case 'thumbnail': - $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + $tmp_pathfile = array( + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); $subdef_export = true; - $subdef_alive = true; + $subdef_alive = true; break; case 'document': $subdef_export = true; - $path = recordutils_image::stamp( - $download_element->get_base_id() - , $download_element->get_record_id() - , true + $path = recordutils_image::stamp( + $download_element->get_base_id() + , $download_element->get_record_id() + , true ); - $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + $tmp_pathfile = array( + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); if (file_exists($path)) { $tmp_pathfile = array( - 'path' => dirname($path) - , 'file' => basename($path) + 'path' => dirname($path) + , 'file' => basename($path) ); $subdef_alive = true; } @@ -532,24 +545,22 @@ class set_export extends set_abstract $subdef_export = true; $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); - if (!$user->ACL()->has_right_on_base( - $download_element->get_base_id() - , "nowatermark" - ) - && $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) + if (!$user->ACL()->has_right_on_base($download_element->get_base_id(), "nowatermark") + && !$user->ACL()->has_preview_grant($download_element) + && $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) { $path = recordutils_image::watermark( - $download_element->get_base_id() - , $download_element->get_record_id() + $download_element->get_base_id() + , $download_element->get_record_id() ); if (file_exists($path)) { $tmp_pathfile = array( - 'path' => dirname($path) - , 'file' => basename($path) + 'path' => dirname($path) + , 'file' => basename($path) ); $subdef_alive = true; } @@ -568,44 +579,44 @@ class set_export extends set_abstract case 'caption': if ($name == 'caption-yaml') { - $suffix = '_captionyaml'; + $suffix = '_captionyaml'; $extension = 'yml'; - $mime = 'text/x-yaml'; + $mime = 'text/x-yaml'; } else { - $suffix = '_caption'; + $suffix = '_caption'; $extension = 'xml'; - $mime = 'text/xml'; + $mime = 'text/xml'; } - $files[$id]["subdefs"][$name]["ajout"] = $suffix; + $files[$id]["subdefs"][$name]["ajout"] = $suffix; $files[$id]["subdefs"][$name]["exportExt"] = $extension; - $files[$id]["subdefs"][$name]["label"] = $properties['label']; - $files[$id]["subdefs"][$name]["path"] = null; - $files[$id]["subdefs"][$name]["file"] = null; - $files[$id]["subdefs"][$name]["size"] = 0; - $files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory(); - $files[$id]["subdefs"][$name]["mime"] = $mime; + $files[$id]["subdefs"][$name]["label"] = $properties['label']; + $files[$id]["subdefs"][$name]["path"] = null; + $files[$id]["subdefs"][$name]["file"] = null; + $files[$id]["subdefs"][$name]["size"] = 0; + $files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory(); + $files[$id]["subdefs"][$name]["mime"] = $mime; break; case 'document': case 'preview': case 'thumbnail': $infos = pathinfo(p4string::addEndSlash($tmp_pathfile["path"]) . - $tmp_pathfile["file"]); + $tmp_pathfile["file"]); - $files[$id]["subdefs"][$name]["ajout"] = - $properties['class'] == 'document' ? '' : "_" . $name; - $files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"]; - $files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"]; - $files[$id]["subdefs"][$name]["label"] = $properties['label']; - $files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size(); - $files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime(); - $files[$id]["subdefs"][$name]["folder"] = - $download_element->get_directory(); + $files[$id]["subdefs"][$name]["ajout"] = + $properties['class'] == 'document' ? '' : "_" . $name; + $files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"]; + $files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"]; + $files[$id]["subdefs"][$name]["label"] = $properties['label']; + $files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size(); + $files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime(); + $files[$id]["subdefs"][$name]["folder"] = + $download_element->get_directory(); $files[$id]["subdefs"][$name]["exportExt"] = - isset($infos['extension']) ? $infos['extension'] : ''; + isset($infos['extension']) ? $infos['extension'] : ''; $size += $sd[$name]->get_size(); @@ -613,12 +624,12 @@ class set_export extends set_abstract } $longueurAjoutCourant = - mb_strlen($files[$id]["subdefs"][$name]["ajout"]); - $sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout); + mb_strlen($files[$id]["subdefs"][$name]["ajout"]); + $sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout); $longueurExtCourant = - mb_strlen($files[$id]["subdefs"][$name]["exportExt"]); - $sizeMaxExt = max($longueurExtCourant, $sizeMaxExt); + mb_strlen($files[$id]["subdefs"][$name]["exportExt"]); + $sizeMaxExt = max($longueurExtCourant, $sizeMaxExt); } } @@ -628,34 +639,34 @@ class set_export extends set_abstract $start_length = mb_strlen($name); if ($start_length > $max_length) - $name = mb_substr($name, 0, $max_length); + $name = mb_substr($name, 0, $max_length); $n = 1; while (in_array(mb_strtolower($name), $file_names)) { $n++; - $suffix = "-" . $n; // pour diese si besoin - $max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix); - $name = mb_strtolower($files[$id]["export_name"]); + $suffix = "-" . $n; // pour diese si besoin + $max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix); + $name = mb_strtolower($files[$id]["export_name"]); if ($start_length > $max_length) - $name = mb_substr($name, 0, $max_length) . $suffix; + $name = mb_substr($name, 0, $max_length) . $suffix; else - $name = $name . $suffix; + $name = $name . $suffix; } - $file_names[] = mb_strtolower($name); + $file_names[] = mb_strtolower($name); $files[$id]["export_name"] = $name; - $files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]); + $files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]); $files[$id]["original_name"] = $unicode->remove_nonazAZ09($files[$id]["original_name"]); - $i = 0; - $name = utf8_decode($files[$id]["export_name"]); - $tmp_name = ""; + $i = 0; + $name = utf8_decode($files[$id]["export_name"]); + $tmp_name = ""; $good_keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', - '4', '5', '6', '7', '8', '9', '-', '_', '.', '#'); + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '-', '_', '.', '#'); while (isset($name[$i])) { @@ -673,19 +684,19 @@ class set_export extends set_abstract if (in_array('caption', $subdefs)) { $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' - . time() . $session->get_usr_id() - . $session->get_ses_id() . '/'; + . time() . $session->get_usr_id() + . $session->get_ses_id() . '/'; system_file::mkdir($caption_dir); $desc = self::get_caption( - $download_element->get_base_id() - , $download_element->get_record_id() + $download_element->get_base_id() + , $download_element->get_record_id() ); $file = $files[$id]["export_name"] - . $files[$id]["subdefs"]['caption']["ajout"] . '.' - . $files[$id]["subdefs"]['caption']["exportExt"]; + . $files[$id]["subdefs"]['caption']["ajout"] . '.' + . $files[$id]["subdefs"]['caption']["exportExt"]; $path = $caption_dir; @@ -701,22 +712,22 @@ class set_export extends set_abstract if (in_array('caption-yaml', $subdefs)) { $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' - . time() . $session->get_usr_id() - . $session->get_ses_id() . '/'; + . time() . $session->get_usr_id() + . $session->get_ses_id() . '/'; system_file::mkdir($caption_dir); $desc = self::get_caption( - $download_element->get_base_id() - , $download_element->get_record_id() - , true - , 'yaml' + $download_element->get_base_id() + , $download_element->get_record_id() + , true + , 'yaml' ); $file = $files[$id]["export_name"] - . $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.' - . $files[$id]["subdefs"]['caption-yaml']["exportExt"]; + . $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.' + . $files[$id]["subdefs"]['caption-yaml']["exportExt"]; $path = $caption_dir; @@ -732,10 +743,10 @@ class set_export extends set_abstract } $this->list = array( - 'files' => $files, - 'names' => $file_names, - 'size' => $size, - 'count' => $n_files + 'files' => $files, + 'names' => $file_names, + 'size' => $size, + 'count' => $n_files ); @@ -758,9 +769,9 @@ class set_export extends set_abstract return false; } if (isset($list['complete']) && $list['complete'] === true) - + { return; - + } $files = $list['files']; @@ -770,13 +781,13 @@ class set_export extends set_abstract random::updateToken($token, serialize($list)); $str_in = array("à", "á", "â", "ã", "ä", "å", "ç", "è", "é", "ê", - "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", - "õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ"); + "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", + "õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ"); $str_out = array("a", "a", "a", "a", "a", "a", "c", "e", "e", "e", - "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", - "o", "o", "u", "u", "u", "u", "y", "y"); + "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", + "o", "o", "u", "u", "u", "u", "y", "y"); - $caption_dirs = $unlinks = array(); + $caption_dirs = $unlinks = array(); foreach ($files as $record) { @@ -788,9 +799,9 @@ class set_export extends set_abstract if (is_file($path)) { $name = $obj["folder"] - . $record["export_name"] - . $obj["ajout"] - . '.' . $obj["exportExt"]; + . $record["export_name"] + . $obj["ajout"] + . '.' . $obj["exportExt"]; $name = str_replace($str_in, $str_out, $name); @@ -800,7 +811,7 @@ class set_export extends set_abstract { if (!in_array(dirname($path), $caption_dirs)) $caption_dirs[] = dirname($path); - $unlinks[] = $path; + $unlinks[] = $path; } } } @@ -843,7 +854,7 @@ class set_export extends set_abstract $dom->encoding = 'UTF-8'; $dom_record = $dom->createElement('record'); - $dom_desc = $dom->createElement('description'); + $dom_desc = $dom->createElement('description'); $dom_record->appendChild($dom_desc); $dom->appendChild($dom_record); @@ -851,19 +862,19 @@ class set_export extends set_abstract $restrict = array(); $sbas_id = phrasea::sbasFromBas($bas); - $record = new record_adapter($sbas_id, $rec); - $desc = $record->get_xml(); - $appbox = appbox::get_instance(); + $record = new record_adapter($sbas_id, $rec); + $desc = $record->get_xml(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $databox = databox::get_instance($sbas_id); - $struct = $databox->get_structure(); + $struct = $databox->get_structure(); $rights = true; if ($check_rights && $session->is_authenticated()) { - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $rights = $user->ACL()->has_right_on_base($bas, 'canmodifrecord'); if ($rights == false) @@ -876,7 +887,7 @@ class set_export extends set_abstract foreach ($z[0] as $ki => $vi) { if (isset($vi["export"]) - && ($vi["export"] == "0" || $vi["export"] == "off")) + && ($vi["export"] == "0" || $vi["export"] == "off")) $restrict[$ki] = true; } } @@ -886,36 +897,39 @@ class set_export extends set_abstract $buffer = array(); - if ($sxe = simplexml_load_string($desc)) + foreach ($record->get_caption()->get_fields() as $field) { - $z = $sxe->xpath('/record/description'); - if ($z && is_array($z)) + if (($rights || !isset($restrict[$field->get_name()]))) { - foreach ($z[0] as $ki => $vi) + switch ($format) { - if (($rights || !isset($restrict[$ki]))) - { + case 'yaml': + case 'yml': + $vi = $field->get_values(); - switch ($format) + if ($field->is_multi()) { - case 'yaml': - case 'yml': - - $vi = trim($vi); - if (ctype_digit($vi)) - $vi = (int) $vi; - - $buffer[trim($ki)] = $vi; - break; - case 'xml': - default: - $dom_el = $dom->createElement($ki); - $dom_el->appendChild($dom->createTextNode(trim($vi))); - $dom_desc->appendChild($dom_el); - break; + $buffer[$field->get_name()] = array(); + foreach ($vi as $value) + { + $val = $value->getValue(); + $buffer[$field->get_name()][] = ctype_digit($val) ? (int) $val : $val; + } } - } + else + { + $value = array_pop($vi); + $val = $value->getValue(); + $buffer[$field->get_name()] = ctype_digit($val) ? (int) $val : $val; + } + break; + case 'xml': + default: + $dom_el = $dom->createElement($field->get_name()); + $dom_el->appendChild($dom->createTextNode($field->get_serialized_values())); + $dom_desc->appendChild($dom_el); + break; } } } @@ -951,31 +965,37 @@ class set_export extends set_abstract public static function stream_file( $file, $exportname, $mime, $disposition = 'attachment') { - require_once dirname(__FILE__) . "/../../../lib/vendor/Silex/autoload.php"; + require_once __DIR__ . "/../../../lib/vendor/Silex/autoload.php"; $registry = registry::get_instance(); $disposition = in_array($disposition, array('inline', 'attachment')) ? - $disposition : 'attachment'; + $disposition : 'attachment'; $response = new Symfony\Component\HttpFoundation\Response(); if (is_file($file)) { + $testPath = function($file, $registry) + { + return strpos($file, $registry->get('GV_RootPath') . 'tmp/download/') !== false + || strpos($file, $registry->get('GV_RootPath') . 'tmp/lazaret/') !== false + || strpos($file, $registry->get('GV_X_Accel_Redirect')) !== false; + }; - if ($registry->get('GV_modxsendfile') && strpos($file, $registry->get('GV_X_Accel_Redirect')) !== false) + if ($registry->get('GV_modxsendfile') && $testPath($file, $registry)) { $file_xaccel = str_replace( - array( + array( $registry->get('GV_X_Accel_Redirect'), $registry->get('GV_RootPath') . 'tmp/download/', $registry->get('GV_RootPath') . 'tmp/lazaret/' - ) - , array( - '/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/', - '/download/', - '/lazaret/' - ) - , $file + ) + , array( + '/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/', + '/download/', + '/lazaret/' + ) + , $file ); $response->headers->set('X-Sendfile', $file); $response->headers->set('X-Accel-Redirect', $file_xaccel); @@ -1036,7 +1056,7 @@ class set_export extends set_abstract header("Content-Length: " . strlen($data)); header("Cache-Control: max-age=3600, must-revalidate "); header("Content-Disposition: " . $disposition - . "; filename=" . $exportname . ";"); + . "; filename=" . $exportname . ";"); echo $data; @@ -1054,24 +1074,24 @@ class set_export extends set_abstract public static function log_download(Array $list, $type, $anonymous = false, $comment = '') { //download - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - $user = false; + $user = false; if ($anonymous) { } else { - $user = User_Adapter::getInstance($session->get_usr_id(), appbox::get_instance()); + $user = User_Adapter::getInstance($session->get_usr_id(), appbox::get_instance(\bootstrap::getCore())); } $tmplog = array(); $files = $list['files']; $event_names = array( - 'mail-export' => Session_Logger::EVENT_EXPORTMAIL, - 'download' => Session_Logger::EVENT_EXPORTDOWNLOAD + 'mail-export' => Session_Logger::EVENT_EXPORTMAIL, + 'download' => Session_Logger::EVENT_EXPORTDOWNLOAD ); $event_name = isset($event_names[$type]) ? $event_names[$type] : Session_Logger::EVENT_EXPORTDOWNLOAD; @@ -1080,18 +1100,18 @@ class set_export extends set_abstract { foreach ($record["subdefs"] as $o => $obj) { - $sbas_id = phrasea::sbasFromBas($record['base_id']); + $sbas_id = phrasea::sbasFromBas($record['base_id']); $record_object = new record_adapter($sbas_id, $record['record_id']); $session->get_logger($record_object->get_databox()) - ->log($record_object, $event_name, $o, $comment); + ->log($record_object, $event_name, $o, $comment); if ($o != "caption") { - $log["rid"] = $record_object->get_record_id(); - $log["subdef"] = $o; - $log["poids"] = $obj["size"]; - $log["shortXml"] = $record_object->get_xml(); + $log["rid"] = $record_object->get_record_id(); + $log["subdef"] = $o; + $log["poids"] = $obj["size"]; + $log["shortXml"] = $record_object->get_xml(); $tmplog[$record_object->get_base_id()][] = $log; if (!$anonymous && $o == 'document') $user->ACL()->remove_remaining($record_object->get_base_id()); @@ -1102,9 +1122,9 @@ class set_export extends set_abstract } $export_types = array( - 'download' => 0, - 'mail-export' => 2, - 'ftp' => 4 + 'download' => 0, + 'mail-export' => 2, + 'ftp' => 4 ); $list_base = array_unique(array_keys($tmplog)); @@ -1122,9 +1142,9 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $params = array( - ':remain_dl' => $user->ACL()->remaining_download($base_id) - , ':base_id' => $base_id - , ':usr_id' => $user->get_id() + ':remain_dl' => $user->ACL()->remaining_download($base_id) + , ':base_id' => $base_id + , ':usr_id' => $user->get_id() ); $stmt->execute($params); diff --git a/lib/classes/set/exportftp.class.php b/lib/classes/set/exportftp.class.php index e613cd5e83..9a5ec79342 100644 --- a/lib/classes/set/exportftp.class.php +++ b/lib/classes/set/exportftp.class.php @@ -33,7 +33,7 @@ class set_exportftp extends set_export */ public function export_ftp($usr_to, $host, $login, $password, $ssl, $retry, $passif, $destfolder, $makedirectory, $logfile) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user_f = User_Adapter::getInstance($session->get_usr_id(), $appbox); $conn = $appbox->get_connection(); diff --git a/lib/classes/set/exportorder.class.php b/lib/classes/set/exportorder.class.php index 9094fa70c0..ca7470eb42 100644 --- a/lib/classes/set/exportorder.class.php +++ b/lib/classes/set/exportorder.class.php @@ -27,6 +27,8 @@ class set_exportorder extends set_export */ public function order_available_elements($from_usr_id, $usage, $deadline) { + $Core = bootstrap::getCore(); + $lst = $this->get_orderable_lst(); $conn = connection::getPDOConnection(); @@ -89,7 +91,7 @@ class set_exportorder extends set_export return false; } - $evt_mngr = eventsmanager_broker::getInstance(appbox::get_instance()); + $evt_mngr = eventsmanager_broker::getInstance(appbox::get_instance($Core), $Core); $params = array( 'order_id' => $order_id, @@ -130,7 +132,7 @@ class set_exportorder extends set_export */ public static function set_order_admins($admins, $base_id) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $conn = $appbox->get_connection(); $conn->beginTransaction(); try diff --git a/lib/classes/set/order.class.php b/lib/classes/set/order.class.php index 1c7f93104d..9f0926010e 100644 --- a/lib/classes/set/order.class.php +++ b/lib/classes/set/order.class.php @@ -66,7 +66,7 @@ class set_order extends set_abstract */ public function __construct($id) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $conn = $appbox->get_connection(); @@ -202,7 +202,7 @@ class set_order extends set_abstract */ public function send_elements(Array $elements_ids, $force) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $conn = $appbox->get_connection(); $pusher = User_Adapter::getInstance($session->get_usr_id(), $appbox); @@ -219,19 +219,41 @@ class set_order extends set_abstract } } - try - { - $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $session->get_usr_id()); - } - catch (Exception $e) - { - $basket = basket_adapter::create($appbox, sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d')), $this->user, '', $pusher); + $core = \bootstrap::getCore(); - $this->ssel_id = $basket->get_ssel_id(); + $em = $core->getEntityManager(); + + $Basket = null; + /* @var $repository \Repositories\BasketRepository */ + if($this->ssel_id) + { + $repository = $em->getRepository('\Entities\Basket'); + + try + { + $Basket = $repository->findUserBasket($this->ssel_id, $core->getAuthenticatedUser(), false); + } + catch(\Exception $e) + { + $Basket = null; + } + } + + if(!$Basket) + { + $Basket = new \Entities\Basket(); + $Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d'))); + $Basket->setOwner($this->user); + $Basket->setPusher($core->getAuthenticatedUser()); + + $em->persist($Basket); + $em->flush(); + + $this->ssel_id = $Basket->getId(); $sql = 'UPDATE `order` SET ssel_id = :ssel_id WHERE id = :order_id'; $stmt = $conn->prepare($sql); - $stmt->execute(array(':ssel_id' => $basket->get_ssel_id(), ':order_id' => $this->id)); + $stmt->execute(array(':ssel_id' => $Basket->getId(), ':order_id' => $this->id)); $stmt->closeCursor(); } @@ -254,20 +276,27 @@ class set_order extends set_abstract { $sbas_id = phrasea::sbasFromBas($basrec['base_id']); $record = new record_adapter($sbas_id, $basrec['record_id']); - $ret = $basket->push_element($record, false, false); - if ($ret['error'] === false) - { - $params = array( - ':usr_id' => $session->get_usr_id() - , ':order_id' => $this->id - , ':order_element_id' => $order_element_id - ); - $stmt->execute($params); + $BasketElement = new \Entities\BasketElement(); + $BasketElement->setRecord($record); + $BasketElement->setBasket($Basket); + + $Basket->addBasketElement($BasketElement); + + $em->persist($BasketElement); + + + $params = array( + ':usr_id' => $session->get_usr_id() + , ':order_id' => $this->id + , ':order_element_id' => $order_element_id + ); + + $stmt->execute($params); + + $n++; + $this->user->ACL()->grant_hd_on($record, $pusher, 'order'); - $n++; - $this->user->ACL()->grant_hd_on($record, $pusher, 'order'); - } unset($record); } catch (Exception $e) @@ -275,11 +304,13 @@ class set_order extends set_abstract } } + + $em->flush(); $stmt->closeCursor(); if ($n > 0) { - $evt_mngr = eventsmanager_broker::getInstance($appbox); + $evt_mngr = eventsmanager_broker::getInstance($appbox, $core); $params = array( 'ssel_id' => $this->ssel_id, @@ -301,7 +332,8 @@ class set_order extends set_abstract */ public function deny_elements(Array $elements_ids) { - $appbox = appbox::get_instance(); + $Core = bootstrap::getCore(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $conn = $appbox->get_connection(); @@ -328,7 +360,7 @@ class set_order extends set_abstract if ($n > 0) { - $evt_mngr = eventsmanager_broker::getInstance($appbox); + $evt_mngr = eventsmanager_broker::getInstance($appbox, $Core); $params = array( 'from' => $session->get_usr_id(), diff --git a/lib/classes/set/ordermanager.class.php b/lib/classes/set/ordermanager.class.php index 14b9f6714c..d135fcab26 100644 --- a/lib/classes/set/ordermanager.class.php +++ b/lib/classes/set/ordermanager.class.php @@ -37,7 +37,7 @@ class set_ordermanager extends set_abstract */ public function __construct($sort = false, $page = 1) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $conn = $appbox->get_connection(); diff --git a/lib/classes/set/selection.class.php b/lib/classes/set/selection.class.php index ce5a6ae235..77b24f04a6 100644 --- a/lib/classes/set/selection.class.php +++ b/lib/classes/set/selection.class.php @@ -31,21 +31,14 @@ class set_selection extends set_abstract /** * - * @param basket_adapter $basket - * @param boolean $flatten_if_grouping + * @param \Entities\Basket $basket * @return set_selection */ - public function load_basket(basket_adapter $basket, $flatten_if_grouping = true) + public function load_basket(\Entities\Basket $Basket) { - if ($basket->is_grouping() && !$flatten_if_grouping) + foreach ($Basket->getElements() as $basket_element) { - $record = new record_adapter($basket->get_sbas_id(), $basket->get_record_id(), count($this->elements)); - $this->add_element($record); - } - else - { - foreach ($basket->get_elements() as $basket_element) - $this->add_element($basket_element->get_record()); + $this->add_element($basket_element->getRecord()); } return $this; @@ -58,7 +51,7 @@ class set_selection extends set_abstract */ public function grep_authorized(Array $rights = array(), Array $sbas_rights = array()) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); diff --git a/lib/classes/setup.class.php b/lib/classes/setup.class.php index f906ed0f67..097e6375f3 100644 --- a/lib/classes/setup.class.php +++ b/lib/classes/setup.class.php @@ -43,6 +43,8 @@ class setup , "xml" , "zip" , "zlib" + , "intl" + , "twig" ); protected static $PHP_CONF = array( 'output_buffering' => '4096' //INI_ALL @@ -68,13 +70,20 @@ class setup public static function is_installed() { - return file_exists(dirname(__FILE__) . "/../../config/connexion.inc") - && file_exists(dirname(__FILE__) . "/../../config/config.inc"); + $appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification(); + + return $appConf->isSetup(); } - function create_global_values(registryInterface &$registry, $datas=array()) + public static function needUpgradeConfigurationFile() { - require(dirname(__FILE__) . "/../../lib/conf.d/_GV_template.inc"); + return (is_file(__DIR__ . "/../../config/connexion.inc") + && is_file(__DIR__ . "/../../config/config.inc")); + } + + function create_global_values(registryInterface &$registry, $datas = array()) + { + require(__DIR__ . "/../../lib/conf.d/_GV_template.inc"); if ($registry->is_set('GV_timezone')) @@ -257,12 +266,12 @@ class setup { if (system_server::get_platform() == 'WINDOWS') { - $exiftool = dirname(dirname(__FILE__)) . '/vendor/exiftool/exiftool.exe'; - $indexer = dirname(dirname(dirname(__FILE__))) . '/bin/phraseanet_indexer.exe'; + $exiftool = dirname(__DIR__) . '/vendor/exiftool/exiftool.exe'; + $indexer = dirname(dirname(__DIR__)) . '/bin/phraseanet_indexer.exe'; } else { - $exiftool = dirname(dirname(__FILE__)) . '/vendor/exiftool/exiftool'; + $exiftool = dirname(__DIR__) . '/vendor/exiftool/exiftool'; $indexer = null; } @@ -418,7 +427,7 @@ class setup public static function check_phrasea() { $constraints = array(); - if(function_exists('phrasea_info')) + if (function_exists('phrasea_info')) { foreach (phrasea_info() as $name => $value) { @@ -426,7 +435,7 @@ class setup { default: $result = true; - $message = $name.' = '.$value; + $message = $name . ' = ' . $value; break; case 'temp_writable': $result = $value == '1'; @@ -438,7 +447,7 @@ class setup case 'version': $result = version_compare($value, '1.18.0.3', '>='); if ($result) - $message = sprintf ('Phrasea version %s is ok', $value); + $message = sprintf('Phrasea version %s is ok', $value); else $message = sprintf('Phrasea version %s is NOT ok', $value); break; @@ -453,7 +462,7 @@ class setup public static function check_writability(registryInterface $registry) { - $root = p4string::addEndSlash(realpath(dirname(__FILE__) . '/../../')); + $root = p4string::addEndSlash(realpath(__DIR__ . '/../../')); $pathes = array( $root . 'config', @@ -551,10 +560,18 @@ class setup { if (extension_loaded($ext) !== true) { - $constraints[] = new Setup_Constraint(sprintf('Extension %s', $ext), false, sprintf('%s missing', $ext), true); + $blocker = true; + if("twig" === $ext) + { + $blocker = false; + } + + $constraints[] = new Setup_Constraint(sprintf('Extension %s', $ext), false, sprintf('%s missing', $ext), $blocker); } else - $constraints[] = new Setup_Constraint(sprintf('Extension %s', $ext), true, sprintf('%s loaded', $ext), true); + { + $constraints[] = new Setup_Constraint(sprintf('Extension %s', $ext), true, sprintf('%s loaded', $ext)); + } } return new Setup_ConstraintsIterator($constraints); @@ -562,7 +579,7 @@ class setup public static function check_cache_server() { - $availables_caches = array('memcache', 'memcached', 'redis'); + $availables_caches = array('memcache', 'redis'); $constraints = array(); foreach ($availables_caches as $ext) @@ -580,36 +597,26 @@ class setup function check_cache_memcache() { + $Core = \bootstrap::getCore(); echo '

' . _('setup:: Serveur Memcached') . '

'; echo '
    '; $registry = registry::get_instance(); - if ($registry->get('GV_cache_server_type') !== 'nocache') + if ($Core->getCache()->isServer()) { - $cache = cache_adapter::get_instance(registry::get_instance()); + $stats = $Core->getCache()->getStats(); - if ($cache->ping()) - { - $stats = $cache->getStats(); + echo '
  • ' . sprintf(_('setup::Serveur actif sur %s'), $registry->get('GV_cache_server_host') . ':' . $registry->get('GV_cache_server_port')) . '
  • '; + echo ""; - foreach ($stats as $name => $stat) - { - echo '
  • Statistics given by `' . $name . '`
  • '; - echo '
  • ' . sprintf(_('setup::Serveur actif sur %s'), $registry->get('GV_cache_server_host') . ':' . $registry->get('GV_cache_server_port')) . '
  • '; - echo "
    "; - foreach ($stat as $key => $value) - { - echo ""; - } - echo "
    " . $key . " " . $value . "
    "; - } - } - else + foreach ($stats as $name => $stat) { - echo '
  • ' . sprintf(_('Le serveur memcached ne repond pas, vous devriez desactiver le cache')) . '
  • '; + echo "" . $name . " " . $stat . ""; } + + echo ""; } else { @@ -634,9 +641,9 @@ class setup } if ($found > 1) - $constraints[] = new Setup_Constraint('Multiple opcode caches', false, 'Many opcode cache load is forbidden', true); + $constraints[] = new Setup_Constraint('Multiple opcode caches', false, _('Many opcode cache load is forbidden'), true); if ($found === 0) - $constraints[] = new Setup_Constraint('No opcode cache', false, 'No opcode cache were detected. Phraseanet strongly recommends the use of XCache or APC.', false); + $constraints[] = new Setup_Constraint('No opcode cache', false, _('No opcode cache were detected. Phraseanet strongly recommends the use of XCache or APC.'), false); return new Setup_ConstraintsIterator($constraints); } @@ -752,33 +759,14 @@ class setup return $current; } - public static function write_config($servername) + public static function rollback(connection_pdo $conn, connection_pdo $connbas = null) { - $datas = "appbox; $databox = $structure->databox; @@ -814,12 +802,13 @@ class setup } } } - $connexion = dirname(__FILE__) . "/../../config/connexion.inc"; - if (file_exists($connexion)) - unlink($connexion); + $appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification(); + + $appConf->delete(); return; } } + diff --git a/lib/classes/sphinx/configuration.class.php b/lib/classes/sphinx/configuration.class.php index b2d1278466..cbd3b40972 100644 --- a/lib/classes/sphinx/configuration.class.php +++ b/lib/classes/sphinx/configuration.class.php @@ -37,7 +37,7 @@ class sphinx_configuration public function get_available_charsets() { $available_charsets = array(); - $dir = dirname(__FILE__) . '/charsetTable/'; + $dir = __DIR__ . '/charsetTable/'; echo $dir; $registry = registry::get_instance(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) @@ -67,15 +67,17 @@ class sphinx_configuration $defaults = array( 'sbas' => self::OPT_ALL_SBAS - , 'libstemmer' => array(self::OPT_LIBSTEMMER_NONE) + , 'libstemmer' => array(self::OPT_LIBSTEMMER_NONE) , 'enable_star' => self::OPT_ENABLE_STAR_ON - , 'min_prefix_len' => self::OPT_MIN_PREFIX_LEN + , 'min_prefix_len' => self::OPT_MIN_PREFIX_LEN , 'min_infix_len' => self::OPT_MIN_INFIX_LEN , 'charset_tables' => array() ); $options = array_merge($defaults, $options); + $options['charset_tables'] = array_unique($options['charset_tables']); + $lb = phrasea::sbas_params(); $conf = ''; @@ -439,7 +441,7 @@ class sphinx_configuration path = /var/sphinx/datas/docs_realtime_' . $serialized . ' -' . $charset_abstract . ' + ' . $charset_abstract . ' rt_field = value # rt_field = meta_struct_id @@ -593,6 +595,9 @@ searchd # optional, default is 256 # max_filters = 512 + + compat_sphinxql_magics = 0 + } '; diff --git a/lib/classes/sphinxrt.class.php b/lib/classes/sphinxrt.class.php index a8c5b354ce..2a15d0313d 100644 --- a/lib/classes/sphinxrt.class.php +++ b/lib/classes/sphinxrt.class.php @@ -81,7 +81,7 @@ class sphinxrt if ($rt_id) { $this->connection->beginTransaction(); - $sql = "DELETE FROM " . $rt_id . " WHERE id = " . (int) $id . ""; + $sql = "DELETE FROM " . $rt_id . " WHERE id = " . (int) $id . ""; $stmt = $this->connection->prepare($sql); $stmt->execute(); $stmt->closeCursor(); @@ -106,7 +106,7 @@ class sphinxrt $cl->SetConnectTimeout(1); - $status = strrev($status); + $status = strrev($status); $new_stat = array(); for ($i = 4; $i < strlen($status); $i++) { @@ -122,20 +122,18 @@ class sphinxrt return $this; } - public function replace_in_metas($rt_id, $meta_id, $tag_id, $record_id, $sbas_id, $coll_id, $grouping, $type, Array $content, DateTime $created) + public function replace_in_metas($rt_id, $meta_id, $tag_id, $record_id, $sbas_id, $coll_id, $grouping, $type, $content, DateTime $created) { - $crc_sbas_tag = crc32($sbas_id . '_' . $tag_id); - $crc_sbas_coll = crc32($sbas_id . '_' . $coll_id); + $crc_sbas_tag = crc32($sbas_id . '_' . $tag_id); + $crc_sbas_coll = crc32($sbas_id . '_' . $coll_id); $crc_sbas_record = crc32($sbas_id . '_' . $record_id); - $crc_type = crc32($type); + $crc_type = crc32($type); $this->connection->beginTransaction(); -// foreach ($content as $value) -// { - $sql = "REPLACE INTO " . $rt_id . " VALUES ( + $sql = "REPLACE INTO " . $rt_id . " VALUES ( '" . (int) $meta_id . "' - ,'" . str_replace("'", "\'", implode(' ', $content)) . "' + ,'" . str_replace("'", "\'", $content) . "' ,'" . (int) $tag_id . "' ," . (int) $record_id . " ," . (int) $sbas_id . " @@ -149,7 +147,6 @@ class sphinxrt ," . (int) $created->format('U') . " )"; $stmt = $this->connection->prepare($sql); $stmt->execute(); -// } $stmt->closeCursor(); @@ -160,9 +157,9 @@ class sphinxrt public function replace_in_documents($rt_id, $record_id, $value, $sbas_id, $coll_id, $grouping, $type, DateTime $created) { - $crc_sbas_coll = crc32($sbas_id . '_' . $coll_id); + $crc_sbas_coll = crc32($sbas_id . '_' . $coll_id); $crc_sbas_record = crc32($sbas_id . '_' . $record_id); - $crc_type = crc32($type); + $crc_type = crc32($type); $this->connection->beginTransaction(); diff --git a/lib/classes/supertwig.class.php b/lib/classes/supertwig.class.php deleted file mode 100644 index 3f127dacfd..0000000000 --- a/lib/classes/supertwig.class.php +++ /dev/null @@ -1,267 +0,0 @@ - $extensions - * @param $options - * @return supertwig - */ - public function __construct($extensions = array(), $options = array()) - { - $browser = Browser::getInstance(); - $this->load_default_vars(); - $registry = registry::get_instance(); - - if (($browser->isTablet())) - { - $this->ld_path = array( - $registry->get('GV_RootPath') . 'config/templates/mobile', - $registry->get('GV_RootPath') . 'templates/mobile' - ); - } - elseif ($browser->isMobile()) - { - $this->ld_path = array( - $registry->get('GV_RootPath') . 'config/templates/mobile', - $registry->get('GV_RootPath') . 'templates/mobile' - ); - } - else - { - $this->ld_path = array( - $registry->get('GV_RootPath') . 'config/templates/web', - $registry->get('GV_RootPath') . 'templates/web' - ); - } - - - $default_extensions = array('I18n' => true, 'Optimizer' => true); - - if ($registry->get('GV_debug')) - { - $default_options = array( - 'debug' => true, - 'strict_variables' => false, - 'trim_blocks' => true, - 'charset' => 'utf-8', - 'auto_reload' => true - ); - $default_extensions['Debug'] = true; - } - else - { - $default_options = array( - 'cache' => $registry->get('GV_RootPath') . 'tmp/cache_twig', - 'debug' => false, - 'strict_variables' => false, - 'trim_blocks' => true, - 'charset' => 'utf-8' - ); - } - - $options = array_merge($default_options, $options); - $extensions = array_merge($default_extensions, $extensions); - - try - { - $this->set_options($options); - $this->init_twig(); - $this->set_extensions($extensions); - $this->addFilter(array('round' => 'round')); - } - catch (Exception $e) - { - - } - - return $this; - } - - /** - * - * @param array $filters - * @return supertwig - */ - public function addFilter(Array $filters) - { - foreach ($filters as $name => $function) - { - $this->twig_object->addFilter($name, new Twig_Filter_Function($function)); - } - - return $this; - } - - /** - * - * @param string $path - * @param string $var - * @return string - */ - public function render($path, $var) - { - $template = $this->twig_object->loadTemplate($path); - - $var = array_merge($this->default_vars, $var); - - return $template->render($var); - } - - /** - * - * @param string $path - * @param string $var - * @return void - */ - public function display($path, $var) - { - $template = $this->twig_object->loadTemplate($path); - - $var = array_merge($this->default_vars, $var); - - return $template->display($var); - } - - /** - * - * @param array $options - * @return supertwig - */ - protected function set_options(Array $options) - { - foreach ($options as $key => $value) - { - $this->options[$key] = $value; - } - - return $this; - } - - /** - * - * @return supertwig - */ - protected function init_twig() - { - $loader = new Twig_Loader_Filesystem($this->ld_path); - - if (sizeof($this->options) > 0) - $this->twig_object = new Twig_Environment($loader, $this->options); - else - $this->twig_object = new Twig_Environment($loader); - - return $this; - } - - /** - * - * @param array $extensions - * @return supertwig - */ - protected function set_extensions(Array $extensions) - { - $twig_lib = array('core', 'escaper', 'optimizer', 'sandbox'); - foreach ($extensions as $name => $boolean) - { - $name = strtolower($name); - $boolean = !!$boolean; - $this->extensions[$name] = $boolean; - - if ($boolean) - { - if (in_array($name, $twig_lib)) - $extension_classname = 'Twig_Extension_' . ucfirst($name); - else - $extension_classname = 'Twig_Extensions_Extension_' . ucfirst($name); - - $this->twig_object->addExtension(new $extension_classname()); - } - else - { - $this->twig_object->removeExtension($name); - } - } - - return $this; - } - - /** - * - * @return supertwig - */ - protected function load_default_vars() - { - if (!$this->default_vars) - { - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - $browser = Browser::getInstance(); - $registry = $appbox->get_registry(); - $request = new http_request(); - - $user = false; - if ($session->is_authenticated()) - { - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - } - - $this->default_vars = array( - 'session' => $session, - 'version_number' => GV_version, - 'version_name' => GV_version_name, - 'browser' => $browser, - 'request' => $request, - 'display_chrome_frame' => $registry->is_set('GV_display_gcf') ? $registry->get('GV_display_gcf') : true, - 'user' => $user, - 'current_date' => new DateTime(), - 'home_title' => $registry->get('GV_homeTitle'), - 'meta_description' => $registry->get('GV_metaDescription'), - 'meta_keywords' => $registry->get('GV_metaKeywords'), - 'maintenance' => $registry->get('GV_maintenance'), - 'registry' => $registry - ); - } - - return $this; - } - -} - diff --git a/lib/classes/system/file.class.php b/lib/classes/system/file.class.php index d5e3024fce..dbd4369f6d 100644 --- a/lib/classes/system/file.class.php +++ b/lib/classes/system/file.class.php @@ -1130,12 +1130,15 @@ class system_file extends SplFileObject $tmpval[] = $val; } - $ret[$meta->get_id()] = array( + foreach ($tmpval as $val) + { + $ret[] = array( 'meta_struct_id' => $meta->get_id(), 'meta_id' => null, - 'value' => $tmpval + 'value' => $val ); } + } $statBit = null; @@ -1205,16 +1208,19 @@ class system_file extends SplFileObject $fv = array($fv); } - if (isset($metadatas[$meta->get_id()]) && $meta->is_multi() === true) - { - $fv = array_unique(array_merge($metadatas[$meta->get_id()], $fv)); - } +// if (isset($metadatas[$meta->get_id()]) && $meta->is_multi() === true) +// { +// $fv = array_unique(array_merge($metadatas[$meta->get_id()], $fv)); +// } - $metadatas[$meta->get_id()] = array( - 'meta_struct_id' => $meta->get_id(), - 'meta_id' => null, - 'value' => $fv - ); + foreach($fv as $value) + { + $metadatas[] = array( + 'meta_struct_id' => $meta->get_id(), + 'meta_id' => null, + 'value' => $value + ); + } unset($meta); } diff --git a/lib/classes/task/Scheduler.class.php b/lib/classes/task/Scheduler.class.php index 516ba7ee19..b70dfe0258 100644 --- a/lib/classes/task/Scheduler.class.php +++ b/lib/classes/task/Scheduler.class.php @@ -638,4 +638,4 @@ class task_Scheduler $this->log("Scheduler2 has quit.\n"); } -} \ No newline at end of file +} diff --git a/lib/classes/task/appboxAbstract.class.php b/lib/classes/task/appboxAbstract.class.php index 80344bea4c..0496f397ff 100644 --- a/lib/classes/task/appboxAbstract.class.php +++ b/lib/classes/task/appboxAbstract.class.php @@ -66,7 +66,7 @@ abstract class task_appboxAbstract extends task_abstract if (!$this->running) break; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); try { $this->load_settings(simplexml_load_string($row['settings'])); @@ -153,12 +153,6 @@ abstract class task_appboxAbstract extends task_abstract ->check_records_done() ->check_task_status(); - if ($conn instanceof PDO) - { - $conn->close(); - unset($conn); - } - if ($rowstodo > 0) $this->setProgress(0, 0); diff --git a/lib/classes/task/period/apibridge.class.php b/lib/classes/task/period/apibridge.class.php index 998cd15f9d..10517c335e 100644 --- a/lib/classes/task/period/apibridge.class.php +++ b/lib/classes/task/period/apibridge.class.php @@ -145,6 +145,7 @@ class task_period_apibridge extends task_appboxAbstract */ protected function update_element(Bridge_Element &$element) { + $Core = bootstrap::getCore(); $account = $element->get_account(); $connector_status = $account->get_api()->get_element_status($element); @@ -176,7 +177,7 @@ class task_period_apibridge extends task_appboxAbstract , 'sbas_id' => $element->get_record()->get_sbas_id() , 'record_id' => $element->get_record()->get_record_id() ); - $events_mngr = eventsmanager_broker::getInstance(appbox::get_instance()); + $events_mngr = eventsmanager_broker::getInstance(appbox::get_instance(\bootstrap::getCore()), $Core); $events_mngr->trigger('__BRIDGE_UPLOAD_FAIL__', $params); break; diff --git a/lib/classes/task/period/archive.class.php b/lib/classes/task/period/archive.class.php index dd2b26a53c..c48f898cc7 100644 --- a/lib/classes/task/period/archive.class.php +++ b/lib/classes/task/period/archive.class.php @@ -223,7 +223,7 @@ class task_period_archive extends task_abstract */ public function printInterfaceHTML() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); ob_start(); ?> @@ -828,12 +828,14 @@ class task_period_archive extends task_abstract { $magicmethod = strtoupper($sxDotPhrasea->magicfile['method']); if($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile)) + return; elseif($magicmethod == 'UNLOCK' && !file_exists($path . '/' . $magicfile)) + return; } } - + while(($file = $listFolder->read()) !== NULL) { // on gere le magicfile diff --git a/lib/classes/task/period/batchupload.class.php b/lib/classes/task/period/batchupload.class.php index 1086a14e6e..7b788a2427 100644 --- a/lib/classes/task/period/batchupload.class.php +++ b/lib/classes/task/period/batchupload.class.php @@ -54,7 +54,7 @@ class task_period_batchupload extends task_appboxAbstract protected function process_one_content(appbox $appbox, Array $row) { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); $conn = $appbox->get_connection(); $session = $appbox->get_session(); diff --git a/lib/classes/task/period/emptyColl.class.php b/lib/classes/task/period/emptyColl.class.php index c31398f1ba..300a497e47 100644 --- a/lib/classes/task/period/emptyColl.class.php +++ b/lib/classes/task/period/emptyColl.class.php @@ -57,7 +57,7 @@ class task_period_emptyColl extends task_appboxAbstract $collection = collection::get_from_base_id($this->base_id); $this->total_records = $collection->get_record_amount(); $collection->empty_collection(200); - $this->records_done += $this->total_records; + $this->records_done +=$this->total_records; $this->setProgress($this->records_done, $this->total_records); if ($this->total_records == 0) diff --git a/lib/classes/task/period/outofdate.class.php b/lib/classes/task/period/outofdate.class.php index 3019531f86..f269f12a90 100644 --- a/lib/classes/task/period/outofdate.class.php +++ b/lib/classes/task/period/outofdate.class.php @@ -291,7 +291,6 @@ class task_period_outofdate extends task_abstract , async:false , success:function(data) { - // console.log(data); var html = ""; for(i in data.date_fields) html += "\n"; @@ -401,7 +400,7 @@ class task_period_outofdate extends task_abstract { global $usr_id; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); ob_start(); @@ -627,9 +626,7 @@ class task_period_outofdate extends task_abstract $duration = time() - $duration; if($duration < $period) { - $conn->close(); sleep($period - $duration); - unset($conn); $conn = connection::getPDOConnection(); } break; diff --git a/lib/classes/task/period/upgradetov31.class.php b/lib/classes/task/period/upgradetov31.class.php index 9b66a7cb39..9734f1b4b5 100644 --- a/lib/classes/task/period/upgradetov31.class.php +++ b/lib/classes/task/period/upgradetov31.class.php @@ -43,7 +43,7 @@ class task_period_upgradetov31 extends task_abstract { printf("taskid %s starting." . PHP_EOL, $this->get_task_id()); // task can't be stopped here - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $conn = $appbox->get_connection(); $registry = $appbox->get_registry(); $running = true; @@ -58,7 +58,7 @@ class task_period_upgradetov31 extends task_abstract $todo = $this->how_many_left(); $done = 0; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $ret = 'stopped'; $this->setProgress($done, $todo); @@ -156,7 +156,7 @@ class task_period_upgradetov31 extends task_abstract private function how_many_left() { $todo = 0; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); foreach ($appbox->get_databoxes() as $databox) { diff --git a/lib/classes/task/period/upgradetov32.class.php b/lib/classes/task/period/upgradetov32.class.php index c3d1138b6c..337d39ad25 100644 --- a/lib/classes/task/period/upgradetov32.class.php +++ b/lib/classes/task/period/upgradetov32.class.php @@ -61,8 +61,8 @@ class task_period_upgradetov32 extends task_abstract printf("taskid %s starting." . PHP_EOL, $this->get_task_id()); $registry = registry::get_instance(); - $registry->set('GV_cache_server_type', 'nocache'); - $registry->set('GV_sphinx', false); +// $registry->set('GV_cache_server_type', 'nocache', \registry::TYPE_STRING); + $registry->set('GV_sphinx', false, \registry::TYPE_BOOLEAN); if (!$this->sbas_id) { diff --git a/lib/classes/task/period/workflow01.class.php b/lib/classes/task/period/workflow01.class.php index 94a550b673..a48d8083de 100644 --- a/lib/classes/task/period/workflow01.class.php +++ b/lib/classes/task/period/workflow01.class.php @@ -308,7 +308,7 @@ class task_period_workflow01 extends task_databoxAbstract public function printInterfaceHTML() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); ob_start(); @@ -475,7 +475,7 @@ class task_period_workflow01 extends task_databoxAbstract { $request = http_request::getInstance(); - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); diff --git a/lib/classes/task/period/writemeta.class.php b/lib/classes/task/period/writemeta.class.php index 726aa92278..da8d749502 100644 --- a/lib/classes/task/period/writemeta.class.php +++ b/lib/classes/task/period/writemeta.class.php @@ -183,7 +183,7 @@ class task_period_writemeta extends task_databoxAbstract public function printInterfaceHTML() { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); $sbas_ids = User_Adapter::getInstance($session->get_usr_id(), $appbox) ->ACL()->get_granted_sbas(array('bas_manage')); @@ -310,9 +310,9 @@ class task_period_writemeta extends task_databoxAbstract if ($record->get_uuid()) { - $subCMD .= '-XMP-exif:ImageUniqueID='; + $subCMD .= ' -XMP-exif:ImageUniqueID='; $subCMD .= escapeshellarg($record->get_uuid()); - $subCMD .= '-IPTC:UniqueDocumentID='; + $subCMD .= ' -IPTC:UniqueDocumentID='; $subCMD .= escapeshellarg($record->get_uuid()); } @@ -325,24 +325,24 @@ class task_period_writemeta extends task_databoxAbstract $multi = $meta->is_multi(); $type = $meta->get_type(); - $datas = $field->get_value(); + $datas = $field->get_values(); if ($multi) { - $datas = $field->get_value(); foreach ($datas as $value) { - $value = $this->format_value($type, $value); + $value = $this->format_value($type, $value->getValue()); - $subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; + $subCMD .= ' -'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; $subCMD .= escapeshellarg($value).' '; } } else { - $datas = $this->format_value($type, $datas); + $value = array_pop($datas); + $datas = $this->format_value($type, $value->getValue()); - $subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; + $subCMD .= ' -'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; $subCMD .= escapeshellarg($datas).' '; } } @@ -354,7 +354,7 @@ class task_period_writemeta extends task_databoxAbstract $cmd = 'start /B /LOW '; $cmd .= ( $registry->get('GV_exiftool') . ' -m -overwrite_original '); if ($name != 'document' || $this->clear_doc) - $cmd .= '-all:all= '; + $cmd .= ' -all:all= '; $cmd .= ' -codedcharacterset=utf8 '; diff --git a/lib/classes/unicode.class.php b/lib/classes/unicode.class.php index 0838b5ea9a..274d7f5b9d 100644 --- a/lib/classes/unicode.class.php +++ b/lib/classes/unicode.class.php @@ -1391,7 +1391,7 @@ class unicode return $no_diacritics; } - public function remove_nonazAZ09($string, $keep_underscores = true, $keep_minus = true) + public function remove_nonazAZ09($string, $keep_underscores = true, $keep_minus = true, $keep_dot = false) { $regexp = '/[a-zA-Z0-9'; if ($keep_minus === true) @@ -1402,6 +1402,11 @@ class unicode { $regexp .= '_'; } + if ($keep_dot === true) + { + $regexp .= '\.'; + } + $regexp .= ']{1}/'; $string = $this->remove_diacritics($string); diff --git a/lib/conf.d/Doctrine/Entities.Basket.dcm.yml b/lib/conf.d/Doctrine/Entities.Basket.dcm.yml new file mode 100644 index 0000000000..3d0ec3323b --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.Basket.dcm.yml @@ -0,0 +1,46 @@ +Entities\Basket: + type: entity + repositoryClass: Repositories\BasketRepository + table: Baskets + id: + id: + type: integer + generator: + strategy: AUTO + fields: + name: + type: string + length: 128 + description: + type: text + nullable: true + usr_id: + type: integer + is_read: + type: boolean + pusher_id: + type: integer + nullable: true + archived: + type: boolean + default: false + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + oneToOne: + validation: + targetEntity: ValidationSession + mappedBy: basket + cascade: ["ALL"] + oneToMany: + elements: + targetEntity: BasketElement + mappedBy: basket + cascade: ["ALL"] diff --git a/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml b/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml new file mode 100644 index 0000000000..a37e116d87 --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml @@ -0,0 +1,45 @@ +Entities\BasketElement: + type: entity + repositoryClass: Repositories\BasketElementRepository + table: BasketElements + uniqueConstraints: + unique_recordcle: + columns: basket_id,sbas_id,record_id + id: + id: + type: integer + generator: + strategy: AUTO + + fields: + record_id: + type: integer + sbas_id: + type: integer + ord: + type: integer + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + manyToOne: + basket: + targetEntity: Basket + inversedBy: elements + joinColumn: + name: basket_id + referencedColumnName: id + cascade: ["persist"] + oneToMany: + validation_datas: + targetEntity: ValidationData + mappedBy: basket_element + cascade: ["ALL"] + lifecycleCallbacks: + prePersist: [ setLastInBasket ] diff --git a/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml b/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml new file mode 100644 index 0000000000..fd82c27ebc --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml @@ -0,0 +1,29 @@ +Entities\StoryWZ: + type: entity + repositoryClass: Repositories\StoryWZRepository + table: StoryWZ + uniqueConstraints: + user_story: + columns: usr_id,sbas_id,record_id + id: + id: + type: integer + generator: + strategy: AUTO + fields: + sbas_id: + type: integer + record_id: + type: integer + usr_id: + type: integer + created: + type: datetime + gedmo: + timestampable: + on: create + + + + + diff --git a/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml new file mode 100644 index 0000000000..6eb3597d9e --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml @@ -0,0 +1,33 @@ +Entities\UsrList: + type: entity + repositoryClass: Repositories\UsrListRepository + table: UsrLists + id: + id: + type: integer + generator: + strategy: AUTO + fields: + name: + type: string + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + oneToMany: + owners: + targetEntity: UsrListOwner + mappedBy: list + cascade: ["ALL"] + entries: + targetEntity: UsrListEntry + mappedBy: list + cascade: ["ALL"] + + diff --git a/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml new file mode 100644 index 0000000000..952bb9498b --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml @@ -0,0 +1,35 @@ +Entities\UsrListEntry: + type: entity + repositoryClass: Repositories\UsrListEntryRepository + table: UsrListsContent + uniqueConstraints: + unique_usr_per_list: + columns: usr_id,list_id + id: + id: + type: integer + generator: + strategy: AUTO + fields: + usr_id: + type: integer + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + manyToOne: + list: + targetEntity: UsrList + inversedBy: users + joinColumn: + name: list_id + referencedColumnName: id + cascade: ["persist"] + + diff --git a/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml new file mode 100644 index 0000000000..9fb72bc084 --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml @@ -0,0 +1,38 @@ +Entities\UsrListOwner: + type: entity + repositoryClass: Repositories\UsrListOwnerRepository + table: UsrListOwners + uniqueConstraints: + unique_owner: + columns: usr_id,id + id: + id: + type: integer + generator: + strategy: AUTO + fields: + usr_id: + type: integer + role: + type: string + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + manyToOne: + list: + targetEntity: UsrList + inversedBy: owners + joinColumn: + name: list_id + referencedColumnName: id + cascade: ["persist"] + + + diff --git a/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml new file mode 100644 index 0000000000..0133e0da2d --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml @@ -0,0 +1,35 @@ +Entities\ValidationData: + type: entity + table: ValidationDatas + id: + id: + type: integer + generator: + strategy: AUTO + fields: + agreement: + type: boolean + nullable: true + note: + type: text + nullable: true + updated: + type: datetime + gedmo: + timestampable: + on: update + manyToOne: + participant: + targetEntity: ValidationParticipant + inversedBy: datas + joinColumn: + name: participant_id + referencedColumnName: id + cascade: ["persist"] + basket_element: + targetEntity: BasketElement + inversedBy: validation_datas + joinColumn: + name: basket_element_id + referencedColumnName: id + cascade: ["persist"] diff --git a/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml new file mode 100644 index 0000000000..0d458c6e9d --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml @@ -0,0 +1,36 @@ +Entities\ValidationParticipant: + type: entity + repositoryClass: Repositories\ValidationParticipantRepository + table: ValidationParticipants + id: + id: + type: integer + generator: + strategy: AUTO + fields: + usr_id: + type: integer + is_aware: + type: boolean + is_confirmed: + type: boolean + can_agree: + type: boolean + can_see_others: + type: boolean + reminded: + type: datetime + nullable: true; + oneToMany: + datas: + targetEntity: ValidationData + mappedBy: participant + cascade: ["ALL"] + manyToOne: + session: + targetEntity: ValidationSession + inversedBy: participants + joinColumn: + name: ValidationSession_id + referencedColumnName: id + cascade: ["persist"] diff --git a/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml new file mode 100644 index 0000000000..1c3c901c27 --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml @@ -0,0 +1,41 @@ +Entities\ValidationSession: + type: entity + table: ValidationSessions + id: + id: + type: integer + generator: + strategy: AUTO + fields: + initiator_id: + type: integer + created: + type: datetime + gedmo: + timestampable: + on: create + updated: + type: datetime + gedmo: + timestampable: + on: update + expires: + type: datetime + nullable: true + oneToOne: + basket: + targetEntity: Basket + inversedBy: validation + joinColumn: + name: basket_id + referencedColumnName: id + cascade: ["persist"] + oneToMany: + participants: + targetEntity: ValidationParticipant + mappedBy: session + cascade: ["ALL"] + + + + diff --git a/lib/conf.d/PhraseaFixture/AbstractWZ.php b/lib/conf.d/PhraseaFixture/AbstractWZ.php new file mode 100644 index 0000000000..8c80f2d384 --- /dev/null +++ b/lib/conf.d/PhraseaFixture/AbstractWZ.php @@ -0,0 +1,50 @@ +user; + } + + public function setUser(\User_Adapter $user) + { + $this->user = $user; + } + + + public function getRecord() + { + return $this->record; + } + + public function setRecord(\record_adapter $record) + { + $this->record = $record; + } + +} diff --git a/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php b/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php new file mode 100644 index 0000000000..3e42b13034 --- /dev/null +++ b/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php @@ -0,0 +1,56 @@ +setName('test ' . $i); + $basket->setDescription('description'); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new basket'); + } + + $basket->setOwner($this->user); + + $manager->persist($basket); + + $this->baskets[] = $basket; + } + $this->addReference('five-basket', $basket); + $manager->flush(); + } + +} diff --git a/lib/conf.d/PhraseaFixture/Basket/LoadOneBasket.php b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasket.php new file mode 100644 index 0000000000..fc9ea7083c --- /dev/null +++ b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasket.php @@ -0,0 +1,54 @@ +setName('test'); + $basket->setDescription('description'); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new basket'); + } + + $basket->setOwner($this->user); + + $manager->persist($basket); + $manager->flush(); + + $this->basket = $basket; + + $this->addReference('one-basket', $basket); + } + +} diff --git a/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php new file mode 100644 index 0000000000..6ab35c431c --- /dev/null +++ b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php @@ -0,0 +1,138 @@ +participants[] = $user; + } + + public function addBasketElement(\record_adapter $record) + { + $this->basketElements[] = $record; + } + + public function load($manager) + { + $basket = new \Entities\Basket(); + + $basket->setName('test'); + + $basket->setDescription('description'); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new basket'); + } + + $basket->setOwner($this->user); + + $this->addElementToBasket($manager, $basket); + + $validationSession = new \Entities\ValidationSession(); + + $validationSession->setBasket($basket); + + $validationSession->setDescription('Une description au hasard'); + + $validationSession->setName('Un nom de validation'); + + $expires = new \DateTime(); + $expires->modify('+1 week'); + + $validationSession->setExpires($expires); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new validation Session'); + } + + $validationSession->setInitiator($this->user); + + $this->addParticipantsToSession($manager, $validationSession); + + $this->basket = $basket; + } + + private function addParticipantsToSession(\Doctrine\ORM\EntityManager $manager, \Entities\ValidationSession $validationSession) + { + if (0 === count($this->participants)) + { + throw new \LogicException('Add new participants to validation session'); + } + + foreach ($this->participants as $participant) + { + $validationParticipant = new \Entities\ValidationParticipant(); + + $validationParticipant->setUser($participant); + + $validationParticipant->setSession($validationSession); + + $manager->persist($validationParticipant); + } + + $manager->flush(); + } + + private function addElementToBasket(\Doctrine\ORM\EntityManager $manager, \Entities\Basket $basket) + { + if (0 === count($this->basketElements)) + { + throw new \LogicException('Add new elements to basket'); + } + + foreach ($this->basketElements as $record) + { + $basketElement = new \Entities\BasketElement(); + + $basketElement->setRecord($record); + + $basketElement->setBasket($basket); + + $manager->persist($basketElement); + } + + $manager->flush(); + } + +} diff --git a/lib/conf.d/PhraseaFixture/Story/LoadOneStory.php b/lib/conf.d/PhraseaFixture/Story/LoadOneStory.php new file mode 100644 index 0000000000..2a29f6b1de --- /dev/null +++ b/lib/conf.d/PhraseaFixture/Story/LoadOneStory.php @@ -0,0 +1,57 @@ +record) + { + throw new \LogicException('Fill a record to store a new story'); + } + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new story'); + } + + $story->setRecord($this->record); + $story->setUser($this->user); + + $manager->persist($story); + $manager->flush(); + + $this->story = $story; + + $this->addReference('one-story', $story); + } + +} diff --git a/lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php b/lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php new file mode 100644 index 0000000000..29f360d934 --- /dev/null +++ b/lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php @@ -0,0 +1,45 @@ +user; + } + + public function setUser(\User_Adapter $user) + { + $this->user = $user; + } + + public function getList() + { + return $this->list; + } + + public function setList(\Entities\UsrList $list) + { + $this->list = $list; + } + +} diff --git a/lib/conf.d/PhraseaFixture/UsrLists/UsrList.php b/lib/conf.d/PhraseaFixture/UsrLists/UsrList.php new file mode 100644 index 0000000000..14a23a824a --- /dev/null +++ b/lib/conf.d/PhraseaFixture/UsrLists/UsrList.php @@ -0,0 +1,53 @@ +getReference('one-listowner'); + + $list->setName('new list'); + $list->addUsrListOwner($owner); + + /* @var $owner \Entities\UsrListOwner */ + $owner->setList($list); + + $manager->persist($list); + $manager->merge($owner); + $manager->flush(); + + $this->list = $list; + + $this->addReference('one-list', $list); + } + +} diff --git a/lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php b/lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php new file mode 100644 index 0000000000..7d5e00e823 --- /dev/null +++ b/lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php @@ -0,0 +1,64 @@ +user) + { + throw new \LogicException('Fill a user to store a new basket'); + } + + $list = $this->getReference('one-list'); + + $entry->setUser($this->user); + $entry->setList($list); + + /* @var $list \Entities\UsrList */ + $list->addUsrListEntry($entry); + + $manager->persist($entry); + $manager->flush(); + + $this->entry = $entry; + + $this->addReference('one-entry', $entry); + } + +} diff --git a/lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php b/lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php new file mode 100644 index 0000000000..7da0fa90c9 --- /dev/null +++ b/lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php @@ -0,0 +1,51 @@ +setRole(\Entities\UsrListOwner::ROLE_ADMIN); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new basket'); + } + + $owner->setUser($this->user); + + $manager->persist($owner); + $manager->flush(); + + $this->owner = $owner; + + $this->addReference('one-listowner', $owner); + } + +} diff --git a/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadOneParticipant.php b/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadOneParticipant.php new file mode 100644 index 0000000000..fb03a0d1ff --- /dev/null +++ b/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadOneParticipant.php @@ -0,0 +1,54 @@ +user) + { + throw new \LogicException('Fill a user to store a new validation Session'); + } + $validationParticipant->setParticipant($this->user); + + $validationParticipant->setSession( + $this->getReference('one-validation-session') + ); + + $manager->persist($validationParticipant); + $manager->flush(); + + $this->validationParticipant = $validationParticipant; + + $this->addReference('one-validation-participant', $validationParticipant); + } + +} diff --git a/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadParticipantWithSession.php b/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadParticipantWithSession.php new file mode 100644 index 0000000000..e730e949da --- /dev/null +++ b/lib/conf.d/PhraseaFixture/ValidationParticipant/LoadParticipantWithSession.php @@ -0,0 +1,66 @@ +user) + { + throw new \LogicException('Fill a user to store a new validation Session'); + } + $validationParticipant->setUser($this->user); + + if (null === $this->session) + { + throw new \LogicException('Attach a session to the current participant'); + } + $validationParticipant->setSession($this->session); + + $manager->persist($validationParticipant); + $manager->flush(); + + $this->validationParticipant = $validationParticipant; + } + + public function setSession(\Entities\ValidationSession $session) + { + $this->session = $session; + } + + +} diff --git a/lib/conf.d/PhraseaFixture/ValidationSession/LoadOneValidationSession.php b/lib/conf.d/PhraseaFixture/ValidationSession/LoadOneValidationSession.php new file mode 100644 index 0000000000..b25457ef4d --- /dev/null +++ b/lib/conf.d/PhraseaFixture/ValidationSession/LoadOneValidationSession.php @@ -0,0 +1,61 @@ +setBasket( + $this->getReference('one-basket') // load the one-basket stored reference + ); + + $validationSession->setDescription('Une description au hasard'); + $validationSession->setName('Un nom de validation'); + + $expires = new \DateTime(); + $expires->modify('+1 week'); + $validationSession->setExpires($expires); + + if (null === $this->user) + { + throw new \LogicException('Fill a user to store a new validation Session'); + } + $validationSession->setInitiator($this->user); + + $manager->persist($validationSession); + $manager->flush(); + + $this->validationSession = $validationSession; + + $this->addReference('one-validation-session', $validationSession); + } + +} diff --git a/lib/conf.d/_GV_template.inc b/lib/conf.d/_GV_template.inc index 12e93999c3..f2e4a8a24c 100644 --- a/lib/conf.d/_GV_template.inc +++ b/lib/conf.d/_GV_template.inc @@ -10,8 +10,10 @@ $GV_sit = md5(time() . '--' . mt_rand(1000000, 9999999)); include_once dirname(__FILE__) . "/../../lib/classes/User/Interface.class.php"; include_once dirname(__FILE__) . "/../../lib/classes/User/Adapter.class.php"; -$lngs = User_Adapter::avLanguages(); + +$lngs = User_Adapter::avLanguages(); $avLanguages = array(); + foreach ($lngs as $lng => $locales) { foreach ($locales as $loc => $locname) @@ -19,29 +21,49 @@ foreach ($lngs as $lng => $locales) $avLanguages[$loc] = $locname['name']; } } - $eventsmanager = eventsmanager_broker::getInstance(appbox::get_instance()); +$Core = \bootstrap::getCore(); + +$extractDateFields = function(\Alchemy\Phrasea\Core $Core) { + $date_sort_fields = array(''=>''); + if ($Core->getConfiguration()->isInstalled()) + { + $ProdHelper = new Alchemy\Phrasea\Helper\Prod($Core, Symfony\Component\HttpFoundation\Request::createFromGlobals()); + $datas = $ProdHelper->get_search_datas(); + foreach ($datas['dates'] as $date) + { + $date_sort_fields[$date['fieldname']] = $date['fieldname']; + } + } + + return $date_sort_fields; +}; + +$date_sort_fields = $extractDateFields($Core); + + +$eventsmanager = eventsmanager_broker::getInstance(appbox::get_instance($Core), $Core); $PHP_CONF = array( - 'output_buffering' => '4096' //INI_ALL - , 'memory_limit' => '1024M' //INI_ALL - , 'error_reporting' => '6143' //INI_ALL - , 'default_charset' => 'UTF-8' //INI_ALL - , 'session.use_cookies' => '1' //INI_ALL - , 'session.use_only_cookies' => '1' //INI_ALL - , 'session.auto_start' => '0' //INI_ALL - , 'session.hash_function' => '1' //INI_ALL - , 'session.hash_bits_per_character' => '6' //INI_ALL - , 'allow_url_fopen' => 'on' //INI_ALL - , 'display_errors' => 'off' //INI_ALL - , 'display_startup_errors' => 'off' //INI_ALL - , 'log_errors' => 'off' //INI_ALL + 'output_buffering' => '4096' //INI_ALL + , 'memory_limit' => '1024M' //INI_ALL + , 'error_reporting' => '6143' //INI_ALL + , 'default_charset' => 'UTF-8' //INI_ALL + , 'session.use_cookies' => '1' //INI_ALL + , 'session.use_only_cookies' => '1' //INI_ALL + , 'session.auto_start' => '0' //INI_ALL + , 'session.hash_function' => '1' //INI_ALL + , 'session.hash_bits_per_character' => '6' //INI_ALL + , 'allow_url_fopen' => 'on' //INI_ALL + , 'display_errors' => 'off' //INI_ALL + , 'display_startup_errors' => 'off' //INI_ALL + , 'log_errors' => 'off' //INI_ALL ); -$PHP_REQ = array( - 'safe_mode' => 'off' - , 'file_uploads' => '1' - , 'magic_quotes_runtime' => 'off' //INI_ALL - , 'magic_quotes_gpc' => 'off' //INI_PER_DIR -- just for check +$PHP_REQ = array( + 'safe_mode' => 'off' + , 'file_uploads' => '1' + , 'magic_quotes_runtime' => 'off' //INI_ALL + , 'magic_quotes_gpc' => 'off' //INI_PER_DIR -- just for check ); $youtube_console_url = 'https://code.google.com/apis/console/'; @@ -57,470 +79,452 @@ $dailymotion_callback = '/prod/bridge/callback/dailymotion/'; $create_api_dailymotion = 'http://www.dailymotion.com/profile/developer'; $GV = array( - array( - 'section' => _('GV::section:: Serveur HTTP'), - 'vars' => array( - array( - 'type' => 'timezone', - 'name' => 'GV_timezone', - 'comment' => _('reglages:: Timezone de l\'installation'), - 'default' => 'Europe/Paris', - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_sit', - 'comment' => _('reglages:: Nom de linstallation'), - 'default' => $GV_sit, - 'readonly' => true, - 'required' => true - ), - array( - 'type' => 'enum', - 'name' => 'GV_default_lng', - 'comment' => _('reglages:: Langue par defaut'), - 'default' => 'fr_FR', - 'available' => $avLanguages, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_STATIC_URL', - 'end_slash' => false, - 'comment' => _('reglages:: URL statique (optionnel)'), - 'default' => '', - 'required' => false - ) - ) - ), array( - 'section' => _('GV::section:: Etat de maintenance'), - 'rolled' => true, - 'vars' => array( - array( - 'type' => 'text', - 'name' => 'GV_message', - 'comment' => _('reglages:: Message a diffuser aux utilisateurs'), - 'default' => "May the force be with you" - ), - array( - 'type' => 'boolean', - 'name' => 'GV_message_on', - 'comment' => _('reglages:: activation du message a diffuser aux utilistaeurs'), - 'default' => false - ), - array( - 'type' => 'boolean', - 'name' => 'GV_log_errors', - 'comment' => _('reglages:: logguer les erreurs'), - 'default' => false - ) - ) - ), array( - 'section' => _('GV::section:: Connectivite aux webservices'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_google_api', - 'comment' => _('reglages:: Utiliser els google apis'), - 'default' => true, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_i18n_service', - 'comment' => _('reglages:: Service phrasea de localisation'), - 'default' => 'http://localization.webservice.alchemyasp.com/', - 'end_slash' => true, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_bitly_user', - 'comment' => _('reglages:: Nom d\'utilisateur pour l\'api bit.ly'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_bitly_key', - 'comment' => _('reglages:: ccle d\'api pour l\'api bit.ly'), - 'default' => '', - ), - array( - 'type' => 'boolean', - 'name' => 'GV_captchas', - 'comment' => _('reglages:: Utilisation de l\'api recpatcha'), - 'default' => false, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_captcha_public_key', - 'comment' => _('reglages:: clef publique recaptcha'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_captcha_private_key', - 'comment' => _('reglages:: clef privee recaptcha'), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Connectivite a Youtube'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_youtube_api', - 'comment' => sprintf(_('reglages:: Utiliser l\'api youtube, voir %s,
    mettre la callback a WEBSITE_URL/prod/bridge/callback/youtube'), $youtube_console_url), - 'default' => false, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_youtube_client_id', - 'comment' => _('reglages:: Youtube client id'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_youtube_client_secret', - 'comment' => _('reglages:: Youtube clientsecret'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_youtube_dev_key', - 'comment' => sprintf(_('reglages:: Youtube cle developpeur, voir %s'), $dashboard_youtube), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Connectivite a FlickR'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_flickr_api', - 'comment' => sprintf(_('reglages:: Utiliser l api flickr, voir %s, puis set la callback a %s'), $create_api_flickr, $flickr_callback), - 'default' => false, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_flickr_client_id', - 'comment' => _('reglages:: FlickR client id'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_flickr_client_secret', - 'comment' => _('reglages:: FlickR client secret'), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Connectivite a Dailymotion'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_dailymotion_api', - 'comment' => sprintf(_('reglages:: Utiliser l api dailymotion, voir %s, puis set la callback a %s'), $create_api_dailymotion, $dailymotion_callback), - 'default' => false, - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_dailymotion_client_id', - 'comment' => _('reglages:: dailymotion client id'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_dailymotion_client_secret', - 'comment' => _('reglages:: dailymotion client secret'), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Gestionnaire d\'evenements'), - 'vars' => array( - array( - 'type' => 'enum_multi', - 'name' => 'GV_events', - 'default'=>null, - 'comment' => _('reglages:: Evenements'), - 'available'=> $eventsmanager->list_all('event'), - 'default'=> array_keys($eventsmanager->list_all('event')) - ), - array( - 'type' => 'enum_multi', - 'name' => 'GV_notifications', - 'default'=>null, - 'comment' => _('reglages:: Notifications'), - 'available'=> $eventsmanager->list_all('notify'), - 'default'=> array_keys($eventsmanager->list_all('notify')) - ) - ) - ), array( - 'section' => _('GV::section:: Stockage des documents'), - 'vars' => array( - array( - 'type' => 'string', - 'name' => 'GV_appletAllowedFileExt', - 'comment' => _('reglages:: extensions de fichier autorisees en upload, separees par des virgules. * pour autoriser tous les fichiers'), - 'default' => 'jpg,jpeg,bmp,tif,gif,png,pdf,doc,odt,mpg,mpeg,mov,avi,xls,flv,mp3,mp2', - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_base_datapath_web', - 'end_slash' => true, - 'comment' => _('reglages:: dossier de stockage des vignettes publiees en acces direct'), - 'default'=>'', - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_base_datapath_noweb', - 'end_slash' => true, - 'comment' => _('reglages:: dossier de stockage des fichiers proteges de l\'acces direct'), - 'default'=>'', - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_base_dataurl', - 'comment' => _('reglages:: point de montage des vignettes publiees en acces direct'), - 'default' => 'web', - 'end_slash' => false, - 'required' => true - ) - ) - ), array( - 'section' => _('GV::section:: Serveurs de cache'), - 'vars' => array( -// array( -// 'type' => 'boolean', -// 'name' => 'GV_use_cache', -// 'comment' => _('reglages:: Utiliser un serveur de cache'), -// 'default' => false, -// 'required' => true -// ), - array( - 'type' => 'enum', - 'name' => 'GV_cache_server_type', - 'comment' => _('reglages:: Utiliser un serveur de cache'), - 'default' => '', - 'available' => array(''=>_('Aucun'),'redis' => 'Redis', 'memcached' => 'Memcached') - ), - array( - 'type' => 'string', - 'name' => 'GV_cache_server_host', - 'comment' => _('setup:: Hote du Serveur de cache'), - 'default' => '127.0.0.1', - 'required' => false - ), - array( - 'type' => 'integer', - 'name' => 'GV_cache_server_port', - 'comment' => _('reglages:: port du serveur de cache'), - 'default' => 11211 - ) - ) - ),array( - 'section' => _('GV::section:: Serveur Sphinx'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_sphinx', - 'comment' => _('Utiliser Sphinx'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_sphinx_host', - 'comment' => _('reglages:: de l\'adresse du serveur sphinx'), - 'default' => '127.0.0.1' - ), - array( - 'type' => 'integer', - 'name' => 'GV_sphinx_port', - 'comment' => _('reglages:: port du serveur sphinx'), - 'default' => 9306 - ), - array( - 'type' => 'string', - 'name' => 'GV_sphinx_rt_host', - 'comment' => _('reglages:: de l\'adresse du serveur RT sphinx'), - 'default' => '127.0.0.1' - ), - array( - 'type' => 'integer', - 'name' => 'GV_sphinx_rt_port', - 'comment' => _('reglages:: port du serveur RT sphinx'), - 'default' => 9308 - ) - ) - ), array( - 'section' => _('GV::section:: Executables externes'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_modxsendfile', - 'comment' => _('reglages:: mod_xsendfileapache active'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_X_Accel_Redirect', - 'comment' => _('reglages:: Path en acces pour X-Accel-Redirect (NginX Uniquement)'), - 'default' => '', - 'end_slash' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_X_Accel_Redirect_mount_point', - 'comment' => _('reglages:: Point de montage pour X-Accel-Redirect (NginX Uniquement)'), - 'default' => 'noweb', - 'end_slash' => false - ), - array( - 'type' => 'boolean', - 'name' => 'GV_h264_streaming', - 'comment' => _('reglages:: activation du stream h264 via mod_token - attention, necessite les modules apache mod_h264_streaming et mod_auth_token'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_mod_auth_token_directory', - 'end_slash' => true, - 'comment' => _('reglages:: point de montage du dossier protege via auth_token'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_mod_auth_token_directory_path', - 'end_slash' => false, - 'comment' => _('reglages:: path complet du dossier protege via auth_token'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_mod_auth_token_passphrase', - 'comment' => _('reglages:: passphrase du mod_auth_token (definie dans le fichier de configuration apache)'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_cli', - 'comment' => _('reglages:: executable PHP CLI'), - 'default'=>'', - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_PHP_INI', - 'comment' => _('reglages:: path du php.ini specifique (vide si non utilise)'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_imagick', - 'default'=>'', - 'comment' => _('reglages:: chemin de l\'executable convert'), - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_pathcomposite', - 'default'=>'', - 'comment' => _('reglages:: chemin de l\'executable composite'), - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_exiftool', - 'default'=>'', - 'comment' => _('reglages:: chemin de l\'executable exiftools'), - 'required' => true - ), - array( - 'type' => 'string', - 'name' => 'GV_swf_extract', - 'comment' => _('reglages:: chemin de l\'executable swfextract'), - 'default' => '', - 'required' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_pdf2swf', - 'comment' => _('reglages:: chemin de l\'executable pdf2swf'), - 'default' => '', - 'required' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_swf_render', - 'comment' => _('reglages:: chemin de l\'executable swfrender'), - 'default' => '', - 'required' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_unoconv', - 'comment' => _('reglages:: chemin de l\'executable unoconv'), - 'default' => '', - 'required' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_ffmpeg', - 'comment' => _('reglages:: chemin de l\'executable FFmpeg'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_mp4box', - 'comment' => _('reglages:: chemin de l\'executable MP4Box'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_mplayer', - 'comment' => _('reglages:: chemin de l\'executable Mplayer'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_pdftotext', - 'comment' => _('reglages:: chemin de l\'executable pdftotext (xpdf)'), - 'default' => '' - ), - array( - 'type' => 'integer', - 'name' => 'GV_pdfmaxpages', - 'comment' => _('reglages:: nombre maximum de page a extraire (PDF)'), - 'default' => 5 - ) - ) - ), array( - 'section' => _('GV::section:: Repertoires utilitaires'), - 'vars' => array( - array( - 'type' => 'string', - 'name' => 'GV_filesOwner', - 'comment' => _('reglages:: proprietaire des fichiers'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_filesGroup', - 'comment' => _('reglages:: groupes des fichiers'), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Configuration principale'), - 'vars' => array( + array( + 'section' => _('GV::section:: Serveur HTTP'), + 'vars' => array( + array( + 'type' => 'timezone', + 'name' => 'GV_timezone', + 'comment' => _('reglages:: Timezone de l\'installation'), + 'default' => 'Europe/Paris', + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_sit', + 'comment' => _('reglages:: Nom de linstallation'), + 'default' => $GV_sit, + 'readonly' => true, + 'required' => true + ), + array( + 'type' => 'enum', + 'name' => 'GV_default_lng', + 'comment' => _('reglages:: Langue par defaut'), + 'default' => 'fr_FR', + 'available' => $avLanguages, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_STATIC_URL', + 'end_slash' => false, + 'comment' => _('reglages:: URL statique (optionnel)'), + 'default' => '', + 'required' => false + ) + ) + ), array( + 'section' => _('GV::section:: Etat de maintenance'), + 'rolled' => true, + 'vars' => array( + array( + 'type' => 'text', + 'name' => 'GV_message', + 'comment' => _('reglages:: Message a diffuser aux utilisateurs'), + 'default' => "May the force be with you" + ), + array( + 'type' => 'boolean', + 'name' => 'GV_message_on', + 'comment' => _('reglages:: activation du message a diffuser aux utilistaeurs'), + 'default' => false + ), + array( + 'type' => 'boolean', + 'name' => 'GV_log_errors', + 'comment' => _('reglages:: logguer les erreurs'), + 'default' => false + ) + ) + ), array( + 'section' => _('GV::section:: Connectivite aux webservices'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_google_api', + 'comment' => _('reglages:: Utiliser els google apis'), + 'default' => true, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_i18n_service', + 'comment' => _('reglages:: Service phrasea de localisation'), + 'default' => 'http://localization.webservice.alchemyasp.com/', + 'end_slash' => true, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_bitly_user', + 'comment' => _('reglages:: Nom d\'utilisateur pour l\'api bit.ly'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_bitly_key', + 'comment' => _('reglages:: ccle d\'api pour l\'api bit.ly'), + 'default' => '', + ), + array( + 'type' => 'boolean', + 'name' => 'GV_captchas', + 'comment' => _('reglages:: Utilisation de l\'api recpatcha'), + 'default' => false, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_captcha_public_key', + 'comment' => _('reglages:: clef publique recaptcha'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_captcha_private_key', + 'comment' => _('reglages:: clef privee recaptcha'), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Connectivite a Youtube'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_youtube_api', + 'comment' => sprintf(_('reglages:: Utiliser l\'api youtube, voir %s,
    mettre la callback a WEBSITE_URL/prod/bridge/callback/youtube'), $youtube_console_url), + 'default' => false, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_youtube_client_id', + 'comment' => _('reglages:: Youtube client id'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_youtube_client_secret', + 'comment' => _('reglages:: Youtube clientsecret'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_youtube_dev_key', + 'comment' => sprintf(_('reglages:: Youtube cle developpeur, voir %s'), $dashboard_youtube), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Connectivite a FlickR'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_flickr_api', + 'comment' => sprintf(_('reglages:: Utiliser l api flickr, voir %s, puis set la callback a %s'), $create_api_flickr, $flickr_callback), + 'default' => false, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_flickr_client_id', + 'comment' => _('reglages:: FlickR client id'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_flickr_client_secret', + 'comment' => _('reglages:: FlickR client secret'), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Connectivite a Dailymotion'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_dailymotion_api', + 'comment' => sprintf(_('reglages:: Utiliser l api dailymotion, voir %s, puis set la callback a %s'), $create_api_dailymotion, $dailymotion_callback), + 'default' => false, + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_dailymotion_client_id', + 'comment' => _('reglages:: dailymotion client id'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_dailymotion_client_secret', + 'comment' => _('reglages:: dailymotion client secret'), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Gestionnaire d\'evenements'), + 'vars' => array( + array( + 'type' => 'enum_multi', + 'name' => 'GV_events', + 'default' => null, + 'comment' => _('reglages:: Evenements'), + 'available' => $eventsmanager->list_all('event'), + 'default' => array_keys($eventsmanager->list_all('event')) + ), + array( + 'type' => 'enum_multi', + 'name' => 'GV_notifications', + 'default' => null, + 'comment' => _('reglages:: Notifications'), + 'available' => $eventsmanager->list_all('notify'), + 'default' => array_keys($eventsmanager->list_all('notify')) + ) + ) + ), array( + 'section' => _('GV::section:: Stockage des documents'), + 'vars' => array( + array( + 'type' => 'string', + 'name' => 'GV_appletAllowedFileExt', + 'comment' => _('reglages:: extensions de fichier autorisees en upload, separees par des virgules. * pour autoriser tous les fichiers'), + 'default' => 'jpg,jpeg,bmp,tif,gif,png,pdf,doc,odt,mpg,mpeg,mov,avi,xls,flv,mp3,mp2', + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_base_datapath_web', + 'end_slash' => true, + 'comment' => _('reglages:: dossier de stockage des vignettes publiees en acces direct'), + 'default' => '', + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_base_datapath_noweb', + 'end_slash' => true, + 'comment' => _('reglages:: dossier de stockage des fichiers proteges de l\'acces direct'), + 'default' => '', + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_base_dataurl', + 'comment' => _('reglages:: point de montage des vignettes publiees en acces direct'), + 'default' => 'web', + 'end_slash' => false, + 'required' => true + ) + ) + ) + , array( + 'section' => _('GV::section:: Serveur Sphinx'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_sphinx', + 'comment' => _('Utiliser Sphinx'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_sphinx_host', + 'comment' => _('reglages:: de l\'adresse du serveur sphinx'), + 'default' => '127.0.0.1' + ), + array( + 'type' => 'integer', + 'name' => 'GV_sphinx_port', + 'comment' => _('reglages:: port du serveur sphinx'), + 'default' => 9306 + ), + array( + 'type' => 'string', + 'name' => 'GV_sphinx_rt_host', + 'comment' => _('reglages:: de l\'adresse du serveur RT sphinx'), + 'default' => '127.0.0.1' + ), + array( + 'type' => 'integer', + 'name' => 'GV_sphinx_rt_port', + 'comment' => _('reglages:: port du serveur RT sphinx'), + 'default' => 9308 + ) + ) + ) + , array( + 'section' => _('Phrasea Engine'), + 'vars' => array( + array( + 'type' => 'enum', + 'name' => 'GV_phrasea_sort', + 'comment' => _('Default results sort'), + 'default' => '', + 'available' => $date_sort_fields + ) + ) + ), array( + 'section' => _('GV::section:: Executables externes'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_modxsendfile', + 'comment' => _('reglages:: mod_xsendfileapache active'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_X_Accel_Redirect', + 'comment' => _('reglages:: Path en acces pour X-Accel-Redirect (NginX Uniquement)'), + 'default' => '', + 'end_slash' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_X_Accel_Redirect_mount_point', + 'comment' => _('reglages:: Point de montage pour X-Accel-Redirect (NginX Uniquement)'), + 'default' => 'noweb', + 'end_slash' => false + ), + array( + 'type' => 'boolean', + 'name' => 'GV_h264_streaming', + 'comment' => _('reglages:: activation du stream h264 via mod_token - attention, necessite les modules apache mod_h264_streaming et mod_auth_token'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_mod_auth_token_directory', + 'end_slash' => true, + 'comment' => _('reglages:: point de montage du dossier protege via auth_token'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_mod_auth_token_directory_path', + 'end_slash' => false, + 'comment' => _('reglages:: path complet du dossier protege via auth_token'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_mod_auth_token_passphrase', + 'comment' => _('reglages:: passphrase du mod_auth_token (definie dans le fichier de configuration apache)'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_cli', + 'comment' => _('reglages:: executable PHP CLI'), + 'default' => '', + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_PHP_INI', + 'comment' => _('reglages:: path du php.ini specifique (vide si non utilise)'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_imagick', + 'default' => '', + 'comment' => _('reglages:: chemin de l\'executable convert'), + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_pathcomposite', + 'default' => '', + 'comment' => _('reglages:: chemin de l\'executable composite'), + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_exiftool', + 'default' => '', + 'comment' => _('reglages:: chemin de l\'executable exiftools'), + 'required' => true + ), + array( + 'type' => 'string', + 'name' => 'GV_swf_extract', + 'comment' => _('reglages:: chemin de l\'executable swfextract'), + 'default' => '', + 'required' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_pdf2swf', + 'comment' => _('reglages:: chemin de l\'executable pdf2swf'), + 'default' => '', + 'required' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_swf_render', + 'comment' => _('reglages:: chemin de l\'executable swfrender'), + 'default' => '', + 'required' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_unoconv', + 'comment' => _('reglages:: chemin de l\'executable unoconv'), + 'default' => '', + 'required' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_ffmpeg', + 'comment' => _('reglages:: chemin de l\'executable FFmpeg'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_mp4box', + 'comment' => _('reglages:: chemin de l\'executable MP4Box'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_mplayer', + 'comment' => _('reglages:: chemin de l\'executable Mplayer'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_pdftotext', + 'comment' => _('reglages:: chemin de l\'executable pdftotext (xpdf)'), + 'default' => '' + ), + array( + 'type' => 'integer', + 'name' => 'GV_pdfmaxpages', + 'comment' => _('reglages:: nombre maximum de page a extraire (PDF)'), + 'default' => 5 + ) + ) + ), array( + 'section' => _('GV::section:: Repertoires utilitaires'), + 'vars' => array( + array( + 'type' => 'string', + 'name' => 'GV_filesOwner', + 'comment' => _('reglages:: proprietaire des fichiers'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_filesGroup', + 'comment' => _('reglages:: groupes des fichiers'), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Configuration principale'), + 'vars' => array( // array( // 'type' => 'boolean', // 'name' => 'GV_logobeforebas', @@ -528,33 +532,33 @@ $GV = array( // 'default' => false, // 'required' => true // ), - array( - 'type' => 'string', - 'name' => 'GV_adminMail', - 'comment' => _('reglages:: email de l\'administrateur'), - 'default' => 'support@alchemy.fr' - ), - array( - 'type' => 'boolean', - 'name' => 'GV_view_bas_and_coll', - 'comment' => _('reglages:: Afficher le nom des bases et des collections'), - 'default' => true, - 'required' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_choose_export_title', - 'comment' => _('reglages:: activer le choix du nom de fichier a l\'export'), - 'default' => false, - 'required' => true - ), - array( - 'type' => 'enum', - 'name' => 'GV_default_export_title', - 'comment' => _('reglages:: choix par defaut des noms de fichier a l\'export'), - 'default' => 'support@alchemy.fr', - 'available' => array('title' => 'Titre du document', 'original' => 'Nom original') - ), + array( + 'type' => 'string', + 'name' => 'GV_adminMail', + 'comment' => _('reglages:: email de l\'administrateur'), + 'default' => 'support@alchemy.fr' + ), + array( + 'type' => 'boolean', + 'name' => 'GV_view_bas_and_coll', + 'comment' => _('reglages:: Afficher le nom des bases et des collections'), + 'default' => true, + 'required' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_choose_export_title', + 'comment' => _('reglages:: activer le choix du nom de fichier a l\'export'), + 'default' => false, + 'required' => true + ), + array( + 'type' => 'enum', + 'name' => 'GV_default_export_title', + 'comment' => _('reglages:: choix par defaut des noms de fichier a l\'export'), + 'default' => 'support@alchemy.fr', + 'available' => array('title' => 'Titre du document', 'original' => 'Nom original') + ), // array( // 'type' => 'boolean', // 'name' => 'GV_ArchiveSorted', @@ -562,19 +566,19 @@ $GV = array( // 'default' => true, // 'required' => true // ), - array( - 'type' => 'enum', - 'name' => 'GV_social_tools', - 'comment' => _('reglages:: Active les partages Facebook et Twitter'), - 'available' => array('none' => 'Disabled', 'publishers' => 'Publishers', 'all' => 'Activated'), - 'default' => 'none', - 'required' => false - ) - ) - ), array( - 'section' => _('GV::section:: Page d\'accueil'), - 'rolled' => true, - 'vars' => array( + array( + 'type' => 'enum', + 'name' => 'GV_social_tools', + 'comment' => _('reglages:: Active les partages Facebook et Twitter'), + 'available' => array('none' => 'Disabled', 'publishers' => 'Publishers', 'all' => 'Activated'), + 'default' => 'none', + 'required' => false + ) + ) + ), array( + 'section' => _('GV::section:: Page d\'accueil'), + 'rolled' => true, + 'vars' => array( // array( // 'type' => 'boolean', // 'name' => 'GV_find_password', @@ -582,78 +586,78 @@ $GV = array( // 'default' => true, // 'required' => true // ), - array( - 'type' => 'enum', - 'name' => 'GV_home_publi', - 'comment' => _('reglages:: presentation sur la home'), - 'default' => 'COOLIRIS', - 'available' => array('DISPLAYx1' => 'slideshow', 'SCROLL' => 'Bandeau defilant', 'COOLIRIS' => 'Cooliris'), - 'required' => true - ) - ) - ), array( - 'section' => _('GV::section:: Moteur de recherche'), - 'rolled' => true, - 'vars' => array( - array( - 'type' => 'integer', - 'name' => 'GV_min_letters_truncation', - 'comment' => _('reglages:: Nombre minimal de lettre avec la troncature (Recherche)'), - 'default' => 1 - ), - array( - 'type' => 'string', - 'name' => 'GV_defaultQuery', - 'comment' => _('reglages:: Question par defaut'), - 'default' => 'all' - ), - array( - 'type' => 'enum', - 'name' => 'GV_defaultQuery_type', - 'comment' => _('reglages:: type de document cherches par defaut e l\'ouverture du site'), - 'available' => array('0' => 'Documents', '1' => 'Regroupements'), - 'default' => '0' - ) - ) - ), array( - 'section' => _('GV::section:: Report'), - 'rolled' => true, - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_anonymousReport', - 'comment' => _('reglages:: report anonyme (masque les infos concernant les utilisateurs)'), - 'default' => false, - 'required' => true - ) - ) - ), array( - 'section' => _('GV::section:: Modules supplementaires'), - 'rolled' => true, - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_thesaurus', - 'comment' => _('reglages:: Activation de l\'outil thesaurus'), - 'default' => true - ), array( - 'type' => 'boolean', - 'name' => 'GV_multiAndReport', - 'comment' => _('reglages:: Activation du Mode MultiDOC'), - 'default' => true - ), array( - 'type' => 'boolean', - 'name' => 'GV_seeOngChgDoc', - 'comment' => _('reglages:: Substitution de HD d\'un record '), - 'default' => false - ), array( - 'type' => 'boolean', - 'name' => 'GV_seeNewThumb', - 'comment' => _('reglages:: Substitution de thumbnail d\'un record'), - 'default' => false - ) - ) + array( + 'type' => 'enum', + 'name' => 'GV_home_publi', + 'comment' => _('reglages:: presentation sur la home'), + 'default' => 'COOLIRIS', + 'available' => array('DISPLAYx1' => 'slideshow', 'SCROLL' => 'Bandeau defilant', 'COOLIRIS' => 'Cooliris'), + 'required' => true + ) ) + ), array( + 'section' => _('GV::section:: Moteur de recherche'), + 'rolled' => true, + 'vars' => array( + array( + 'type' => 'integer', + 'name' => 'GV_min_letters_truncation', + 'comment' => _('reglages:: Nombre minimal de lettre avec la troncature (Recherche)'), + 'default' => 1 + ), + array( + 'type' => 'string', + 'name' => 'GV_defaultQuery', + 'comment' => _('reglages:: Question par defaut'), + 'default' => 'all' + ), + array( + 'type' => 'enum', + 'name' => 'GV_defaultQuery_type', + 'comment' => _('reglages:: type de document cherches par defaut e l\'ouverture du site'), + 'available' => array('0' => 'Documents', '1' => 'Regroupements'), + 'default' => '0' + ) + ) + ), array( + 'section' => _('GV::section:: Report'), + 'rolled' => true, + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_anonymousReport', + 'comment' => _('reglages:: report anonyme (masque les infos concernant les utilisateurs)'), + 'default' => false, + 'required' => true + ) + ) + ), array( + 'section' => _('GV::section:: Modules supplementaires'), + 'rolled' => true, + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_thesaurus', + 'comment' => _('reglages:: Activation de l\'outil thesaurus'), + 'default' => true + ), array( + 'type' => 'boolean', + 'name' => 'GV_multiAndReport', + 'comment' => _('reglages:: Activation du Mode MultiDOC'), + 'default' => true + ), array( + 'type' => 'boolean', + 'name' => 'GV_seeOngChgDoc', + 'comment' => _('reglages:: Substitution de HD d\'un record '), + 'default' => false + ), array( + 'type' => 'boolean', + 'name' => 'GV_seeNewThumb', + 'comment' => _('reglages:: Substitution de thumbnail d\'un record'), + 'default' => false + ) + ) + ) // , array( // 'section' => _('GV::section:: Authentification LDAP'), // 'rolled' => true, @@ -732,243 +736,242 @@ $GV = array( // ) // ) // ) - , array( - 'section' => _('GV::section:: Envois de mails'), - 'vars' => array( + , array( + 'section' => _('GV::section:: Envois de mails'), + 'vars' => array( // array( // 'type' => 'boolean', // 'name' => 'GV_exportmail', // 'comment' => _('reglages:: Activation de l\'export par mail'), // 'default' => true // ), - array( - 'type' => 'string', - 'name' => 'GV_defaulmailsenderaddr', - 'comment' => _('reglages:: Expediteur mail par defaut'), - 'default' => 'phraseanet@example.com' - ), - array( - 'type' => 'boolean', - 'name' => 'GV_smtp', - 'comment' => _('reglages:: Utilisation d\'un serveur SMTP'), - 'default' => false - ), - array( - 'type' => 'boolean', - 'name' => 'GV_smtp_auth', - 'comment' => _('reglages:: Activation de l\'authentification smtp'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_smtp_host', - 'comment' => _('reglages:: Hote SMTP'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_smtp_port', - 'comment' => _('reglages:: Port SMTP'), - 'default' => '' - ), - array( - 'type' => 'boolean', - 'name' => 'GV_smtp_secure', - 'comment' => _('reglages:: Utiliser une conenction SSL'), - 'default' => false - ), - array( - 'type' => 'string', - 'name' => 'GV_smtp_user', - 'comment' => _('reglages:: User SMTP'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_smtp_password', - 'comment' => _('reglages:: Mot de passe SMTP'), - 'default' => '' - ) - ) - ), array( - 'section' => _('GV::section:: Exports FTP'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_activeFTP', - 'comment' => _('reglages:: active la possibilite d\'exports FTP ou non (onglet dans multiexports)'), - 'default' => false - ), - array( - 'type' => 'boolean', - 'name' => 'GV_ftp_for_user', - 'comment' => _('reglages:: Donne ou non export FTP aux utilisateurs ou e l\'admin uniquement'), - 'default' => false - ) - ) - ), array( - 'section' => _('GV::section:: Configuration du client'), - 'vars' => array( -// array( -// 'type' => 'enum', -// 'name' => 'GV_bandeauHome', -// 'comment' => _('reglages:: Affichage par defaut de la home du client'), -// 'available' => array('QUERY' => _('Question'), 'PUBLI' => _('Publications'), 'HELP' => _('Aide')), -// 'default' => 'QUERY' -// ), - array( - 'type' => 'integer', - 'name' => 'GV_ong_search', - 'comment' => _('reglages:: position de l\'onglet de recherche'), - 'default' => 1 - ), - array( - 'type' => 'integer', - 'name' => 'GV_ong_advsearch', - 'comment' => _('reglages:: position de l\'onglet de recherche avancee'), - 'default' => 2 - ), - array( - 'type' => 'integer', - 'name' => 'GV_ong_topics', - 'comment' => _('reglages:: position de l\'onglet des topics'), - 'default' => 0 - ), - array( - 'type' => 'integer', - 'name' => 'GV_ong_actif', - 'comment' => _('reglages:: numero de l\'onglet actif'), - 'default' => 1 - ), - array( - 'type' => 'enum', - 'name' => 'GV_client_render_topics', - 'comment' => _('reglages:: rendu des topics'), - 'available' => array('tree' => 'Arbres', 'popups' => 'Menus deroulants'), - 'default' => 'tree' - ), + array( + 'type' => 'string', + 'name' => 'GV_defaulmailsenderaddr', + 'comment' => _('reglages:: Expediteur mail par defaut'), + 'default' => 'phraseanet@example.com' + ), + array( + 'type' => 'boolean', + 'name' => 'GV_smtp', + 'comment' => _('reglages:: Utilisation d\'un serveur SMTP'), + 'default' => false + ), + array( + 'type' => 'boolean', + 'name' => 'GV_smtp_auth', + 'comment' => _('reglages:: Activation de l\'authentification smtp'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_smtp_host', + 'comment' => _('reglages:: Hote SMTP'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_smtp_port', + 'comment' => _('reglages:: Port SMTP'), + 'default' => '' + ), + array( + 'type' => 'boolean', + 'name' => 'GV_smtp_secure', + 'comment' => _('reglages:: Utiliser une conenction SSL'), + 'default' => false + ), + array( + 'type' => 'string', + 'name' => 'GV_smtp_user', + 'comment' => _('reglages:: User SMTP'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_smtp_password', + 'comment' => _('reglages:: Mot de passe SMTP'), + 'default' => '' + ) + ) + ), array( + 'section' => _('GV::section:: Exports FTP'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_activeFTP', + 'comment' => _('reglages:: active la possibilite d\'exports FTP ou non (onglet dans multiexports)'), + 'default' => false + ), + array( + 'type' => 'boolean', + 'name' => 'GV_ftp_for_user', + 'comment' => _('reglages:: Donne ou non export FTP aux utilisateurs ou e l\'admin uniquement'), + 'default' => false + ) + ) + ), array( + 'section' => _('GV::section:: Configuration du client'), + 'vars' => array( + array( + 'type' => 'integer', + 'name' => 'GV_download_max', + 'comment' => _('Maximum megabytes allowed in download (if request is bigger, then mail is still available)'), + 'default' => 120 + ), + array( + 'type' => 'integer', + 'name' => 'GV_ong_search', + 'comment' => _('reglages:: position de l\'onglet de recherche'), + 'default' => 1 + ), + array( + 'type' => 'integer', + 'name' => 'GV_ong_advsearch', + 'comment' => _('reglages:: position de l\'onglet de recherche avancee'), + 'default' => 2 + ), + array( + 'type' => 'integer', + 'name' => 'GV_ong_topics', + 'comment' => _('reglages:: position de l\'onglet des topics'), + 'default' => 0 + ), + array( + 'type' => 'integer', + 'name' => 'GV_ong_actif', + 'comment' => _('reglages:: numero de l\'onglet actif'), + 'default' => 1 + ), + array( + 'type' => 'enum', + 'name' => 'GV_client_render_topics', + 'comment' => _('reglages:: rendu des topics'), + 'available' => array('tree' => 'Arbres', 'popups' => 'Menus deroulants'), + 'default' => 'tree' + ), // array( // 'type' => 'boolean', // 'name' => 'GV_grp_preview_list', // 'comment' => _('reglages:: Voir les elements d\'un reportage sans Thumbnail (fenetre de preview)'), // 'default' => false // ), - array( - 'type' => 'boolean', - 'name' => 'GV_rollover_reg_preview', - 'comment' => _('reglages:: Voir le rollover sur les regroupements (fenetre de preview)'), - 'default' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_rollover_chu', - 'comment' => _('reglages:: Voir le rollover sur les elements du chutier'), - 'default' => true - ), - array( - 'type' => 'enum', - 'name' => 'GV_client_coll_ckbox', - 'comment' => _('reglages:: Presentation des collections'), - 'default' => 'checkbox', - 'available' => array('popup' => 'Menu deroulant', 'checkbox' => 'case a cocher') - ), - array( - 'type' => 'boolean', - 'name' => 'GV_viewSizeBaket', - 'comment' => _('reglages:: Voir taille HD total des doc d\'un chutiers'), - 'default' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_clientAutoShowProposals', - 'comment' => _('reglages:: Afficher automatiquement l\'onglet des propositions s\'il y\'en a'), - 'default' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_needAuth2DL', - 'comment' => _('reglages:: Il est necessaire d\'etre connecte pour pouvoir telecharger en compte invite'), - 'default' => true - ) - ) - ), array( - 'section' => _('GV::section:: Parametrage de l\'inscription'), - 'vars' => array( - array( - 'type' => 'boolean', - 'name' => 'GV_autoselectDB', - 'comment' => _('reglages:: A true, cette option descative le choix de selection des bases sur lesquelles on s\'inscrit, et l\'inscription se fait sur toutes les bases ou jai le droit de m\'inscrire'), - 'default' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_autoregister', - 'comment' => _('reglages:: Activation de l\'autoinscription'), - 'default' => false - ) - ) - ), array( - 'section' => _('GV::section:: Configuration du push'), - 'vars' => array( - array( - 'type' => 'integer', - 'name' => 'GV_validation_reminder', - 'comment' => _('reglages:: Nombre de jour avant la fin de la validation pour envoie de mail de rappel'), - 'default' => 2 - ), + array( + 'type' => 'boolean', + 'name' => 'GV_rollover_reg_preview', + 'comment' => _('reglages:: Voir le rollover sur les regroupements (fenetre de preview)'), + 'default' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_rollover_chu', + 'comment' => _('reglages:: Voir le rollover sur les elements du chutier'), + 'default' => true + ), + array( + 'type' => 'enum', + 'name' => 'GV_client_coll_ckbox', + 'comment' => _('reglages:: Presentation des collections'), + 'default' => 'checkbox', + 'available' => array('popup' => 'Menu deroulant', 'checkbox' => 'case a cocher') + ), + array( + 'type' => 'boolean', + 'name' => 'GV_viewSizeBaket', + 'comment' => _('reglages:: Voir taille HD total des doc d\'un chutiers'), + 'default' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_clientAutoShowProposals', + 'comment' => _('reglages:: Afficher automatiquement l\'onglet des propositions s\'il y\'en a'), + 'default' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_needAuth2DL', + 'comment' => _('reglages:: Il est necessaire d\'etre connecte pour pouvoir telecharger en compte invite'), + 'default' => true + ) + ) + ), array( + 'section' => _('GV::section:: Parametrage de l\'inscription'), + 'vars' => array( + array( + 'type' => 'boolean', + 'name' => 'GV_autoselectDB', + 'comment' => _('reglages:: A true, cette option descative le choix de selection des bases sur lesquelles on s\'inscrit, et l\'inscription se fait sur toutes les bases ou jai le droit de m\'inscrire'), + 'default' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_autoregister', + 'comment' => _('reglages:: Activation de l\'autoinscription'), + 'default' => false + ) + ) + ), array( + 'section' => _('GV::section:: Configuration du push'), + 'vars' => array( + array( + 'type' => 'integer', + 'name' => 'GV_validation_reminder', + 'comment' => _('reglages:: Nombre de jour avant la fin de la validation pour envoie de mail de rappel'), + 'default' => 2 + ), // array( // 'type' => 'boolean', // 'name' => 'GV_DL_checkit', // 'comment' => _('reglages:: Autorise le telechargement des fichiers pendant le process de validation'), // 'default' => true // ), - array( - 'type' => 'integer', - 'name' => 'GV_val_expiration', - 'comment' => _('reglages:: dure de validite des liens genere pour les validations, si 0 => validite permanente'), - 'default' => 10 - ) - ) - ), array( - 'section' => _('GV::section:: Indexation par les robots'), - 'vars' => array( - array( - 'type' => 'string', - 'name' => 'GV_homeTitle', - 'comment' => _('reglages :: Titre de l\'installation'), - 'default' => 'Phraseanet' - ), - array( - 'type' => 'string', - 'name' => 'GV_metaKeywords', - 'comment' => _('reglages:: Mots clefs pour l\'indexation des robots de moteurs de recherche'), - 'default' => '' - ), - array( - 'type' => 'text', - 'name' => 'GV_metaDescription', - 'comment' => _('reglages :: Description de l\'installation'), - 'default' => '' - ), - array( - 'type' => 'string', - 'name' => 'GV_googleAnalytics', - 'comment' => _('reglages:: identifiant google analytics'), - 'default' => '' - ), - array( - 'type' => 'boolean', - 'name' => 'GV_allow_search_engine', - 'comment' => _('Allow the website to be indexed by search engines like Google'), - 'default' => true - ), - array( - 'type' => 'boolean', - 'name' => 'GV_display_gcf', - 'comment' => _('reglages:: Afficher le bandeau Google Chrome Frame'), - 'default' => true - ) - ) + array( + 'type' => 'integer', + 'name' => 'GV_val_expiration', + 'comment' => _('reglages:: dure de validite des liens genere pour les validations, si 0 => validite permanente'), + 'default' => 10 + ) ) - ) + ), array( + 'section' => _('GV::section:: Indexation par les robots'), + 'vars' => array( + array( + 'type' => 'string', + 'name' => 'GV_homeTitle', + 'comment' => _('reglages :: Titre de l\'installation'), + 'default' => 'Phraseanet' + ), + array( + 'type' => 'string', + 'name' => 'GV_metaKeywords', + 'comment' => _('reglages:: Mots clefs pour l\'indexation des robots de moteurs de recherche'), + 'default' => '' + ), + array( + 'type' => 'text', + 'name' => 'GV_metaDescription', + 'comment' => _('reglages :: Description de l\'installation'), + 'default' => '' + ), + array( + 'type' => 'string', + 'name' => 'GV_googleAnalytics', + 'comment' => _('reglages:: identifiant google analytics'), + 'default' => '' + ), + array( + 'type' => 'boolean', + 'name' => 'GV_allow_search_engine', + 'comment' => _('Allow the website to be indexed by search engines like Google'), + 'default' => true + ), + array( + 'type' => 'boolean', + 'name' => 'GV_display_gcf', + 'comment' => _('reglages:: Afficher le bandeau Google Chrome Frame'), + 'default' => true + ) + ) + ) + ) ?> diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index 99c1b2968a..e9876c89b8 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -3816,7 +3816,7 @@ type - enum('view','validate','password','rss','email','download') + enum('FEED_ENTRY', 'view','validate','password','rss','email','download') ascii_bin @@ -5160,30 +5160,6 @@ - - regdate - tinyint(1) unsigned - YES - - - - - - regname - tinyint(1) unsigned - YES - - - - - - regdesc - tinyint(1) unsigned - YES - - - - report tinyint(1) unsigned @@ -5208,6 +5184,22 @@ + + VocabularyControlType + CHAR(16) + YES + + + + + + RestrictToVocabularyControl + TINYINT(1) + + + 0 + + @@ -5245,27 +5237,6 @@ required - - regname - UNIQUE - - regname - - - - regdate - UNIQUE - - regdate - - - - regdesc - UNIQUE - - regdesc - - sorter UNIQUE @@ -5311,6 +5282,24 @@ utf8_unicode_ci + + VocabularyType + char(16) + YES + + + + utf8_unicode_ci + + + VocabularyId + int(11) + YES + + + + + @@ -5335,8 +5324,8 @@ - unique - UNIQUE + index_meta + INDEX record_id meta_struct_id @@ -5792,7 +5781,7 @@ results int(11) unsigned - + YES 0 diff --git a/lib/conf.d/data_templates/en-simple.xml b/lib/conf.d/data_templates/en-simple.xml index 1baaa0fabb..1602fc3170 100644 --- a/lib/conf.d/data_templates/en-simple.xml +++ b/lib/conf.d/data_templates/en-simple.xml @@ -47,7 +47,7 @@ - + {{datapathweb}}{{basename}}/subdefs 200 gif @@ -86,6 +86,50 @@ + + + {{datapathnoweb}}{{basename}}/subdefs + flexpaper + no + + + + + + {{datapathweb}}{{basename}}/subdefs + image + resample + 72 + 200 + no + {{dataurl}}/{{basename}}/subdefs + + + + + + + {{datapathnoweb}}{{basename}}/subdefs + image + 200 + no + resample + 72 + + + + + + {{datapathweb}}{{basename}}/subdefs + image + no + resample + 72 + {{dataurl}}/{{basename}}/subdefs + + + + @@ -105,7 +149,7 @@ - + @@ -126,7 +170,7 @@ - + @@ -135,7 +179,7 @@ - + diff --git a/lib/conf.d/data_templates/fr-simple.xml b/lib/conf.d/data_templates/fr-simple.xml index 6b7d22e9a7..f8c5a5ab2a 100755 --- a/lib/conf.d/data_templates/fr-simple.xml +++ b/lib/conf.d/data_templates/fr-simple.xml @@ -45,7 +45,7 @@ - + {{datapathweb}}{{basename}}/subdefs 200 gif @@ -77,12 +77,57 @@ {{datapathweb}}{{basename}}/subdefs image + 200 no {{dataurl}}/{{basename}}/subdefs + + + {{datapathnoweb}}{{basename}}/subdefs + flexpaper + no + + + + + + {{datapathweb}}{{basename}}/subdefs + image + resample + 72 + 200 + no + {{dataurl}}/{{basename}}/subdefs + + + + + + + {{datapathnoweb}}{{basename}}/subdefs + image + 200 + no + resample + 72 + + + + + + {{datapathweb}}{{basename}}/subdefs + image + no + resample + 72 + {{dataurl}}/{{basename}}/subdefs + + + + @@ -104,7 +149,7 @@ - + @@ -125,7 +170,7 @@ - + @@ -134,7 +179,7 @@ - + diff --git a/lib/phpunit.xml.dist b/lib/phpunit.xml.dist index 4cd75ae194..5a5c136840 100644 --- a/lib/phpunit.xml.dist +++ b/lib/phpunit.xml.dist @@ -9,6 +9,7 @@ stopOnFailure="false" syntaxCheck="true" verbose="false" + bootstrap="unitTest/bootstrap.inc" > + + + + + + + + + + + + + + + +
    +
    + +
    +

    {{home_title}}

    +
    + + {% if not session.is_authenticated %} +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + {% if errorMessage %} + + {% endif %} + + + + +
    +

    + {% trans 'Problèmes de connexion ?' %} +

    +
    + {% else %} + {% if user is not none %} + {% set username = '' ~ user.get_display_name() ~ '' %} +
    + +
    + {% endif %} + {% if auth.getClient() is not none %} +
    +
    +

    {% trans %}Autorisation d'accès{% endtrans %}

    +
    +
    + {% set application_name = auth.getClient.get_name() %} +

    + {% trans %} + Autorisez-vous l'application "{{application_name}}" à accéder à votre contenu sur {{home_title}} ? + {% endtrans %} +

    +
    +
    + {% endif %} +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + + +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + + +
    +
    + {% endif %} + +
    +
    + + + + + + + + + + + + + + + + + + diff --git a/templates/mobile/api/auth/native_app_access_token.twig b/templates/mobile/api/auth/native_app_access_token.twig new file mode 100644 index 0000000000..0ba7bce308 --- /dev/null +++ b/templates/mobile/api/auth/native_app_access_token.twig @@ -0,0 +1,98 @@ + + + + + + {% if error is defined %} + {% trans 'Fail' %} + {% else %} + {% trans 'Success' %} + {% endif %} + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +

    {{home_title}}

    +
    + + {% if user is not none %} + {% set username = '' ~ user.get_display_name() ~ '' %} +
    + +
    + {% endif %} +
    + {% if error is defined %} +
    +

    {% trans %}Erreur{% endtrans %}

    +
    +
    +

    + {% trans %} + {{error}} + {% endtrans %} +

    + +
    + {% else %} +
    +

    {% trans %}Code d'accès{% endtrans %}

    +
    +
    +

    + {% trans %} + Copiez le code ci-dessous, retournez dans votre application et collez-le à l'endroit requis : + {% endtrans %} +

    + +
    + {% endif %} +
    +

    + +
    +
    + + + + + + + + + + + + + + + + + + diff --git a/templates/mobile/common/index.twig b/templates/mobile/common/index.twig index 4f0d3c5948..6da44ad780 100644 --- a/templates/mobile/common/index.twig +++ b/templates/mobile/common/index.twig @@ -6,7 +6,7 @@ {{home_title}} - {{ module_name }} - + {% block stylesheet %}{% endblock %} {% block icon %}{% endblock %} {% block javascript %}{% endblock %} diff --git a/templates/mobile/lightbox/basket_element.twig b/templates/mobile/lightbox/basket_element.twig index 9a870f8b6e..78fa9a075b 100644 --- a/templates/mobile/lightbox/basket_element.twig +++ b/templates/mobile/lightbox/basket_element.twig @@ -11,28 +11,32 @@ {% endblock %} {% block content %} - {% set record = basket_element.get_record() %} + {% set record = basket_element.getRecord() %}
    - Back -

    {{basket_element.get_order()}} - {{record.get_title()}}

    + Back +

    {{basket_element.getOrd()}} - {{record.get_title()}}

    Home
    {{ thumbnail.format100percent(record.get_preview(),'',session, record.get_thumbnail()) }} - {% if basket_element.is_validation_item() %} -
    - - + {% if basket_element.getBasket().getValidation() %} + {% if basket_element.getBasket().getValidation().getParticipant(user).getCanAgree() %} +
    + + - - -
    + + +
    + {% endif %}
    -
      +
        {% include 'lightbox/sc_note.twig' %}
    diff --git a/templates/mobile/lightbox/feed.twig b/templates/mobile/lightbox/feed.twig index 3fabc50d41..933e7385be 100644 --- a/templates/mobile/lightbox/feed.twig +++ b/templates/mobile/lightbox/feed.twig @@ -20,10 +20,10 @@ {{feed_entry.get_subtitle()|nl2br|raw}}

    + {% set author = feed_entry.get_author_name() %} {% trans %}Par {{ author }}{% endtrans %} {% set entry_length = feed_entry.get_content()|length %} {% trans %}{{entry_length}} documents{% endtrans %} - {% set author = feed_entry.get_author_name() %}

    diff --git a/templates/mobile/lightbox/feed_element.twig b/templates/mobile/lightbox/feed_element.twig index 28fe319a89..907a6c05b7 100644 --- a/templates/mobile/lightbox/feed_element.twig +++ b/templates/mobile/lightbox/feed_element.twig @@ -15,7 +15,7 @@
    Back -

    {{feed_element.get_order()}} - {{record.get_title()}}

    +

    {{feed_element.get_ord()}} - {{record.get_title()}}

    Home
    diff --git a/templates/mobile/lightbox/index.twig b/templates/mobile/lightbox/index.twig index 06507a78e6..854bf0c8d8 100644 --- a/templates/mobile/lightbox/index.twig +++ b/templates/mobile/lightbox/index.twig @@ -13,27 +13,23 @@ {% endblock %} {% macro valid_baskets_length(baskets) %} - {% set foo = 0 %} + {% set number = 0 %} {% for item in baskets %} - {% if item.is_valid() %} - {% set foo = foo + 1 %} + {% if item.getValidation() %} + {% set number = number + 1 %} {% endif %} {% endfor %} - {{foo}} + {{number}} {% endmacro %} -{% macro baskets_length(baskets_collection) %} - {% set foo = 0 %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set foo = foo + 1 %} - {% endif %} - {% endfor %} +{% macro baskets_length(baskets) %} + {% set number = 0 %} + {% for item in baskets %} + {% if item.getValidation() == false %} + {% set number = number + 1 %} {% endif %} {% endfor %} - {{foo}} + {{number}} {% endmacro %} {% block content %} @@ -46,7 +42,7 @@
    -

    Phraseanet Version {{session.get_version()}}

    +

    Phraseanet Version {{core.getVersion().getName()}} - {{core.getVersion().getNumber()}}

    @@ -91,22 +87,18 @@ {% trans 'Voici vos validations en cours' %}

    @@ -124,22 +116,18 @@ {% trans 'Voici vos paniers' %}

      - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set basket_length = item.get_elements()|length%} -
    • - {% if item.get_first_element() %} - - {% endif %} -

      {{item.get_name()}}

      -

      {{item.get_description()}}

      - {{basket_length}} -
    • - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() is empty %} + {% set basket_length = basket.getElements().count() %} +
    • + {% if basket.getElements().first() %} + + {% endif %} +

      {{ basket.getName() }}

      +

      {{ basket.getDescription() }}

      + {{basket_length}} +
    • + {% endif %} {% endfor %}
    diff --git a/templates/mobile/lightbox/note_form.twig b/templates/mobile/lightbox/note_form.twig index b17e2e1dfc..25ac74de76 100644 --- a/templates/mobile/lightbox/note_form.twig +++ b/templates/mobile/lightbox/note_form.twig @@ -11,17 +11,17 @@ {% endblock %} {% block content %} -
    +
    -

    {{basket_element.get_record().get_title}} - Note

    +

    {{basket_element.getRecord().get_title}} - Note

    - - + id="note_area_{{basket_element.getId()}}" + {% if basket_element.getUserValidationDatas(user).getNote() == '' %}placeholder="Note"{% endif %}>{{basket_element.getUserValidationDatas(user).getNote()}} + +
    diff --git a/templates/mobile/lightbox/sc_note.twig b/templates/mobile/lightbox/sc_note.twig index 8d0a550ee9..8129b6cd59 100644 --- a/templates/mobile/lightbox/sc_note.twig +++ b/templates/mobile/lightbox/sc_note.twig @@ -1,15 +1,16 @@ -{% for choice in basket_element.get_choices() %} - {% if choice.note != '' or (choice.agreement != 0 and choice.is_mine == false) %} +{% for validationDatas in basket_element.getValidationDatas() %} + {% set is_mine = validationDatas.getParticipant().getUser().get_id() == user.get_id() %} + {% if validationDatas.getNote() != '' or (validationDatas.getAgreement() is not null and is_mine) %}
  • - {% if choice.is_mine == false and choice.agreement != 0 %} + {% if is_mine == false and validationDatas.getAgreement() is not null %} + src="/skins/lightbox/{% if validationDatas.getAgreement() == true %}agree.png{% else %}disagree.png{% endif %}" /> {% endif %} - {{choice.usr_name}} + {{ validationDatas.getParticipant().getUser().get_display_name() }}

    - {% if choice.note != '' %} -

    {% trans 'validation:: note'%} : {{choice.note|nl2br|raw}}

    + {% if validationDatas.getNote() != '' %} +

    {% trans 'validation:: note'%} : {{ validationDatas.getNote()|nl2br }}

    {% endif %}
  • {% endif %} diff --git a/templates/mobile/lightbox/validate.twig b/templates/mobile/lightbox/validate.twig index d0518636fb..ac5aba23c2 100644 --- a/templates/mobile/lightbox/validate.twig +++ b/templates/mobile/lightbox/validate.twig @@ -12,24 +12,26 @@ {% block content %}
    - {% trans 'Back' %} -

    {{basket.get_name()}}

    + {% trans 'Back' %} +

    {{basket.getName()}}

    {% trans 'Home' %}

    - {% set basket_length = basket.get_elements()|length %} + {% set basket_length = basket.getElements().count() %} {% trans %}{{basket_length}} documents{% endtrans %}

    diff --git a/templates/mobile/login/index.twig b/templates/mobile/login/index.twig index a193e76e82..61974a8756 100644 --- a/templates/mobile/login/index.twig +++ b/templates/mobile/login/index.twig @@ -36,7 +36,7 @@ placeholder="{% trans 'admin::compte-utilisateur identifiant' %}" /> - +
    diff --git a/templates/mobile/report/header.twig b/templates/mobile/report/header.twig index 88c38e0320..66630dd78d 100644 --- a/templates/mobile/report/header.twig +++ b/templates/mobile/report/header.twig @@ -27,8 +27,8 @@ }; - - + + diff --git a/templates/web/Mustache/Prod/Feedback-Badge.Mustache.html b/templates/web/Mustache/Prod/Feedback-Badge.Mustache.html new file mode 100644 index 0000000000..76a344756c --- /dev/null +++ b/templates/web/Mustache/Prod/Feedback-Badge.Mustache.html @@ -0,0 +1,47 @@ +
    + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    + {{ display_name }} +
    + {{ subtitle }} +
    + + + + + + + + + + + +
    +
    +
    +
    \ No newline at end of file diff --git a/templates/web/Mustache/Prod/Feedback-SendForm.Mustache.html b/templates/web/Mustache/Prod/Feedback-SendForm.Mustache.html new file mode 100644 index 0000000000..cacc0bbb21 --- /dev/null +++ b/templates/web/Mustache/Prod/Feedback-SendForm.Mustache.html @@ -0,0 +1,27 @@ +
    + +
    + + +
    +
    + + +
    +
    + + +
    + +
    \ No newline at end of file diff --git a/templates/web/Mustache/Prod/List-Badge.Mustache.html b/templates/web/Mustache/Prod/List-Badge.Mustache.html new file mode 100644 index 0000000000..aa71d2f9a1 --- /dev/null +++ b/templates/web/Mustache/Prod/List-Badge.Mustache.html @@ -0,0 +1,29 @@ +
    + + + + + + + + + +
    + + +
    + + + + + + + +
    + {{ display_name }} +
    + {{ subtitle }} +
    +
    +
    +
    \ No newline at end of file diff --git a/templates/web/Mustache/Prod/List-List-Item.Mustache.html b/templates/web/Mustache/Prod/List-List-Item.Mustache.html new file mode 100644 index 0000000000..c02bfc3ed1 --- /dev/null +++ b/templates/web/Mustache/Prod/List-List-Item.Mustache.html @@ -0,0 +1,27 @@ +
  • + + + + + + +
    + + +
    + + + + + + + +
    + {{ name }} +
    + {{ length }} elements +
    +
    +
    +
    +
  • \ No newline at end of file diff --git a/templates/web/Mustache/Prod/List-User-Item.Mustache.html b/templates/web/Mustache/Prod/List-User-Item.Mustache.html new file mode 100644 index 0000000000..e05dd4d9d6 --- /dev/null +++ b/templates/web/Mustache/Prod/List-User-Item.Mustache.html @@ -0,0 +1,27 @@ +
  • + + + + + + +
    + + +
    + + + + + + + +
    + {{ display_name }} +
    + {{ subtitle }} +
    +
    +
    +
    +
  • \ No newline at end of file diff --git a/templates/web/Mustache/Prod/ListEditor-DialogAdd.Mustache.html b/templates/web/Mustache/Prod/ListEditor-DialogAdd.Mustache.html new file mode 100644 index 0000000000..9059cd5343 --- /dev/null +++ b/templates/web/Mustache/Prod/ListEditor-DialogAdd.Mustache.html @@ -0,0 +1,4 @@ +
    + + +
    \ No newline at end of file diff --git a/templates/web/Mustache/Prod/ListEditor-DialogDelete.Mustache.html b/templates/web/Mustache/Prod/ListEditor-DialogDelete.Mustache.html new file mode 100644 index 0000000000..52e664cb06 --- /dev/null +++ b/templates/web/Mustache/Prod/ListEditor-DialogDelete.Mustache.html @@ -0,0 +1,3 @@ +

    + {{sureToRemoveList}} +

    \ No newline at end of file diff --git a/templates/web/Mustache/Prod/Push-Badge.Mustache.html b/templates/web/Mustache/Prod/Push-Badge.Mustache.html new file mode 100644 index 0000000000..e5b208fecb --- /dev/null +++ b/templates/web/Mustache/Prod/Push-Badge.Mustache.html @@ -0,0 +1,37 @@ +
    + + + + + + + + + +
    + + +
    + + + + + + + + + + + +
    + {{ display_name }} +
    + {{ subtitle }} +
    + + + +
    +
    +
    +
    \ No newline at end of file diff --git a/templates/web/admin/databox/doc_structure.twig b/templates/web/admin/databox/doc_structure.twig index f3fe059f73..7cde2f3672 100644 --- a/templates/web/admin/databox/doc_structure.twig +++ b/templates/web/admin/databox/doc_structure.twig @@ -25,9 +25,9 @@ - - - + + + + li.selected, div.selected{ + background-color:#f0ad30; + color:white; + } + li.selected a, div.selected a{ + background-color:#f0ad30; + color:white; + } + #right-ajax.loading{ + background-image: url(/skins/icons/loaderFFF.gif); + background-position: center center; + background-repeat: no-repeat; + } + {% endblock %} {% block javascript %} - - - - + + + {% endblock %} {% block content %} -
    -
    -
    +
    +
    +
    {% include 'admin/tree.html.twig' %} +
    +
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    -
    + {% if notice %} +
    + {% if notice == "install_success" %} + {% trans %}Successful install{% endtrans %} + {% endif %} +
    + {% endif %} + + +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    {% endblock %} diff --git a/templates/web/admin/publications/fiche.html b/templates/web/admin/publications/fiche.html index 7478e9a41d..a942e5065b 100644 --- a/templates/web/admin/publications/fiche.html +++ b/templates/web/admin/publications/fiche.html @@ -42,7 +42,7 @@ {% for databox in user.ACL().get_granted_sbas('bas_chupub') %} {% for collection in databox.get_collections() %} - + {% endfor %} {% endfor %} diff --git a/templates/web/admin/subdefs.twig b/templates/web/admin/subdefs.twig index dcc108fd72..8a5961e4ec 100644 --- a/templates/web/admin/subdefs.twig +++ b/templates/web/admin/subdefs.twig @@ -3,329 +3,347 @@ {% block stylesheet %} - + + body{ + overflow:auto; + } + {% endblock %} {% block javascript %} - - - + + + $( "#dialog-form" ).dialog({ + autoOpen: false, + height: 250, + width: 350, + modal: true, + buttons: { + "Create a Subdef": function() { + var bValid = true; + + allFields.removeClass( "ui-state-error" ); + + bValid = bValid && checkLength( name, "subdef name", 3, 16 ); + bValid = bValid && checkSpecialChar( name ); + bValid = bValid && checkPresence( name ); + + + + if ( bValid ) { + $('input[name="add_subdef[group]"]').val(get_current_group()); + $('input[name="add_subdef[name]"]').val(name.val()); + $('input[name="add_subdef[class]"]').val(accessclass.val()); + $( this ).dialog( "close" ); + $('form.subdefs').submit(); + } + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + allFields.val( "" ).removeClass( "ui-state-error" ); + } + }); + + $( "#create-subdef" ) + .button() + .click(function() { + $( "#dialog-form" ).dialog( "open" ); + }); + + $('.subdef_deleter') + .button() + .click(function(){ + delete_subdef($(this).next('input[name="subdef"]').val()); + + return false; + }); + + function delete_subdef(name) + { + $( "#dialog-delete-subdef" ).dialog({ + resizable: false, + height:140, + modal: true, + buttons: { + "Delete subdef": function() { + $('#delete_subdef').val(name); + $( this ).dialog( "destroy" ); + $('form.subdefs').submit(); + }, + Cancel: function() { + $( this ).dialog( "destroy" ); + } + } + }); + } + + }); + + + {% endblock %} {% block content %} - - + + function importlist() + { + var myObj = new Object(); + myObj.myOpener = self; + window.showModalDialog ('/admin/import0.php?rand='+Math.random(),myObj, 'dialogWidth:550px;dialogHeight:330px;center:yes;help:no;status:no;scrollbars:no' ); + + } + function exportlist() + { + $('#export_form').submit(); + } + + +
    {% endblock %} \ No newline at end of file diff --git a/templates/web/api/auth/application_dev_new.twig b/templates/web/api/auth/application_dev_new.twig index df460e556e..5490f7092c 100644 --- a/templates/web/api/auth/application_dev_new.twig +++ b/templates/web/api/auth/application_dev_new.twig @@ -1,80 +1,94 @@ -{% macro input(name, value, violations, type, size) %} +{% macro input(name, value, violations, property, type, size) %} {% if violations is none %} - + {% else %} {% set hasError = "false" %} {% for violation in violations %} - {% if violation.getPropertyPath == name and hasError == "false" %} + {% if violation.getPropertyPath == property and hasError == "false" %} {% set hasError = "true" %} - -
    {{violation.getMessage}}
    + +
    {{ violation.getInvalidValue }} - {{violation.getMessage}}
    {% endif %} {% endfor %} {% if hasError == "false" %} - {% endif %} + {% endif %} {% endif %} {% endmacro %} -{% macro textarea(name, value, violations, rows, cols) %} +{% macro textarea(name, value, violations,property, rows, cols) %} {% if violations is none %} - + {% else %} {% set hasError = "false" %} {% for violation in violations %} - {% if violation.getPropertyPath == name and hasError == "false" %} + {% if violation.getPropertyPath == property and hasError == "false" %} {% set hasError = "true" %} - -
    {{violation.getMessage}}
    + +
    {{violation.getMessage}}
    {% endif %} {% endfor %} {% if hasError == "false" %} - + {% endif %} {% endif %} {% endmacro %} {% block dev %} -
    + {% if form is none %} {% set name, description, website, callback = '', '', '', ''%} + {% set app_type = 'web'%} {% else %} {% set name = form.name %} {% set description = form.description %} {% set website = form.website %} {% set callback = form.callback %} + {% set app_type = form.type %} {% endif %} - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + {% if app_type == "web" %} + + + + + {% endif %} + + + +
    {{ _self.input("name", name, violations) }}
    {{ _self.textarea("description", description, violations,5,17) }}
    {{ _self.input("website", website|default("http://"), violations) }}
    {% trans 'Application web' %} - +
    {{ _self.input("name", name, violations, 'name') }}
    {{ _self.textarea("description", description, 'description', violations, 5, 17) }}
    + + {{ _self.input("website", website, violations, 'urlwebsite') }}
    {% trans 'Application web' %} + {% trans 'Application desktop' %} -
    {{ _self.input("callback", callback|default("http://"), violations) }}
    + + {{ _self.input("callback", callback, violations, 'urlcallback') }}
    -
    +
    -
    +
    {% endblock %} diff --git a/templates/web/api/auth/application_dev_show.twig b/templates/web/api/auth/application_dev_show.twig index 3134c16407..b2d6d53388 100644 --- a/templates/web/api/auth/application_dev_show.twig +++ b/templates/web/api/auth/application_dev_show.twig @@ -2,14 +2,14 @@

    {% trans 'Application' %}

    -

    {% trans 'settings OAuth' %}

    {% trans 'Les parametres oauth de votre application.' %}

    @@ -25,7 +25,16 @@ {% trans 'URL de callback' %} - {{app.get_redirect_uri}} + {% if app.get_type == constant('API_OAuth2_Application::DESKTOP_TYPE') %} + + {{app.get_redirect_uri}} + + {% else %} + {{app.get_redirect_uri}} + + + + {%endif%} Authorize endpoint @@ -45,25 +54,25 @@ {% trans 'Token' %} - - - + + + {% if not token is none %} {{token|default('')}} {% else %} {% trans 'Le token n\'a pas encore ete genere' %} {% endif %} - - - - - - - - - - + + + + + + + + + + {% endblock %} diff --git a/templates/web/api/auth/end_user_authorization.twig b/templates/web/api/auth/end_user_authorization.twig index 2f553072d7..eafb6a95c6 100644 --- a/templates/web/api/auth/end_user_authorization.twig +++ b/templates/web/api/auth/end_user_authorization.twig @@ -1,62 +1,119 @@ + - - {% if not session.is_authenticated %} -
    - {% for key,value in auth.getParams %} - - {% endfor %} - {% if errorMessage %} -

    {% trans 'mauvais login / mot de passe' %}

    - {% endif %} - {% trans %} - Bonjour, veuillez vous identifier sur {{home_title}} - {% endtrans %} - - - - - -
    - {% else %} - {% if user is not none %} - {% set username = '' ~ user.get_display_name() ~ '' %} -

    - {% trans %} - Hello {{username}} - {% endtrans %} -

    - {% endif %} - {% if auth.getClient() is not none %} -

    -

    {% trans 'Description' %}

    - {{auth.getClient.get_description}} -

    -

    - {% set application_name = auth.getClient.get_name() %} - {% trans %} - {{application_name}} wants to acces to your data on {{home_title}} - {% endtrans %} -

    -

    - {% trans 'Do you authorize the app to do its thing ?' %} -

    - {% endif %} -

    -

    - {% for key,value in auth.getParams %} - - {% endfor %} - - -
    -
    - {% for key,value in auth.getParams %} - - {% endfor %} - - -
    -

    - {% endif %} - + + + Phraseanet Authentication + + + + + + + + + + + + + + + + + + +
    +
    + +
    +

    {{home_title}}

    +
    + + {% if not session.is_authenticated %} +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + {% if errorMessage %} + + {% endif %} + + + + +
    +

    + {% trans 'Problèmes de connexion ?' %} +

    +
    + {% else %} + {% if user is not none %} + {% set username = '' ~ user.get_display_name() ~ '' %} +
    + +
    + {% endif %} + {% if auth.getClient() is not none %} +
    +
    +

    {% trans %}Autorisation d'accès{% endtrans %}

    +
    +
    + {% set application_name = auth.getClient.get_name() %} +

    + {% trans %} + Autorisez-vous l'application "{{application_name}}" à accéder à votre contenu sur {{home_title}} ? + {% endtrans %} +

    +
    +
    + {% endif %} +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + + +
    +
    + {% for key,value in auth.getParams %} + + {% endfor %} + + +
    +
    + {% endif %} + +
    +
    + + + + + + + + + + + + + + + + + diff --git a/templates/web/api/auth/native_app_access_token.twig b/templates/web/api/auth/native_app_access_token.twig index 6d31deaf8c..9b438febf4 100644 --- a/templates/web/api/auth/native_app_access_token.twig +++ b/templates/web/api/auth/native_app_access_token.twig @@ -1,28 +1,98 @@ + - - - {% if error is defined %} - {% trans 'Fail' %} - {% else %} - {% trans 'Success' %} - {% endif %} - - - - {% if error is defined %} -

    - {% trans %} - Erreur : {{error}} - {% endtrans %} -

    - {% else %} - -

    - {% set expiration_date = token.expires_in() %} - {% trans %} - Expire dans {{expiration_date}} - {% endtrans %} -

    - {% endif %} - + + + + {% if error is defined %} + {% trans 'Fail' %} + {% else %} + {% trans 'Success' %} + {% endif %} + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +

    {{home_title}}

    +
    + + {% if user is not none %} + {% set username = '' ~ user.get_display_name() ~ '' %} +
    + +
    + {% endif %} +
    + {% if error is defined %} +
    +

    {% trans %}Erreur{% endtrans %}

    +
    +
    +

    + {% trans %} + {{error}} + {% endtrans %} +

    + +
    + {% else %} +
    +

    {% trans %}Code d'accès{% endtrans %}

    +
    +
    +

    + {% trans %} + Copiez le code ci-dessous, retournez dans votre application et collez-le à l'endroit requis : + {% endtrans %} +

    + +
    + {% endif %} +
    +

    + +
    +
    + + + + + + + + + + + + + + + + + diff --git a/templates/web/common/caption.html b/templates/web/common/caption.html index 29dfc8ba3f..3072f0e649 100644 --- a/templates/web/common/caption.html +++ b/templates/web/common/caption.html @@ -6,13 +6,15 @@ {% import 'common/caption_templates/preview.html' as cap_prev %} {% if view == 'answer' %} - {{cap_ans.format_caption(record, highlight, searchEngine)}} + {{cap_ans.format_caption(record, highlight|default(''), searchEngine|default(null))}} {% elseif view == 'lazaret' %} - {{cap_laz.format_caption(record, highlight, searchEngine)}} + {{cap_laz.format_caption(record, highlight|default(''), searchEngine|default(null))}} {% elseif view == 'preview' %} - {{cap_prev.format_caption(record, highlight, searchEngine)}} + {{cap_prev.format_caption(record, highlight|default(''), searchEngine|default(null))}} {% elseif view == 'basket' %} - {{cap_bas.format_caption(record, highlight|default(''), searchEngine)}} + {{cap_bas.format_caption(record, highlight|default(''), searchEngine|default(null))}} {% elseif view == 'overview' %} - {{cap_ovr.format_caption(record, highlight|default(''), searchEngine)}} + {{cap_ovr.format_caption(record, highlight|default(''), searchEngine|default(null))}} +{% elseif view == 'publi' %} + {{cap_pub.format_caption(record, '', null)}} {% endif %} \ No newline at end of file diff --git a/templates/web/common/databox_field_restrictions.twig b/templates/web/common/databox_field_restrictions.twig index 86dd92a6ed..82a9bd4468 100644 --- a/templates/web/common/databox_field_restrictions.twig +++ b/templates/web/common/databox_field_restrictions.twig @@ -10,13 +10,6 @@

    -{% if field.get_type() == 'datetime' %} - {% trans 'phraseanet::technique::datetime-edit-explain' %}
    -{% elseif field.get_type() == 'date' %} - {% trans 'phraseanet::technique::date-edit-explain (aaaa/mm/jj)' %}
    -{% elseif field.get_type() == 'time' %} - {% trans 'phraseanet::technique::time-edit-explain (hh:mm:ss)' %}
    -{% endif %} {% if field.get_source().minLength() > 0 %} {% set minLength = field.get_source().minLength() %} diff --git a/templates/web/common/dialog_export.twig b/templates/web/common/dialog_export.twig index 2990e8b452..5440cdb9cf 100644 --- a/templates/web/common/dialog_export.twig +++ b/templates/web/common/dialog_export.twig @@ -236,9 +236,9 @@ @@ -247,7 +247,7 @@ {% trans 'admin::compte-utilisateur nom' %} * - + @@ -255,7 +255,7 @@ {% trans 'admin::compte-utilisateur prenom' %} * - + @@ -263,7 +263,7 @@ {% trans 'admin::compte-utilisateur email' %} * - + @@ -271,7 +271,7 @@ {% trans 'admin::compte-utilisateur telephone' %} - + @@ -279,7 +279,7 @@ {% trans 'admin::compte-utilisateur societe' %} - + @@ -287,7 +287,7 @@ {% trans 'admin::compte-utilisateur poste' %} - + @@ -295,7 +295,7 @@ {% trans 'admin::compte-utilisateur adresse' %} * - + @@ -303,7 +303,7 @@ {% trans 'admin::compte-utilisateur code postal' %} * - + @@ -311,7 +311,7 @@ {% trans 'admin::compte-utilisateur ville' %} * - + @@ -319,7 +319,7 @@ {% trans 'admin::compte-utilisateur fax' %} - + @@ -492,12 +492,14 @@ count += parseInt($(count_el).val()); } }); + + {% set max_download = registry.get('GV_download_max', 120) %} {% set alert_too_big%} - "{% trans 'You can not directly download more than 120Mo ; time to package all documents is too long' %}\n"+ + "{% trans %} You can not directly download more than {{max_download}} Mo ; time to package all documents is too long{% endtrans %}\n"+ "{% trans 'You can alternatively receive an email when the download is ready.' %}\n\n"+ "{% trans 'Would you like to receive an e-mail when your download is ready ?' %}" {% endset %} - if(count>1 && total/1024/1024 > 120) + if(count>1 && total/1024/1024 > {{max_download}}) { if(confirm({{alert_too_big|escape("js")}})) { @@ -588,10 +590,12 @@ $('#sendmail .sendmail_button').bind('click',function(){ if(!check_subdefs($('#sendmail'))) - - return false; - $('#sendmail .sendmail_button_loader').css('visibility','visible'); - $(this).attr('disabled','disabled'); + { + return false; + } + $('#sendmail .close_button').trigger("click"); + //$('#sendmail .sendmail_button_loader').css('visibility','visible'); + //$(this).attr('disabled','disabled'); $('#sendmail form').submit(); }); $('#dialog_dwnl .datepicker').datepicker({ diff --git a/templates/web/common/drop_down_options.html b/templates/web/common/drop_down_options.html index 77fa742bad..ca7ca86aec 100644 --- a/templates/web/common/drop_down_options.html +++ b/templates/web/common/drop_down_options.html @@ -7,10 +7,10 @@
    - {% if user.ACL.has_right_on_base(record.get_base_id, 'canputinalbum') %} + {% if user.ACL.has_right_on_base(record.get_base_id, 'canputinalbum') and not record.is_grouping() %}
    + onclick="evt_add_in_chutier('{{record.get_sbas_id}}','{{record.get_record_id}}',false,this);return(false);"> {% trans 'action : ajouter au panier' %}
    @@ -42,4 +42,4 @@ -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/templates/web/common/index.twig b/templates/web/common/index.twig index 12b66755c3..0418a0473f 100644 --- a/templates/web/common/index.twig +++ b/templates/web/common/index.twig @@ -1,5 +1,5 @@ - + {% if local_title is defined%}{{local_title}} | {% endif %}{{home_title}} - {{ module_name }} @@ -13,10 +13,8 @@
    {% include 'common/menubar.twig' %} -
    -
    - {% block content %}{% endblock %} -
    +
    + {% block content %}{% endblock %}
    {% include 'common/analytics.twig' %} diff --git a/templates/web/common/menubar.twig b/templates/web/common/menubar.twig index ea020127eb..3dc85e9d3b 100644 --- a/templates/web/common/menubar.twig +++ b/templates/web/common/menubar.twig @@ -146,7 +146,7 @@ {% endif %}
  • - + {% trans 'phraseanet:: aide' %} diff --git a/templates/web/common/preview.html b/templates/web/common/preview.html index 81b3ebbd78..6adfc8cfa9 100644 --- a/templates/web/common/preview.html +++ b/templates/web/common/preview.html @@ -1,7 +1,7 @@ {% import 'common/thumbnail.html' as thumbnail %} -{% if not_wrapped %} +{% if not_wrapped is defined and not_wrapped %} {% set wrap = false %} {% else %} {% set wrap = true %} diff --git a/templates/web/common/technical_datas.twig b/templates/web/common/technical_datas.twig index 42e4af1557..e4be582d65 100644 --- a/templates/web/common/technical_datas.twig +++ b/templates/web/common/technical_datas.twig @@ -2,18 +2,23 @@ {% if record.is_grouping() == false %} - {% if document.get_width() %} - {% trans 'Largeur' %} : - {{document.get_width()}} -
    - {% endif %} + {% set document = record.get_subdef('document') %} + + {% if document %} + {% if document.get_width() %} + {% trans 'Largeur' %} : + {{document.get_width()}} +
    + {% endif %} - {% if document.get_height() %} - {% trans 'Hauteur' %} : - {{document.get_height()}} -
    + {% if document.get_height() %} + {% trans 'Hauteur' %} : + {{document.get_height()}} +
    + {% endif %} {% endif %} + {% if record.get_original_name() %} {% trans 'Nom Original' %} : {{record.get_original_name() }} @@ -26,22 +31,26 @@
    {% endif %} - {% if document.get_size() %} - {% trans 'Taille' %} : - {{document.get_size()|formatoctet}} -
    + {% if document %} + {% if document.get_size() %} + {% trans 'Taille' %} : + {{document.get_size()|formatoctet}} +
    + {% endif %} {% endif %} - {% if record.get_type() == 'image' and document.get_width() and document.get_height() %} - {% trans 'Dimensions a l\'impression' %} -
    - {% set size_w = (document.get_width() * (254/100) / 300) %} - {% set size_h = (document.get_height() * (254/100) / 300) %} - 300 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm - {% set size_w = (document.get_width() * (254/100) / 72) %} - {% set size_h = (document.get_height() * (254/100) / 72) %} -
    72 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm + {% if document %} + {% if record.get_type() == 'image' and document.get_width() and document.get_height() %} + {% trans 'Dimensions a l\'impression' %} +
    + {% set size_w = (document.get_width() * (254/100) / 300) %} + {% set size_h = (document.get_height() * (254/100) / 300) %} + 300 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm + {% set size_w = (document.get_width() * (254/100) / 72) %} + {% set size_h = (document.get_height() * (254/100) / 72) %} +
    72 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm + {% endif %} {% endif %} {% if record.get_type() == 'video' %} diff --git a/templates/web/common/thumbnail.html b/templates/web/common/thumbnail.html index d812c2f96b..678e598a5b 100644 --- a/templates/web/common/thumbnail.html +++ b/templates/web/common/thumbnail.html @@ -40,7 +40,7 @@ {% endif %} - + {% if session.is_authenticated() == true %} {% set url = thumbnail.get_url() %} {% else %} @@ -51,7 +51,108 @@ {% endif %} {% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %} {% set random = thumbnail.get_random() %} -
    +
    +
    + + +
    + + {% elseif record_type == 'FLEXPAPER' %} + {% set random = thumbnail.get_random() %} +
    +
    + + +
    + + + {% elseif record_type == 'AUDIO_MP3' %} + {% set random = thumbnail.get_random() %} +
    +
    + + +
    + + {% else %} + + + + {% endif %} + {% if wrap %} +
    + {% endif %} + + +{% endmacro %} + + + +{% macro format_fit(thumbnail, b_w, b_h, extraclass, session, wrap)%} + {% set record_type = thumbnail.get_type() %} + + {% if record_type == 'AUDIO_MP3' %} + + {% set d_width = 320 %} + {% set d_height = 60 %} + {% set top = 0 %} + {% elseif record_type == 'FLEXPAPER' %} + + {% set d_width = 800 %} + {% set d_height = 600 %} + {% set top = 0 %} + {% else %} + + {% set b_width = b_w %} + {% set b_height = b_h|default(b_w) %} + + {% set b_ratio = b_width / b_height %} + {% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %} + + {% if i_ratio > b_ratio%} + {% set d_height = b_height %} + {% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %} + {% set left = (b_height - d_height) / 2 %} + {% else %} + {% if b_height > thumbnail.get_height() %} + {% set d_height = thumbnail.get_height() %} + {% else %} + {% set d_height = b_height %} + {% endif %} + {% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %} + {% set top = ((b_height - d_height) / 2) %} + {% endif %} + + {% endif %} + + + + {% if session.is_authenticated() == true %} + {% set url = thumbnail.get_url() %} + {% else %} + {% set url = thumbnail.get_permalink().get_url() %} + {% endif %} + {% if wrap %} +
    + {% endif %} + {% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %} + {% set random = thumbnail.get_random() %} +
    diff --git a/templates/web/lightbox/IE6/agreement_box.twig b/templates/web/lightbox/IE6/agreement_box.twig index 9c2db96dfd..36a88eecb6 100644 --- a/templates/web/lightbox/IE6/agreement_box.twig +++ b/templates/web/lightbox/IE6/agreement_box.twig @@ -1,41 +1,51 @@ -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() %}
    - +
    {% trans 'VALIDATION' %}{% trans 'lightbox::recaptitulatif' %} + + {% trans 'lightbox::recaptitulatif' %} + +
    - {% if basket.is_valid() %} -
    {{basket.get_validation_infos}}
    + {% if basket.getValidation() %} +
    + {{ basket.getValidation().getValidationString(user) }} +
      - {% for choice in basket_element.get_choices() %} - {% if choice.agreement == 1 %} + {% for validation_data in basket_element.getValidationDatas() %} + {% if basket.getValidation().getParticipant(user).getCanSeeOthers() or validation_data.getParticipant().getUser() == core.getAuthenticatedUser() %} + {% if validation_data.getAgreement() == true %} {% set classuser = 'agree' %} - {% elseif choice.agreement == -1 %} - {% set classuser = 'disagree' %} - {% else %} + {% elseif validation_data.getAgreement() is null %} {% set classuser = '' %} + {% else %} + {% set classuser = 'disagree' %} {% endif %} -
    • {{choice.usr_name}}
    • + {% set participant = validation_data.getParticipant().getUser() %} +
    • {{participant.get_display_name()}}
    • + {% endif %} {% endfor %}
    {% endif %} - {% if basket_element and basket_element.is_validation_item() %} + {% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(user).getCanAgree() %}
    diff --git a/templates/web/lightbox/IE6/basket_options.twig b/templates/web/lightbox/IE6/basket_options.twig index ef3212b290..2506376d28 100644 --- a/templates/web/lightbox/IE6/basket_options.twig +++ b/templates/web/lightbox/IE6/basket_options.twig @@ -1,4 +1,4 @@ -{% if basket.is_valid() %} +{% if basket.getValidation() and basket.getValidation().getParticipant(user).getCanAgree() %} @@ -46,8 +45,6 @@ {% set preview = first_item.get_record().get_preview() %} {{thumbnail.format(preview, preview.get_width(), preview.get_height(),'',session, false)}} {% endif %} - {% include 'lightbox/selector_box.twig' %} - {% include 'lightbox/sc_note.twig' %}
    @@ -109,38 +106,17 @@
    -
    + {% set agreement = basket_element.getUserValidationDatas(user).getAgreement() %} +
    {% trans 'validation:: OUI' %}
    -
    +
    {% trans 'validation:: NON' %}
    -
    {% if first_item %}{{first_item.get_order()}}{% endif %}
    +
    {% if first_item %}{{first_item.get_ord()}}{% endif %}
    @@ -35,7 +35,6 @@
    - {% include 'lightbox/IE6/sc_options_box.twig' %}
    - + +
    - + + +
    +
    diff --git a/templates/web/lightbox/IE6/feed_options_box.twig b/templates/web/lightbox/IE6/feed_options_box.twig new file mode 100644 index 0000000000..174b50637a --- /dev/null +++ b/templates/web/lightbox/IE6/feed_options_box.twig @@ -0,0 +1,30 @@ + + {% if feed_element %} + + + + + + + +
    + +
    + | + {% endif %} +
    + diff --git a/templates/web/lightbox/IE6/index.twig b/templates/web/lightbox/IE6/index.twig index cfb6aa6a8b..fcee3de579 100644 --- a/templates/web/lightbox/IE6/index.twig +++ b/templates/web/lightbox/IE6/index.twig @@ -3,13 +3,13 @@ {% import 'common/thumbnail.html' as thumbnail %} {% block javascript %} - - + + {% endblock %} {% block stylesheet %} - + {% endblock %} {% block icon %} @@ -30,67 +30,62 @@ - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' %} - {% for item in baskets %} - {% if item.is_valid() %} - {% set basket_length = item.get_elements()|length%} - - -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()}} -

    - {% if item.is_validation_finished %} - {% trans '(validation) session terminee' %} - {% elseif item.is_confirmed %} - {% trans '(validation) envoyee' %} - {% else %} - {% trans '(validation) a envoyer' %} - {% endif %} -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    {{item.get_validation_infos}}
    -
    -
    -
    - -
    - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() %} + {% set basket_length = basket.getElements().count() %} + + +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getELements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()}} +

    + {% if basket.getValidation().isFinished() %} + {% trans '(validation) session terminee' %} + {% elseif basket.getValidation().getParticipant(user).getIsConfirmed() %} + {% trans '(validation) envoyee' %} + {% else %} + {% trans '(validation) a envoyer' %} + {% endif %} +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    {{ basket.getValidation.getValidationString(user) }}
    +
    +
    +
    + +
    + + + {% endif %} {% endfor %} @@ -100,59 +95,54 @@ {% trans 'Voici vos paniers' %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set basket_length = item.get_elements()|length%} - - -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()}} -

    -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    -
    -
    - -
    - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() is null %} + {% set basket_length = basket.getElements().count() %} + + +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()}} +

    +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{basket.getDescription()}}
    +
    +
    +
    + +
    + + + {% endif %} {% endfor %} diff --git a/templates/web/lightbox/IE6/sc_container.twig b/templates/web/lightbox/IE6/sc_container.twig index 05e791c83e..d9a827daaf 100644 --- a/templates/web/lightbox/IE6/sc_container.twig +++ b/templates/web/lightbox/IE6/sc_container.twig @@ -1,24 +1,24 @@ {% block basket %}
    - {% for element in basket.get_elements() %} + {% for element in basket.getElements() %}
    - - diff --git a/templates/web/lightbox/IE6/sc_options_box.twig b/templates/web/lightbox/IE6/sc_options_box.twig index 50023759d5..ff4197a9de 100644 --- a/templates/web/lightbox/IE6/sc_options_box.twig +++ b/templates/web/lightbox/IE6/sc_options_box.twig @@ -22,13 +22,19 @@
    - +
    | - {% if basket_element.is_validation_item() %} + {% if basket_element.getBasket().getValidation() %} {% endif %} {% endif %} diff --git a/templates/web/lightbox/IE6/validate.twig b/templates/web/lightbox/IE6/validate.twig index c929ca9dd7..ec67b482d9 100644 --- a/templates/web/lightbox/IE6/validate.twig +++ b/templates/web/lightbox/IE6/validate.twig @@ -4,19 +4,19 @@ {% import 'common/caption_templates/preview.html' as caption %} {% block javascript %} - - + + {% endblock %} {% block stylesheet %} + href="/include/minify/f=include/jslibs/yui2.8/build/reset/reset.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css,skins/lightbox/lightboxie6.css" media="screen"/> {% endblock %} {% block content %} - {% set basket_element = basket.get_first_element%} + {% set basket_element = basket.getElements().first() %}
    @@ -27,11 +27,11 @@ -
    {% if basket_element %}{{basket_element.get_order()}}{% endif %}
    +
    {% if basket_element %}{{basket_element.getOrd()}}{% endif %}
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -44,7 +44,7 @@
    {% if basket_element %} - {% set bask_prev = basket_element.get_record().get_preview() %} + {% set bask_prev = basket_element.getRecord().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} {% include 'lightbox/selector_box.twig' %} @@ -60,8 +60,8 @@
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -82,7 +82,7 @@ {% trans 'notice'%} - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% trans 'Validation'%} @@ -92,16 +92,16 @@
    -
    +
    {% if basket_element %} - {{caption.format_caption(basket_element.get_record())}} + {{caption.format_caption(basket_element.getRecord())}} {% endif %}
    - {% if basket.is_valid() %} + {% if basket.getValidation() %}
    {% include 'lightbox/IE6/agreement_box.twig' %}
    @@ -127,27 +127,19 @@ diff --git a/templates/web/lightbox/agreement_box.twig b/templates/web/lightbox/agreement_box.twig index cb0cdd6a05..326d10dd0c 100644 --- a/templates/web/lightbox/agreement_box.twig +++ b/templates/web/lightbox/agreement_box.twig @@ -4,36 +4,44 @@ {% trans 'VALIDATION' %} - {% trans 'lightbox::recaptitulatif' %} + + + {% trans 'lightbox::recaptitulatif' %} + + - {% if basket.is_valid() %} -
    {{basket.get_validation_infos}}
    + {% if basket.getValidation() %} +
    {{ basket.getValidation().getValidationString(user) }}
      - {% for choice in basket_element.get_choices() %} - {% if choice.agreement == 1 %} + {% for choice in basket_element.getValidationDatas() %} + {% if basket.getValidation().getParticipant(user).getCanSeeOthers() or choice.getParticipant().getUser() == core.getAuthenticatedUser() %} + {% if choice.getAgreement() == true %} {% set classuser = 'agree' %} - {% elseif choice.agreement == -1 %} - {% set classuser = 'disagree' %} - {% else %} + {% elseif choice.getAgreement() is null %} {% set classuser = '' %} + {% else %} + {% set classuser = 'disagree' %} {% endif %} -
    • {{choice.usr_name}}
    • + {% set participant = choice.getParticipant().getUser() %} +
    • {{participant.get_display_name()}}
    • + {% endif %} {% endfor %}
    {% endif %}
    -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(user).getCanAgree() %}
    -
    + {% set agreement = basket_element.getUserValidationDatas(user).getAgreement() %} +
    {% trans 'validation:: OUI' %}
    -
    +
    {% trans 'validation:: NON' %}
    diff --git a/templates/web/lightbox/basket_content_report.twig b/templates/web/lightbox/basket_content_report.twig index 6f5a54de6f..eb598a7b3a 100644 --- a/templates/web/lightbox/basket_content_report.twig +++ b/templates/web/lightbox/basket_content_report.twig @@ -2,17 +2,17 @@ {% import 'common/thumbnail.html' as thumbnail %}
    - {% for basket_element in basket.get_elements() %} - {% set record = basket_element.get_record() %} - + {% for basket_element in basket.getElements() %} + {% set record = basket_element.getRecord() %} +
    @@ -48,8 +48,6 @@ {% set bask_prev = first_item.get_record().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} - {% include 'lightbox/selector_box.twig' %} - {% include 'lightbox/sc_note.twig' %}
    diff --git a/templates/web/lightbox/feed_options_box.twig b/templates/web/lightbox/feed_options_box.twig new file mode 100644 index 0000000000..57b289427d --- /dev/null +++ b/templates/web/lightbox/feed_options_box.twig @@ -0,0 +1,30 @@ + + {% if feed_element %} + + + + + + + +
    + + + | + {% endif %} +
    + diff --git a/templates/web/lightbox/index.twig b/templates/web/lightbox/index.twig index 03b28347c4..bc04070dce 100644 --- a/templates/web/lightbox/index.twig +++ b/templates/web/lightbox/index.twig @@ -3,14 +3,14 @@ {% import 'common/thumbnail.html' as thumbnail %} {% block javascript %} - - + + {% endblock %} {% block stylesheet %} + href="/include/minify/f=include/jslibs/yui2.8/build/reset/reset.css,include/jslibs/jquery.contextmenu.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css,skins/lightbox/lightbox.css" media="screen"/> {% endblock %} {% block icon %} @@ -31,67 +31,62 @@
    - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' %} - {% for item in baskets %} - {% if item.is_valid() %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation is null %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %}
    -
    - {{record.get_number()}} + {{basket_element.getOrd()}}
    {{thumbnail.format(record.get_thumbnail(),165, 125, '', session, true)}}
    @@ -20,22 +20,22 @@
    - {% for choice in basket_element.get_choices()%} + {% for validationDatas in basket_element.getValidationDatas()%}
    - {% if choice.agreement == 1 %} + {% if validationDatas.getAgreement() == true %} {% set imguser = '' %} {% set styleuser = '' %} - {% elseif choice.agreement == -1 %} - {% set imguser = '' %} - {% set styleuser = '' %} - {% else %} + {% elseif validationDatas.getAgreement() is null %} {% set imguser = '' %} {% set styleuser = 'margin-left:18px;' %} + {% else %} + {% set imguser = '' %} + {% set styleuser = '' %} {% endif %} - {{imguser|raw}} {{choice.usr_name}} - {% if choice.note != '' %} - : {{choice.note|nl2br}} + {{imguser|raw}} {{validationDatas.getParticipant().getUser().get_display_name()}} + {% if validationDatas.getNote() != '' %} + : {{validationDatas.getNote()|nl2br}} {% endif %}
    diff --git a/templates/web/lightbox/basket_options.twig b/templates/web/lightbox/basket_options.twig index 34b8492981..bc1735d9d8 100644 --- a/templates/web/lightbox/basket_options.twig +++ b/templates/web/lightbox/basket_options.twig @@ -1,4 +1,4 @@ -{% if basket.is_valid() %} +{% if basket.getValidation() and basket.getValidation().getParticipant(user).getCanAgree() %}
    - {% set basket_element = first_item %} - {% include 'lightbox/sc_options_box.twig' %} + {% set feed_element = first_item %} + {% include 'lightbox/feed_options_box.twig' %}
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()|raw}} -

    - {% if item.is_validation_finished %} - {% trans '(validation) session terminee' %} - {% elseif item.is_confirmed %} - {% trans '(validation) envoyee' %} - {% else %} - {% trans '(validation) a envoyer' %} - {% endif %} -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    {{item.get_validation_infos}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()|raw}} +

    + {% if basket.getValidation().isFinished() %} + {% trans '(validation) session terminee' %} + {% elseif basket.getValidation().getParticipant(user).getIsConfirmed() %} + {% trans '(validation) envoyee' %} + {% else %} + {% trans '(validation) a envoyer' %} + {% endif %} +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    {{ basket.getValidation().getValidationString(user) }}
    +
    +
    +
    + +
    +
    @@ -101,59 +96,54 @@ {% trans 'Voici vos paniers' %}
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()|raw}} -

    -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{ basket.getName()|raw}} +

    +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    +
    +
    + +
    +
    diff --git a/templates/web/lightbox/sc_container.twig b/templates/web/lightbox/sc_container.twig index 5ec72fd961..6baf0cc0e8 100644 --- a/templates/web/lightbox/sc_container.twig +++ b/templates/web/lightbox/sc_container.twig @@ -1,24 +1,25 @@ {% block basket %}
    - {% for element in basket.get_elements() %} + {% for element in basket.getElements() %}
    - - diff --git a/templates/web/lightbox/sc_note.twig b/templates/web/lightbox/sc_note.twig index 6d0a83bbf5..19052320b3 100644 --- a/templates/web/lightbox/sc_note.twig +++ b/templates/web/lightbox/sc_note.twig @@ -1,25 +1,33 @@ -{% if basket_element and basket_element.is_validation_item() %} -
    -
    -
    -
    -

    {% trans 'validation:: votre note' %}

    -
    - {% for user, datas in basket_element.get_choices() %} - {% if datas.note != '' %} -
    - {{datas.usr_name}} : {{datas.note|nl2br}} -
    - {% endif %} - {% endfor %} - -
    - -
    - - -
    -
    -
    +{% if basket_element and basket_element.getBasket().getValidation() %} +
    +
    +
    +
    +

    {% trans 'validation:: votre note' %}

    +
    +
    + {% for validationDatas in basket_element.getValidationDatas() %} + {% if validationDatas.getNote() != '' %} +
    + + {{validationDatas.getParticipant().getUser().get_display_name()}} + : {{ validationDatas.getNote()|nl2br }} +
    + {% endif %} + {% endfor %} + +
    + +
    + + +
    +
    +
    +
    {% endif %} diff --git a/templates/web/lightbox/sc_options_box.twig b/templates/web/lightbox/sc_options_box.twig index d38f60c567..b5a31dbe45 100644 --- a/templates/web/lightbox/sc_options_box.twig +++ b/templates/web/lightbox/sc_options_box.twig @@ -22,13 +22,19 @@
    - +
    | - {% if basket_element.is_validation_item() %} + {% if basket_element.getBasket().getValidation() %} {% endif %} {% endif %} diff --git a/templates/web/lightbox/selector_box.twig b/templates/web/lightbox/selector_box.twig index 98237fd343..6ce75c7340 100644 --- a/templates/web/lightbox/selector_box.twig +++ b/templates/web/lightbox/selector_box.twig @@ -1,8 +1,8 @@ -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() %} {% endif %} diff --git a/templates/web/lightbox/validate.twig b/templates/web/lightbox/validate.twig index 897585b2c1..caede1049c 100644 --- a/templates/web/lightbox/validate.twig +++ b/templates/web/lightbox/validate.twig @@ -4,21 +4,21 @@ {% import 'common/caption_templates/preview.html' as caption %} {% block javascript %} - - + + {% endblock %} {% block stylesheet %} + href="/include/minify/f=include/jslibs/yui2.8/build/reset/reset.css,include/jslibs/jquery.contextmenu.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css,skins/lightbox/lightbox.css" media="screen"/> {% endblock %} {% block content %} - {% set basket_element = basket.get_first_element%} + {% set basket_element = basket.getElements().first() %}
    @@ -29,11 +29,17 @@ -
    {% if basket_element %}{{basket_element.get_order()}}{% endif %}
    +
    + {% if basket_element %} + {{basket_element.getOrd()}} + {% endif %} +
    -
    - {% if basket_element %}{{basket_element.get_record().get_title|raw}}{% endif %} +
    + {% if basket_element %} + {{basket_element.getRecord().get_title}} + {% endif %}
    @@ -46,7 +52,7 @@
    {% if basket_element %} - {% set bask_prev = basket_element.get_record().get_preview() %} + {% set bask_prev = basket_element.getRecord().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} {% include 'lightbox/selector_box.twig' %} @@ -62,8 +68,8 @@
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -78,22 +84,22 @@
    - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% endif %} {% trans 'notice'%}
    -
    +
    {% if basket_element %} - {{caption.format_caption(basket_element.get_record())}} + {{caption.format_caption(basket_element.getRecord())}} {% endif %}
    - {% if basket.is_valid() %} + {% if basket.getValidation() %}
    {% include 'lightbox/agreement_box.twig' %} @@ -116,32 +122,24 @@ - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% endif %} @@ -168,13 +166,15 @@
    - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% endif %} {% endblock %} diff --git a/templates/web/login/head.twig b/templates/web/login/head.twig index 1f295d537e..7247fa8cba 100644 --- a/templates/web/login/head.twig +++ b/templates/web/login/head.twig @@ -13,4 +13,4 @@ - + diff --git a/templates/web/login/index.twig b/templates/web/login/index.twig index b5647271ac..bdaaf4fcc9 100644 --- a/templates/web/login/index.twig +++ b/templates/web/login/index.twig @@ -105,7 +105,7 @@ var RecaptchaOptions = { theme : 'custom', tabindex : 3, - lang : '{{session.locale}}' + lang : '{{session.get_locale()}}' }; {% endif %} @@ -158,7 +158,18 @@
    - +
    {% trans 'phraseanet:: language' %} {{login.get_language_selector(registry)}} + {% trans 'phraseanet:: language' %} + + + + © Copyright Alchemy 2005-2010
    diff --git a/templates/web/login/index_layout_displaycooliris.twig b/templates/web/login/index_layout_displaycooliris.twig index 4fe2d9b267..596d8bb463 100644 --- a/templates/web/login/index_layout_displaycooliris.twig +++ b/templates/web/login/index_layout_displaycooliris.twig @@ -1,11 +1,13 @@
    - {{login.get_register_link}} - {{login.get_guest_link}} + {{login.get_register_link|raw}} + {{login.get_guest_link|raw}}
    - {{login.get_password_link}} + + {% trans 'login:: Forgot your password' %} +
    @@ -16,7 +18,7 @@
    - {{captcha_system}} + {{captcha_system|raw}}
    {% endif %} - {{errorWarning}}{{confirmWarning}} + {{errorWarning|raw}}{{confirmWarning|raw}}
    {% trans 'admin::compte-utilisateur identifiant' %}
    diff --git a/templates/web/login/index_layout_displayscroll.twig b/templates/web/login/index_layout_displayscroll.twig index ebebf07486..2b08bad5b5 100644 --- a/templates/web/login/index_layout_displayscroll.twig +++ b/templates/web/login/index_layout_displayscroll.twig @@ -1,11 +1,13 @@
    - {{login.get_register_link}} - {{login.get_guest_link}} + {{login.get_register_link|raw}} + {{login.get_guest_link|raw}}
    - {{login.get_password_link}} + + {% trans 'login:: Forgot your password' %} +
    @@ -14,7 +16,7 @@
    - {{captcha_system}} + {{captcha_system|raw}}
    {% endif %} - {{errorWarning}}{{confirmWarning}} + {{errorWarning|raw}}{{confirmWarning|raw}}
    {% trans 'admin::compte-utilisateur identifiant' %}
    diff --git a/templates/web/login/index_layout_displayx1.twig b/templates/web/login/index_layout_displayx1.twig index d7092d3a64..dc26db2841 100644 --- a/templates/web/login/index_layout_displayx1.twig +++ b/templates/web/login/index_layout_displayx1.twig @@ -27,7 +27,7 @@ {% trans 'Vous etes maintenant deconnecte. A bientot.' %}
    {% endif %} - {{errorWarning}}{{confirmWarning}} + {{errorWarning|raw}}{{confirmWarning|raw}}
    {% trans 'admin::compte-utilisateur identifiant' %}
    @@ -38,9 +38,13 @@
    {% trans 'admin::compte-utilisateur mot de passe' %}
    -
    {{login.get_password_link}}
    +
    - {{captcha_system}} + {{captcha_system|raw}}
    @@ -50,10 +54,10 @@ tabindex="5" type="submit" value="{% trans 'login:: connexion' %}"/>
    - {{login.get_register_link}} + {{login.get_register_link|raw}}
    - {{login.get_guest_link}} + {{login.get_guest_link|raw}}
    diff --git a/templates/web/overview.twig b/templates/web/overview.twig index 8274e70c34..bffa430b3e 100644 --- a/templates/web/overview.twig +++ b/templates/web/overview.twig @@ -60,8 +60,8 @@ {% endblock %} {% block javascript %} - - + + + diff --git a/templates/web/prod/Baskets/Reorder.html.twig b/templates/web/prod/Baskets/Reorder.html.twig new file mode 100644 index 0000000000..c9397fb82b --- /dev/null +++ b/templates/web/prod/Baskets/Reorder.html.twig @@ -0,0 +1,295 @@ +{% import 'common/thumbnail.html' as thumbnail %} +
    + {% trans 'Reordonner automatiquement' %} + + + +
    +
    +
    + {% for element in basket.getElements() %} +
    +
    + {{ element.getRecord().get_title() }} + {{ thumbnail.format(element.getRecord().get_thumbnail(), 80, 80, '', session) }} +
    + + + +
    +
    +
    + {% endfor %} +
    +
    + {% for element in basket.getElements() %} + + {% endfor %} + +
    +
    + + diff --git a/templates/web/prod/Baskets/Update.html.twig b/templates/web/prod/Baskets/Update.html.twig new file mode 100644 index 0000000000..2f14122f00 --- /dev/null +++ b/templates/web/prod/Baskets/Update.html.twig @@ -0,0 +1,56 @@ +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    diff --git a/templates/web/prod/Story/Create.html.twig b/templates/web/prod/Story/Create.html.twig new file mode 100644 index 0000000000..af02d19bde --- /dev/null +++ b/templates/web/prod/Story/Create.html.twig @@ -0,0 +1,58 @@ +
    + + + + + + + + + + + +
    diff --git a/templates/web/prod/Story/Reorder.html.twig b/templates/web/prod/Story/Reorder.html.twig new file mode 100644 index 0000000000..e5db3cf0e6 --- /dev/null +++ b/templates/web/prod/Story/Reorder.html.twig @@ -0,0 +1,295 @@ +{% import 'common/thumbnail.html' as thumbnail %} +
    + {% trans 'Reordonner automatiquement' %} + + + +
    +
    +
    + {% for element in story.get_children() %} +
    +
    + {{ element.get_title() }} + {{ thumbnail.format(element.get_thumbnail(), 80, 80, '', session) }} +
    + + + +
    +
    +
    + {% endfor %} +
    +
    + {% for element in story.get_children() %} + + {% endfor %} + +
    +
    + + diff --git a/templates/web/prod/Tooltip/Basket.html.twig b/templates/web/prod/Tooltip/Basket.html.twig new file mode 100644 index 0000000000..9af10f81d3 --- /dev/null +++ b/templates/web/prod/Tooltip/Basket.html.twig @@ -0,0 +1,29 @@ +{% import 'common/thumbnail.html' as thumbnail %} +
    +
    + + {{ basket.getName() }} + +
    +
    + {{ basket.getDescription()|nl2br }} +
    +
    + {% set nb_records = basket.getElements()|length %} + {% set date = basket.getUpdated()|prettyString %} + {% trans %} + {{ nb_records }} records + {% endtrans %} + - {{ date }} +
    +
    + {% for element in basket.getElements() %} + {% if loop.index <= 9 %} +
    + {{ thumbnail.format(element.getRecord().get_thumbnail(), 80, 80 , '', session) }} +
    + {% endif %} + {% endfor %} +
    +
    +
    diff --git a/templates/web/prod/Tooltip/Story.html.twig b/templates/web/prod/Tooltip/Story.html.twig new file mode 100644 index 0000000000..20886a1bf7 --- /dev/null +++ b/templates/web/prod/Tooltip/Story.html.twig @@ -0,0 +1,28 @@ +{% import 'common/thumbnail.html' as thumbnail %} +
    +
    + + {{ Story.get_title() }} + +
    +
    +
    +
    + {% set nb_records = Story.get_children().get_elements()|length %} + {% set date = Story.get_modification_date()|prettyString %} + {% trans %} + {{ nb_records }} records + {% endtrans %} + - {{ date }} +
    +
    + {% for element in Story.get_children().get_elements() %} + {% if loop.index <= 9 %} +
    + {{ thumbnail.format(element.get_thumbnail(), 80, 80 , '', session) }} +
    + {% endif %} + {% endfor %} +
    +
    +
    diff --git a/templates/web/prod/Tooltip/User.html.twig b/templates/web/prod/Tooltip/User.html.twig new file mode 100644 index 0000000000..cb4c4ce32a --- /dev/null +++ b/templates/web/prod/Tooltip/User.html.twig @@ -0,0 +1,14 @@ +
    +
    + +
    +
    +

    {{ user.get_display_name() }}

    +
      +
    • {{ user.get_email() }}
    • +
    • {{ user.get_company() }}
    • +
    • {{ user.get_job() }}
    • +
    • {{ user.get_position() }}
    • +
    +
    +
    diff --git a/templates/web/prod/User/Add.html.twig b/templates/web/prod/User/Add.html.twig new file mode 100644 index 0000000000..8b94aabc17 --- /dev/null +++ b/templates/web/prod/User/Add.html.twig @@ -0,0 +1,99 @@ +{# designed to be printed in a small box #} +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + +
    +
    +
    + diff --git a/templates/web/prod/basket.twig b/templates/web/prod/WorkZone/Basket.html.twig similarity index 82% rename from templates/web/prod/basket.twig rename to templates/web/prod/WorkZone/Basket.html.twig index a84c6f572d..efdeb2d6c9 100644 --- a/templates/web/prod/basket.twig +++ b/templates/web/prod/WorkZone/Basket.html.twig @@ -1,5 +1,5 @@
    -{% set basket_length = basket.get_elements()|length %} +{% set basket_length = basket.getElements()|length %}
    @@ -30,7 +30,13 @@ {% if user.ACL().has_right('push') %} + {% endif %} + + {% if user.ACL().has_right('push') %} + {% endif %} {% if user.ACL().has_right('bas_chupub') %} @@ -57,16 +63,14 @@
    {% endif %} -{% if basket.is_grouping() %} - {% set basket_scope = 'groupings'%} -{% else %} - {% set basket_scope = 'objects'%} -{% endif %} +{% set basket_scope = 'objects'%} -{% if basket.is_my_valid() %} - {% include 'prod/basket_as_validation.twig'%} +{% import 'prod/WorkZone/Macros.twig' as Macros %} + +{% if basket.getValidation() %} + {{ Macros.display_validation(basket, ordre, user, session) }} {% else %} - {% include 'prod/basket_default.twig'%} + {{ Macros.display_basket(basket, user, session) }} {% endif %}
    diff --git a/templates/web/prod/WorkZone/Browser/Basket.html.twig b/templates/web/prod/WorkZone/Browser/Basket.html.twig new file mode 100644 index 0000000000..0eb974da4f --- /dev/null +++ b/templates/web/prod/WorkZone/Browser/Basket.html.twig @@ -0,0 +1,119 @@ +
    +
    + + + + + +
    + + + {% trans 'Back to basket list' %} + + +

    + + {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(user) %} + + + + + + + + + + + {% endif %} + + {{ Basket.getName() }} + +

    +
    +
    + + {% set top = 0 %} + + {% if Basket.getPusher() %} + {% set top = top + 40 %} +
    +
    +

    + {% set user_name = '' ~ Basket.getPusher().get_display_name() ~ '' %} + {% trans %} + Received from {{ user_name }} + {% endtrans %} +

    +
    +
    + {% endif %} + + {% if Basket.getValidation() %} + {% set top = top + 160 %} +
    +
    +

    + {% set list_participants = '' %} + {% for Participant in Basket.getValidation().getParticipants() %} + + {% if list_participants != '' %} + {% set list_participants = list_participants ~ ', ' %} + {% endif %} + + {% set list_participants = list_participants ~ '' + ~ Participant.getUser().get_display_name + ~ '' %} + {% endfor %} + {% trans %} + Sent for validation to {{ list_participants }} + {% endtrans %} +

    +
    +
    + {% endif %} + + {% set top = top + 40 %} + +
    +
    + {% set ElementsCount = Basket.getElements().count() %} + {% if ElementsCount == 0 %} + {% trans 'No records' %} + {% elseif ElementsCount == 1 %} + {% trans '1 record' %} + {% else %} + {% trans %}{{ ElementsCount }} records{% endtrans %} + {% endif %} +
    +
    + + + {% set top = top + 40 %} + + + {% import 'common/thumbnail.html' as thumbnail %} + + +
    +
    + {% for BasketElement in Basket.getElements() %} + {% set record = BasketElement.getRecord() %} +
    +
    + {{record.get_original_name()}} +
    +
    + {{thumbnail.format(record.get_thumbnail,140,140, '', session, true)}} +
    +
    +
    + +
    +
    + {% endfor %} +
    +
    +
    diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig new file mode 100644 index 0000000000..b0cd370066 --- /dev/null +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -0,0 +1,259 @@ + +
    +
    +
    +
    + + +

    {% trans 'See' %}

    +
      +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    +

    {% trans 'When' %}

    +
      +
    • + + +
    • +
    • + + +
    • + {% set CurrentYear = CurrentYear - 1 %} +
    • + + +
    • + {% set CurrentYear = CurrentYear - 1 %} +
    • + + +
    • + {% set CurrentYear = CurrentYear - 1 %} +
    • + + +
    • +
    +
    + +
    +
    +
    +
    +
    +
    +
    + diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig new file mode 100644 index 0000000000..b74a89dce8 --- /dev/null +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -0,0 +1,140 @@ +{% import 'common/thumbnail.html' as thumbnail %} + +
    + + + + + +
    + {% if Total == 0 %} + {% trans 'No results' %} + {% elseif Total == 1 %} + {% trans '1 result' %} + {% else %} + {% trans %}{{ Total }} results{% endtrans %} + {% endif %} + + {% if Page - 1 > 0 %} + + + + {% endif %} + + Page {{ Page }} / {{ MaxPage }} + + {% if Page + 1 <= MaxPage %} + + + + {% endif %} +
    +
    +
    +
    + {% for Basket in Baskets %} +
    +
    + + + + + + +
    + {% set BasketElement = Basket.getElements().first() %} + {% if BasketElement %} + {{thumbnail.format(BasketElement.getRecord().get_thumbnail(), 80, 80, '', session, true)}} + {% endif %} +
    + {{ Basket.getElements().count() }} +
    +
    +

    + + {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(user) %} + + + + + + + + + + + {% endif %} + + {{ Basket.getName() }} + +

    + + {% if Basket.getPusher() %} +

    + {% set user_name = '' ~ Basket.getPusher().get_display_name() ~ '' %} + {% trans %} + Received from {{ user_name }} + {% endtrans %} +

    + {% endif %} + + + {% if Basket.getValidation() %} +

    + {% set list_participants = '' %} + {% for Participant in Basket.getValidation().getParticipants() %} + + {% if list_participants != '' %} + {% set list_participants = list_participants ~ ', ' %} + {% endif %} + + {% set list_participants = list_participants ~ '' %} + {% set list_participants = list_participants ~ Participant.getUser().get_display_name %} + {% set list_participants = list_participants ~ '' %} + {% endfor %} + {% trans %} + Sent for validation to {{ list_participants }} + {% endtrans %} +

    + {% endif %} + +
    + +
    +
    +
    + {% endfor %} +
    +
    + diff --git a/templates/web/prod/WorkZone/Macros.twig b/templates/web/prod/WorkZone/Macros.twig new file mode 100644 index 0000000000..abffbb66ff --- /dev/null +++ b/templates/web/prod/WorkZone/Macros.twig @@ -0,0 +1,353 @@ +{% macro make_bloc(WorkZone, selected_type, selected_id, srt) %} + +
    +
    + {% set content = WorkZone.getContent(srt) %} + + {% for basket in content.get(constant('\\Alchemy\\Phrasea\\Helper\\WorkZone::VALIDATIONS')) %} + + +
    + + + + {{basket.getName()}} + + + +
    +
    + +
    + + {% endfor %} + + + + {% for basket in content.get(constant('\\Alchemy\\Phrasea\\Helper\\WorkZone::BASKETS')) %} + + +
    + + + + {{basket.getName()}} + + + +
    +
    + +
    + + {% endfor %} + + + + {% for story in content.get(constant('\\Alchemy\\Phrasea\\Helper\\WorkZone::STORIES')) %} + + +
    + + + {{story.getRecord().get_base_id()|get_collection_logo|raw}} + {{story.getRecord().get_title()}} + + + +
    +
    + +
    + + + + + {% endfor %} + +
    +
    +{% endmacro %} + + +{% macro element(wz_scope, container, contained, record, ord, user, session) %} + {% set box_height = 110 %} + {% if user.getPrefs('basket_title_display') == '1' %} + {% set box_height = (box_height + 20) %} + {% endif %} + {% if user.getPrefs('basket_status_display') == '1' %} + {% set box_height = (box_height + 20) %} + {% endif %} + + {% import 'common/thumbnail.html' as thumbnail %} + +
    + + {% if user.getPrefs('basket_title_display') == '1' %} +
    + {{record.get_title()}} +
    + {% endif %} + {% if user.getPrefs('basket_status_display') == '1' %} +
    + {{record.get_status_icons|raw}} +
    + {% endif %} +
    + {{record.get_number()}} +
    + {{thumbnail.format(record.get_thumbnail,82,82, '', session, true)}} +
    + + X + + {% if user.getPrefs('basket_caption_display') == '1' %} +
    + {% endif %} +
    +
    +{% endmacro %} + +{% macro display_basket(basket, user, session) %} + {% for basket_element in basket.getElements() %} + + {{ _self.element('basket', basket, basket_element, basket_element.getRecord(), basket_element.getOrd(), user, session) }} + + {% endfor %} +{% endmacro %} + +{% macro display_validation(basket, ordre, user, session) %} +
    +
    + +
    +
    + + {% for basket_element in basket.getElementsByOrder(ordre) %} + + + + + + +
    + {{ _self.element('basket', basket, basket_element, basket_element.getRecord(), basket_element.getOrd(), user, session) }} + + + {% for choice in basket_element.getValidationDatas() %} + {% if basket.getValidation().getParticipant(user).getCanSeeOthers() or choice.getParticipant().getUser() == core.getAuthenticatedUser() %} + + + + + + {% endif %} + {% endfor %} +
    {{ choice.getParticipant().getUser().get_display_name() }} + {% if choice.getAgreement() == true %} + + {% elseif choice.getAgreement() is null %} + + {% else %} + + {% endif %} + + {% if choice.getNote() != '' %} + + {% endif %} +
    +
    +
    + {% endfor %} + +{% endmacro %} diff --git a/templates/web/prod/WorkZone/Story.html.twig b/templates/web/prod/WorkZone/Story.html.twig new file mode 100644 index 0000000000..c8bb284056 --- /dev/null +++ b/templates/web/prod/WorkZone/Story.html.twig @@ -0,0 +1,80 @@ +
    +{% set story_length = Story.get_children().get_elements()|length %} +
    + + + + + {% if user.ACL().has_right('modifyrecord') %} + + {% endif %} + + {% if user.ACL().has_right('changestatus') %} + + {% endif %} + + {% if user.ACL().has_right('deleterecord') and user.ACL().has_right('addrecord') %} + + {% endif %} + + {% if user.ACL().has_right('push') %} + + {% endif %} + + {% if user.ACL().has_right('push') %} + + {% endif %} + {% if user.ACL().has_right('bas_chupub') %} + + + {% endif %} + + {% if user.ACL().has_right('doctools') %} + + {% endif %} + + +
    +
    + {% trans 'Certaines donnees du panier ont change' %} + + {% trans 'rafraichir' %} + +
    + {% if story_length == 0 %} +
    + {% endif %} + + {% set basket_scope = 'groupings'%} + {% import 'prod/WorkZone/Macros.twig' as Macros %} + + {% for record in Story.get_children().get_elements() %} + + {{ Macros.element('groupings', Story, record, record, record.get_number(), user, session) }} + + {% endfor %} +
    + + diff --git a/templates/web/prod/WorkZone/WorkZone.html.twig b/templates/web/prod/WorkZone/WorkZone.html.twig new file mode 100644 index 0000000000..c2f0a0833a --- /dev/null +++ b/templates/web/prod/WorkZone/WorkZone.html.twig @@ -0,0 +1,2 @@ +{% import 'prod/WorkZone/Macros.twig' as WorkZoneMacros %} +{{WorkZoneMacros.make_bloc(WorkZone, selected_type, selected_id, srt)}} diff --git a/templates/web/prod/actions/Bridge/Dailymotion/upload.twig b/templates/web/prod/actions/Bridge/Dailymotion/upload.twig index 8253429a2e..13e1ce0417 100644 --- a/templates/web/prod/actions/Bridge/Dailymotion/upload.twig +++ b/templates/web/prod/actions/Bridge/Dailymotion/upload.twig @@ -34,7 +34,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -48,7 +48,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -66,7 +66,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} diff --git a/templates/web/prod/actions/Bridge/Flickr/upload.twig b/templates/web/prod/actions/Bridge/Flickr/upload.twig index 3cc46d3556..43735997ab 100644 --- a/templates/web/prod/actions/Bridge/Flickr/upload.twig +++ b/templates/web/prod/actions/Bridge/Flickr/upload.twig @@ -45,7 +45,7 @@ - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -61,7 +61,7 @@ - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -74,7 +74,7 @@ - +
    {{ error_form.display_errors(name, constraint_errors) }} diff --git a/templates/web/prod/actions/Bridge/Youtube/upload.twig b/templates/web/prod/actions/Bridge/Youtube/upload.twig index 6fdf7803d7..2ed6229812 100644 --- a/templates/web/prod/actions/Bridge/Youtube/upload.twig +++ b/templates/web/prod/actions/Bridge/Youtube/upload.twig @@ -34,7 +34,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -49,7 +49,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} @@ -78,7 +78,7 @@
    - +
    {{ error_form.display_errors(name, constraint_errors) }} diff --git a/templates/web/prod/actions/Bridge/deactivated.twig b/templates/web/prod/actions/Bridge/deactivated.twig index e1208f8742..6be4d6cfa6 100644 --- a/templates/web/prod/actions/Bridge/deactivated.twig +++ b/templates/web/prod/actions/Bridge/deactivated.twig @@ -2,9 +2,9 @@

    - {% set bridge_name = api.get_connector().get_name() %} + {% set name = api.get_connector().get_name() %} {% trans %} - {{ bridge_name }} est momentanement indisponible a cause d'un trop grand nombre de requetes + {{ name }} est momentanement indisponible a cause d'un trop grand nombre de requetes {% endtrans %} {%trans %} diff --git a/templates/web/prod/actions/Bridge/index.twig b/templates/web/prod/actions/Bridge/index.twig index e04bbb44f0..b6380e1cc1 100644 --- a/templates/web/prod/actions/Bridge/index.twig +++ b/templates/web/prod/actions/Bridge/index.twig @@ -180,12 +180,14 @@ $(function() { $(".bridge_all_selector", $panel).bind("click", function() { var checkboxes = $('.bridge_element_selector', $panel); var $this = $(this); - var event = jQuery.Event("click"); - event.selector_all = true; checkboxes.each(function(i, checkbox){ if($(checkbox).is(':checked') !== $this.is(':checked')) + { + var event = jQuery.Event("click"); + event.selector_all = true; $(checkbox).trigger(event); + } }); }); diff --git a/templates/web/prod/actions/Bridge/macro_error_form.twig b/templates/web/prod/actions/Bridge/macro_error_form.twig index eecaa00a2f..751b2e01fd 100644 --- a/templates/web/prod/actions/Bridge/macro_error_form.twig +++ b/templates/web/prod/actions/Bridge/macro_error_form.twig @@ -1,9 +1,11 @@ {% macro display_errors(name_input, errors) %} - {% for field_key, field_error in errors %} - {% if name_input == field_key %} - - {{field_error}} - - {% endif %} - {% endfor %} + {% if errors is not none %} + {% for field_key, field_error in errors %} + {% if name_input == field_key %} + + {{field_error}} + + {% endif %} + {% endfor %} + {% endif%} {% endmacro %} diff --git a/templates/web/prod/actions/Bridge/wrapper.twig b/templates/web/prod/actions/Bridge/wrapper.twig index 4b35498b51..ca8e5d3cc9 100644 --- a/templates/web/prod/actions/Bridge/wrapper.twig +++ b/templates/web/prod/actions/Bridge/wrapper.twig @@ -19,7 +19,7 @@ {% if not loop.last %} - {% endif %} {% endfor %} |  - + {% trans 'Fichiers envoyes' %} @@ -35,12 +35,12 @@

    -
    -
    +
    +
    {% block menu %}{% endblock %}
    -
    +
    {% if error_message %}
    {{ error_message }}
    {% endif %} diff --git a/templates/web/prod/actions/Feedback/List-Share.html.twig b/templates/web/prod/actions/Feedback/List-Share.html.twig new file mode 100644 index 0000000000..55697b79e7 --- /dev/null +++ b/templates/web/prod/actions/Feedback/List-Share.html.twig @@ -0,0 +1,213 @@ +{% if list is empty %} + {% trans 'You are not authorized to do this' %} +{% else %} +
    +
    +

    {% trans 'About Roles : ' %}

    +

    + - {% trans 'Admin can edit shares, modify content' %} +

    +

    + - {% trans 'Editor can modify content' %} +

    +

    + - {% trans 'Access user have readonly access' %} +

    +
    +
    +
    + + +
    +
    +
    +
    + {% for owner in list.getOwners() %} + + + + + + + +
    + + + {{ owner.getUser().get_display_name() }} + + + {% if user.get_id() == owner.getUser(user).get_id() %} + {% if owner.getRole() == constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %} + {% trans 'You are Admin' %} + {% endif %} + {% else %} + + + {% endif %} + + {% if user.get_id() != owner.getUser(user).get_id() %} + + + + {% endif %} + + + +
    + {% endfor %} +
    +
    +
    + +{% endif %} diff --git a/templates/web/prod/actions/Feedback/ListsMacros.html.twig b/templates/web/prod/actions/Feedback/ListsMacros.html.twig new file mode 100644 index 0000000000..3b7bb3fe20 --- /dev/null +++ b/templates/web/prod/actions/Feedback/ListsMacros.html.twig @@ -0,0 +1,199 @@ +{% macro ResultTable(query, results, list, sort, ord) %} +
    +
    + + + + + + + + + + + + + + {% for user in results %} + + + + + + + + + + {% endfor %} + +
    + {% trans 'Login' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'First/Last Name' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'Company' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'E-Mail' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'Country' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'Last Template' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'Creation date' %} + + {{ ord == 'asc' ? '▼' : '▲' }} + + +
    + {{ user.get_login() }} + + + {{ user.get_firstname() }} / {{ user.get_lastname() }} + + {{ user.get_company() }} + + {{ user.get_email() }} + + {{ user.get_country() }} + + {{ user.get_login() }} + + {{ user.get_creation_date()|getDate }} +
    +
    +
    + {% set length = '' ~ list.getEntries().count() ~ '' %} + {% trans %} + {{ length }} peoples + {% endtrans %} + {% if query.get_page() > 1 %} + + {% endif %} + {{ query.get_page() }} / {{ query.get_total_page() }} + {% if query.get_page() < query.get_total_page() %} + + {% endif %} +
    +
    + + +{% endmacro %} + + +{% macro badgeReadonly(entry, role) %} +
    + + {% if role >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %} + + + + {% endif %} + + + + + +
    + + + {{ entry.getUser().get_display_name() }} + +
    +
    +{% endmacro %} diff --git a/templates/web/prod/actions/Feedback/ResultTable.html.twig b/templates/web/prod/actions/Feedback/ResultTable.html.twig new file mode 100644 index 0000000000..e7507c5d54 --- /dev/null +++ b/templates/web/prod/actions/Feedback/ResultTable.html.twig @@ -0,0 +1,3 @@ +{% import 'prod/actions/Feedback/ListsMacros.html.twig' as ListsMacros %} + +{{ ListsMacros.ResultTable(query, results, list, sort, ord) }} diff --git a/templates/web/prod/actions/Feedback/list.html.twig b/templates/web/prod/actions/Feedback/list.html.twig new file mode 100644 index 0000000000..a784a9ab2a --- /dev/null +++ b/templates/web/prod/actions/Feedback/list.html.twig @@ -0,0 +1,184 @@ +{% import 'prod/actions/Feedback/ListsMacros.html.twig' as ListsMacros %} + +
    +
    + + + + + {% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %} + + {% endif %} + +
    + {% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %} +
    + + + +
    + {% else %} +

    {{ list.getName() }}

    + {% endif %} +
    + {% if list.getOwner(user).getRole() == constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %} + + + {% trans "Set sharing permission" %} + + {% endif %} + + +
    +
    +
    +
    +
    +

    + {% set length = '' ~ list.getEntries().count() ~ '' %} + {% trans %} + {{ length }} peoples + {% endtrans %} + {% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %} + + {% endif %} +

    +
    +
    + {% set role = list.getOwner(user).getRole() %} + {% for entry in list.getEntries() %} + {{ ListsMacros.badgeReadonly(entry, role) }} + {% endfor %} +
    +
    +
    + {% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %} + + {% endif %} +
    + diff --git a/templates/web/prod/actions/Feedback/lists-all.html.twig b/templates/web/prod/actions/Feedback/lists-all.html.twig new file mode 100644 index 0000000000..bdfd3c0709 --- /dev/null +++ b/templates/web/prod/actions/Feedback/lists-all.html.twig @@ -0,0 +1,30 @@ + + diff --git a/templates/web/prod/actions/Push.html.twig b/templates/web/prod/actions/Push.html.twig new file mode 100644 index 0000000000..c046997c10 --- /dev/null +++ b/templates/web/prod/actions/Push.html.twig @@ -0,0 +1,266 @@ +
    +
    +
    +
    + {% if context == 'Push' %} + + {% else %} + + {% endif %} +
    +
    +
    +

    {% trans 'Grant rights' %}

    +
      + {% if context == 'Feedback' %} +
    • + +
    • +
    • + +
    • + {% endif %} +
    • + +
    • +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    + +
    + {% trans 'Select a user in the list'%},
    + {% trans 'or' %} + {% trans 'Add user' %} +
    +

    + + {% set recommendation = '' %} + + {% set total = RecommendedUsers|length %} + + {% for user in RecommendedUsers %} + + {% if total <= 4 or loop.index <= 4 %} + {% if recommendation != '' and not loop.last %} + {% set recommendation = recommendation ~ ', ' %} + {% elseif recommendation != '' and loop.last %} + {% set recommendation = recommendation %} + {% endif %} + {% set recommendation = recommendation + ~ ' ' + ~ '' + ~ user.get_display_name() + ~ '' %} + {% endif %} + + {% endfor %} + + {% if total > 4 %} + {% set n = total - 4%} + {% set and_many_more %} + {% trans %} + and {{ n }} more peoples + {% endtrans %} + {% endset %} + {% set recommendation = recommendation + ~ '' + ~ and_many_more ~ '' %} + {% endif %} + + + {% if recommendation != '' %} + {% set recommendation = '
    ' ~ recommendation %} + {% trans %} + Please consider send this validation to the following users : {{ recommendation }} + {% endtrans %} + {% endif %} +

    + + +
    + +

    + {% if context == 'Push' %} + {% trans 'Push::unpush permet d\'envoyer un lot d\'image a des destinataires' %} + {% else %} + {% trans 'Push::une validation est une demande d\'appreciation a d\'autres personnes' %} + {% endif %} +

    +
    +
    +
    +
    +
    +
    + + + + + +
    + + + +
    +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + + +
    +
    + diff --git a/templates/web/prod/actions/collection_default.twig b/templates/web/prod/actions/collection_default.twig index 8d6ef7ffdb..f1d3e9d5ed 100644 --- a/templates/web/prod/actions/collection_default.twig +++ b/templates/web/prod/actions/collection_default.twig @@ -61,27 +61,25 @@ {% endif %} - -
    - - -
    diff --git a/templates/web/prod/actions/collection_submit.twig b/templates/web/prod/actions/collection_submit.twig index 519d23e586..4dd00e329c 100644 --- a/templates/web/prod/actions/collection_submit.twig +++ b/templates/web/prod/actions/collection_submit.twig @@ -1,8 +1,8 @@ - - + + diff --git a/templates/web/prod/actions/edit_default.twig b/templates/web/prod/actions/edit_default.twig index 15d2416a52..cfd9a8e2ae 100644 --- a/templates/web/prod/actions/edit_default.twig +++ b/templates/web/prod/actions/edit_default.twig @@ -1,5 +1,13 @@ -{% macro format_diapo(record, user) %} +{% macro format_diapo(record, user, resizable) %} + + {% if resizable == false %} + {% set cont_width = 130 %} + {% set cont_height = 140 %} + {% else %} + {% set cont_width = user.getPrefs('editing_images_size') %} + {% set cont_height = user.getPrefs('editing_images_size') %} + {% endif %} {% set i = record.get_number() %} {% set thumbnail = record.get_thumbnail().get_url() %} @@ -24,7 +32,7 @@ {% set class_status = '' %} {% endif %} -
    +
    {{record.get_original_name()}}
    @@ -53,8 +61,8 @@
    {% endmacro %} @@ -74,7 +82,10 @@ {% if field.get_dces_element %} - {% trans 'Ce champ est decrit comme un element DublinCore' %} + {% trans 'Ce champ est decrit comme un element DublinCore' %} + {% endif %} + {% if field.get_thumbtitle %} + {% endif %} {{field.get_name()}} {% if field.is_required() %} * {% endif %} : @@ -88,12 +99,14 @@ {% macro HTML_Train(editing, user, is_reg) %} {% for record in editing.get_elements %} {% if loop.index != 1 or is_reg != '1' %} - {{_self.format_diapo(record, user)}} + {{_self.format_diapo(record, user, true)}} {% endif %} {% endfor %} {% endmacro %} +{% set actionable = edit.get_count_actionable() %} +{% set not_actionable = edit.get_count_not_actionable() %} -
    \ No newline at end of file +s
    \ No newline at end of file diff --git a/templates/web/prod/index.html b/templates/web/prod/index.html deleted file mode 100644 index fd3b197645..0000000000 --- a/templates/web/prod/index.html +++ /dev/null @@ -1,1266 +0,0 @@ -{% macro bas_list(module, search_datas) %} -{% set unique_id = module.get_random() %} -{% for base in search_datas['bases'] %} -{% set sbas_id = base['sbas_id'] %} -
    - -
    - - -
    - -
    -
      - {% for collection in base["collections"] %} - {% set base_id = collection["base_id"] %} -
    • - - -
    • - {% endfor %} -
    -
    -
    - {% endfor %} - {% endmacro %} - - {% extends "common/index.twig" %} - - {% block icon %} - - {% endblock %} - - {% block rss %} - {% for feed in feeds %} - {% set link = feed.get_user_link(registry, user, 'rss') %} - - {% set link = feed.get_user_link(registry, user, 'atom') %} - - {% endfor %} - {% endblock %} - - {% block stylesheet %} - - - - - - - - - - - -{% endblock %} - - -{% block javascript %} - -{% endblock %} - - -{% block content %} - -{% set search_datas = module_prod.get_search_datas() %} - -
    -
    -
    {% trans 'phraseanet::Nom de l\'application' %}
    -
    {% trans 'Chargement' %}
    -
    -
    -
    -
    -
    -
    -
    - - - - - - -
      -
    - - - - - - - - -
    -
    - - -
    -
    - {% if GV_multiAndReport %} - - - {% else %} - - {% endif %} - - - > {% trans 'prod:: recherche avancee' %} -
    -
    -
    - -
    -
    -
    - - -
    - - {% set ratio = user.getPrefs('search_window') %} - {% if ratio == 0 %} - {% set ratio = '0.333' %} - {% endif %} - {% set w1 = (100 * ratio)|round %} - {% set w2 = (100 - w1) %} -
    -
    - -
    - {% import 'prod/baskets_macro.html' as baskets %} - {{baskets.make_bloc(basket_collection)}} -
    - - {% if GV_thesaurus %} -
    -
    -
    -
    - -
    -
    -
    -
    - -
    - - -
    - - - -
    -
    -
    -
    -
      - {% for base in search_datas['bases'] %} - {% if base['thesaurus'] %} -
    • -
      - {{base['sbas_id']|sbas_names}} -
        {% trans 'chargement' %}
      -
    • - {% endif %} - {% endfor %} -
    -
    -
    -
    -
    -
    -
    -
      - {% for base in search_datas['bases'] %} - {% if base['cterms'] %} -
    • -
      - {{base['sbas_id']|sbas_names}} -
        {% trans 'chargement' %}
      -
    • - {% endif %} - {% endfor %} -
    -
    -
    -
    -
    -
    - - - -
    - {% endif %} -
    - - -
    -
    -
    -
    - - - - - - - - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - {% set actions = {} %} - {% if user.ACL().has_right('modifyrecord') %} - {% set label %} - {% trans 'action : editer' %} - {% endset %} - {% set actions = actions|merge( { 'edit' : {'icon': "/skins/prod/000000/images/ppen_history.gif", 'class':'TOOL_ppen_btn', 'label' : label} }) %} - {% endif %} - {% if user.ACL().has_right('changestatus') %} - {% set label %} - {% trans 'action : status' %} - {% endset %} - {% set actions = actions|merge( { 'status' : {'icon': "/skins/prod/000000/images/chgstatus_history.gif", 'class':'TOOL_chgstatus_btn', 'label' : label} }) %} - {% endif %} - {% if user.ACL().has_right('deleterecord') and user.ACL().has_right('addrecord') %} - {% set label %} - {% trans 'action : collection' %} - {% endset %} - {% set actions = actions|merge( { 'move' : {'icon': "/skins/prod/000000/images/chgcoll_history.gif", 'class':'TOOL_chgcoll_btn', 'label' : label} }) %} - {% endif %} - - {% set n_actions = actions|length %} - - {% if n_actions > 1 %} - - - {% for action in actions %} - {% if loop.first %} - - {% endif %} - {% endfor %} - - - - - {% elseif n_actions == 1 %} - - {% for action in actions %} - - {% endfor %} - - {% endif %} - - {% if user.ACL().has_right('push') and user.ACL().has_right('bas_chupub') %} - - - - - - - - {% elseif user.ACL().has_right('push') %} - - - - {% elseif user.ACL().has_right('bas_chupub') %} - - - - - - - - {% endif %} - {% if user.ACL().has_right('doctools') %} - - - - {% endif %} - {% if user.ACL().has_right('deleterecord') %} - - - - {% endif %} -
    -
    - -
    - {% trans 'Preferences' %} - - - -
    -
    -
    -
    - {% set bool = 0 %} - {% if user.getPrefs('start_page') == 'QUERY' or user.getPrefs('start_page') == 'LAST_QUERY' %} - {% set bool = 1 %} - {% endif %} -
    - {% if bool == 0 %} - {{start_page_content}} - {% endif %} -
    -
    -
    -
    - -
    -
    - - - - - - - - -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - - -{{cgus_agreement|raw}} - - - - - - - - - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - {% if GV_google_api is not empty %} -
    -
    -
    -
    - {% endif %} -
    -
    -
    -
    -
    -
    -
    - {% trans 'boutton::fermer' %} -
    -
    -
    -
    -
    -
    -
    - - - - - - - - -
    - -
    -
    - - -
    -
    - - -
    - - {{_self.bas_list(module_prod, search_datas)}} -
    -
    -
    -
    -
    - {{queries_history|raw}} -
    -
    - {% if queries_topics %} -
    -
    - {{queries_topics|raw}} -
    -
    - {% endif %} -
    - - - - - - - - - -
    -
    - {% trans 'Reordonner automatiquement' %} - - -
    -
    -
    - - - - - - - - - - - - -{% endblock %} - diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig new file mode 100644 index 0000000000..cbf7090790 --- /dev/null +++ b/templates/web/prod/index.html.twig @@ -0,0 +1,1156 @@ +{% macro bas_list(module, search_datas) %} +{% set unique_id = module.getRandom() %} +{% for base in search_datas['bases'] %} +{% set sbas_id = base['sbas_id'] %} +
    + +
    + + +
    + +
    +
      + {% for collection in base["collections"] %} + {% set base_id = collection["base_id"] %} +
    • + + +
    • + {% endfor %} +
    +
    +
    + {% endfor %} + {% endmacro %} + + {% extends "common/index.twig" %} + + {% block icon %} + + {% endblock %} + + {% block rss %} + {% for feed in feeds %} + {% set link = feed.get_user_link(registry, user, 'rss') %} + + {% set link = feed.get_user_link(registry, user, 'atom') %} + + {% endfor %} + {% endblock %} + + {% block stylesheet %} + + + + + + + + + + + + +{% endblock %} + + +{% block javascript %} + +{% endblock %} + + +{% block content %} + +{% set search_datas = module_prod.get_search_datas() %} +
    +
    +
    Phraseanet
    +
    {% trans 'Chargement' %}
    +
    +
    +
    +
    +
    + + +
    + + {% set ratio = user.getPrefs('search_window') %} + {% if ratio == 0 %} + {% set ratio = '0.333' %} + {% endif %} + {% set w1 = (100 * ratio)|round %} + {% set w2 = (100 - w1) %} +
    +
    +
    + +
    + {% import 'prod/WorkZone/Macros.twig' as WorkZoneMacros %} + {{WorkZoneMacros.make_bloc(WorkZone)}} +
    + {% if GV_thesaurus %} +
    +
    +
    +
    + +
    +
    +
    +
    + +
    + + +
    + + + +
    +
    +
    +
    +
      + {% for base in search_datas['bases'] %} + {% if base['thesaurus'] %} +
    • +
      + {{base['sbas_id']|sbas_names}} +
        {% trans 'chargement' %}
      +
    • + {% endif %} + {% endfor %} +
    +
    +
    +
    +
    +
    +
    +
      + {% for base in search_datas['bases'] %} + {% if base['cterms'] %} +
    • +
      + {{base['sbas_id']|sbas_names}} +
        {% trans 'chargement' %}
      +
    • + {% endif %} + {% endfor %} +
    +
    +
    +
    +
    +
    + + + +
    + {% endif %} +
    +
    + + +
    +
    + +
    +
    + + + +
    + + + + + + + +
    + {% if GV_multiAndReport %} + + + {% else %} + + {% endif %} + +
    + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + {% set actions = {} %} + {% if user.ACL().has_right('modifyrecord') %} + {% set label %} + {% trans 'action : editer' %} + {% endset %} + {% set actions = actions|merge( { 'edit' : {'icon': "/skins/prod/000000/images/ppen_history.gif", 'class':'TOOL_ppen_btn', 'label' : label} }) %} + {% endif %} + {% if user.ACL().has_right('changestatus') %} + {% set label %} + {% trans 'action : status' %} + {% endset %} + {% set actions = actions|merge( { 'status' : {'icon': "/skins/prod/000000/images/chgstatus_history.gif", 'class':'TOOL_chgstatus_btn', 'label' : label} }) %} + {% endif %} + {% if user.ACL().has_right('deleterecord') and user.ACL().has_right('addrecord') %} + {% set label %} + {% trans 'action : collection' %} + {% endset %} + {% set actions = actions|merge( { 'move' : {'icon': "/skins/prod/000000/images/chgcoll_history.gif", 'class':'TOOL_chgcoll_btn', 'label' : label} }) %} + {% endif %} + + {% set n_actions = actions|length %} + + {% if n_actions > 1 %} + + + {% for action in actions %} + {% if loop.first %} + + {% endif %} + {% endfor %} + + + + + {% elseif n_actions == 1 %} + + {% for action in actions %} + + {% endfor %} + + {% endif %} + + {% if user.ACL().has_right('push') and user.ACL().has_right('bas_chupub') %} + + + + + + + + {% elseif user.ACL().has_right('push') %} + + + + + + + + {% elseif user.ACL().has_right('bas_chupub') %} + + + + + + + + {% endif %} + {% if user.ACL().has_right('doctools') %} + + + + {% endif %} + {% if user.ACL().has_right('deleterecord') %} + + + + {% endif %} +
    +
    + +
    +
    + + + + + +
    + {% trans 'Preferences' %} + | + + + +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +{{cgus_agreement|raw}} + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + {% if GV_google_api is not empty %} +
    +
    +
    +
    + {% endif %} +
    +
    +
    +
    +
    +
    +
    + {% trans 'boutton::fermer' %} +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + +{% endblock %} + diff --git a/templates/web/prod/preview/appears_in.html b/templates/web/prod/preview/appears_in.html index 404f9dd15a..b0ede7d164 100644 --- a/templates/web/prod/preview/appears_in.html +++ b/templates/web/prod/preview/appears_in.html @@ -4,9 +4,9 @@
  • {% trans 'Apparait aussi dans ces reportages' %}
  • {% for par in parents %}
  • + class="otherRegToolTip" {% if registry.get('GV_rollover_reg_preview') %}tooltipsrc="/prod/tooltip/caption/{{par.get_sbas_id()}}/{{par.get_record_id()}}/basket/" {% endif %}> - {{par.get_reg_name()|raw}} + {{ par.get_title() }}
  • {% endfor %}
@@ -16,10 +16,10 @@
  • {% trans 'Apparait aussi dans ces paniers' %}
  • {% for basket in baskets %} -
  • +
  • - {{basket.get_name()|raw}} + {{basket.getName()}}
  • {% endfor %}
diff --git a/templates/web/prod/preview/basket_train.html b/templates/web/prod/preview/basket_train.html index fa1c9131bc..563490f9f4 100644 --- a/templates/web/prod/preview/basket_train.html +++ b/templates/web/prod/preview/basket_train.html @@ -1,8 +1,8 @@
    - {% for child in record.get_container().get_elements() %} + {% for child in record.get_container().getElements() %} - {% set thumbnail = child.get_record().get_thumbnail() %} + {% set thumbnail = child.getRecord().get_thumbnail() %} {% if thumbnail.is_paysage() %} {% set style = 'width:65px;top:' %} {% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %} @@ -13,17 +13,17 @@ {% endif %} {% set tooltip = '' %} - {% if GV_rollover_reg_preview %} - {% set tooltip = 'tooltipsrc="/prod/tooltip/caption/' ~ child.get_record().get_sbas_id() ~ '/' ~ child.get_record().get_record_id() ~ '/basket/"' %} + {% if registry.get('GV_rollover_reg_preview') %} + {% set tooltip = 'tooltipsrc="/prod/tooltip/caption/' ~ child.getRecord().get_sbas_id() ~ '/' ~ child.getRecord().get_record_id() ~ '/basket/"' %} {% endif %} {% set class = '' %} - {% if record.get_number() == child.get_order() %} + {% if record.get_number() == child.getOrd() %} {% set class = ' selected' %} {% endif %}
  • -
  • {% endfor %} diff --git a/templates/web/prod/preview/caption.html b/templates/web/prod/preview/caption.html index 011271a70e..56b46ce4ab 100644 --- a/templates/web/prod/preview/caption.html +++ b/templates/web/prod/preview/caption.html @@ -3,7 +3,9 @@ {% if user.ACL().has_right_on_base(record.get_base_id, 'canmodifrecord') %}
    - {% trans 'action : editer' %} + + {% trans 'action : editer' %} +
    {% endif %}
    diff --git a/templates/web/prod/preview/feed_train.html b/templates/web/prod/preview/feed_train.html index 2eaba5cec0..2b133ca213 100644 --- a/templates/web/prod/preview/feed_train.html +++ b/templates/web/prod/preview/feed_train.html @@ -13,7 +13,7 @@ {% endif %} {% set tooltip = '' %} - {% if GV_rollover_reg_preview %} + {% if registry.get('GV_rollover_reg_preview') %} {% set tooltip = 'tooltipsrc="/prod/tooltip/preview/' ~ child.get_record().get_sbas_id() ~ '/' ~ child.get_record().get_record_id() ~ '/"'%} {% endif %} diff --git a/templates/web/prod/preview/reg_train.html b/templates/web/prod/preview/reg_train.html index d2abde6909..bc5bff0ca0 100644 --- a/templates/web/prod/preview/reg_train.html +++ b/templates/web/prod/preview/reg_train.html @@ -32,7 +32,7 @@ {% endif %} {% set tooltip = '' %} - {% if GV_rollover_reg_preview %} + {% if registry.get('GV_rollover_reg_preview') %} {% set tooltip = 'tooltipsrc="/prod/tooltip/caption/'~ contained.get_sbas_id() ~'/'~ contained.get_record_id() ~ '/preview/?number=' ~ contained.get_number() ~ '"' %} {% endif %} diff --git a/templates/web/prod/preview/short_history.html b/templates/web/prod/preview/short_history.html index 5386068f8f..252182112b 100644 --- a/templates/web/prod/preview/short_history.html +++ b/templates/web/prod/preview/short_history.html @@ -23,7 +23,8 @@ {% trans 'report::Edition des meta-donnees' %} {% elseif action == 'collection' %} {% set dest = done['final']|implode(', ') %} - {% trans %}report::Changement de collection vers : {{dest}}{% endtrans %} + {% set coll_name = dest|bas_name %} + {% trans %}report::Changement de collection vers : {{coll_name}}{% endtrans %} {% elseif action == 'status' %} {% trans 'report::Edition des status' %} {% elseif action == 'print' %} @@ -55,7 +56,7 @@ {% endif %} {% if user.ACL().has_right_on_base(record.get_base_id(), 'canreport') %} - {% if done['user'].get_id() != session.get_usr_id() %} + {% if done['user'] and done['user'].get_id() != session.get_usr_id() %} {% set user_infos = done['user'].get_display_name() %} {% trans %}report:: par {{ user_infos }}{% endtrans %} {% endif %} diff --git a/templates/web/prod/preview/tools.html b/templates/web/prod/preview/tools.html index 2f5fda19f3..ad246db4ef 100644 --- a/templates/web/prod/preview/tools.html +++ b/templates/web/prod/preview/tools.html @@ -1,14 +1,14 @@ {% if (record.is_from_basket is empty) and user.ACL().has_right_on_base(record.get_base_id(), 'canputinalbum') %}
    + class="baskAdder" title="{% trans 'action : ajouter au panier' %}" + onclick="evt_add_in_chutier('{{record.get_sbas_id()}}','{{record.get_record_id()}}',false,this);return(false);">
    {% endif %} -
    {% if user.ACL().has_right_on_base(record.get_base_id(), 'candwnldhd') or user.ACL().has_right_on_base(record.get_base_id(), 'candwnldpreview') %} -
    {% endif %} diff --git a/templates/web/prod/results/answerabstract.twig b/templates/web/prod/results/answerabstract.twig index b2928525a9..25b2909594 100644 --- a/templates/web/prod/results/answerabstract.twig +++ b/templates/web/prod/results/answerabstract.twig @@ -16,7 +16,7 @@
    {% endif %} {% set th_size = user.getPrefs('images_size')%} -
    +
    {% block content %}{% endblock %}
    {% endif %} diff --git a/templates/web/prod/results/record.html b/templates/web/prod/results/record.html index 92971c7475..4cc47df8de 100644 --- a/templates/web/prod/results/record.html +++ b/templates/web/prod/results/record.html @@ -7,7 +7,7 @@ {% if entry_id %}
    {% elseif record.is_grouping() %}
    {% if is_infouser %} diff --git a/templates/web/report/ajax_report_content.twig b/templates/web/report/ajax_report_content.twig index fe79429105..07f0aa0ff7 100644 --- a/templates/web/report/ajax_report_content.twig +++ b/templates/web/report/ajax_report_content.twig @@ -9,7 +9,7 @@
    {% for key, value in selection %}
    -
    +
    {% block ajax_data_content %}{% endblock %}
    ' . $light_info) ?>
    + + +
    '; +// $b = true; +// foreach ($proposals["BASES"] as $zbase) +// { +// if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) +// { +// $style = $b ? 'style="margin-top:0px;"' : ''; +// $b = false; +// $html .= "

    " . sprintf(_('reponses::propositions pour la base %s'), htmlentities($zbase["NAME"])) . "

    "; +// } +// $t = true; +// foreach ($zbase["TERMS"] as $path => $props) +// { +// $style = $t ? 'style="margin-top:0px;"' : ''; +// $t = false; +// $html .= "

    " . sprintf(_('reponses::propositions pour le terme %s'), htmlentities($props["TERM"])) . "

    "; +// $html .= $props["HTML"]; +// } +// } +// $html .= '
    '; +// +// return($html); +//} diff --git a/www/client/baskets.php b/www/client/baskets.php index 00d37489c5..655bdd71fd 100644 --- a/www/client/baskets.php +++ b/www/client/baskets.php @@ -14,227 +14,245 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); -$session = $appbox->get_session(); +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; -$usr_id = $session->get_usr_id(); +$em = $Core->getEntityManager(); -$request = http_request::getInstance(); -$parm = $request->get_parms("bas", "courChuId", "act", "p0", "first"); - -$parm['p0'] = utf8_decode($parm['p0']); +$Request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); $nbNoview = 0; -$user = User_Adapter::getInstance($session->get_usr_id(), $appbox); +$user = $Core->getAuthenticatedUser(); $ACL = $user->ACL(); $out = null; -if ($parm["act"] == "DELIMG" && $parm["p0"] != "") +if ($Request->get("act") == "DELIMG" && $Request->get("p0") != "") { - $basket = basket_adapter::getInstance($appbox, $parm['courChuId'], $user->get_id()); - $basket->remove_from_ssel($parm['p0']); + $repository = $em->getRepository('\Entities\BasketElement'); + /* @var $repository \Repositories\BasketElementRepository */ + $basket_element = $repository->findUserElement($Request->get('p0'), $user); + $em->remove($basket_element); + $em->flush(); } -if ($parm["act"] == "ADDIMG" && ($parm["p0"] != "" && $parm["p0"] != null)) +if ($Request->get('act') == "ADDIMG" && ($Request->get("p0") != "" && $Request->get("p0") != null)) { - $basket = basket_adapter::getInstance($appbox, $parm['courChuId'], $user->get_id()); - $sbas_id = phrasea::sbasFromBas($parm['bas']); - $record = new record_adapter($sbas_id, $parm['p0']); - $basket->push_element($record, false, false); - unset($record); + $repository = $em->getRepository('\Entities\Basket'); + /* @var $repository \Repositories\BasketRepository */ + $basket = $repository->findUserBasket($Request->get('courChuId'), $user, true); + + $sbas_id = $Request->get('sbas'); + $record = new record_adapter($sbas_id, $Request->get('p0')); + + $BasketElement = new \Entities\BasketElement(); + $BasketElement->setRecord($record); + $BasketElement->setBasket($basket); + $basket->addBasketElement($BasketElement); + + $em->persist($BasketElement); + $em->merge($basket); + + $em->flush(); } -if ($parm["act"] == "DELCHU" && ($parm["p0"] != "" && $parm["p0"] != null)) +if ($Request->get('act') == "DELCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) { - $basket = basket_adapter::getInstance($appbox, $parm['p0'], $user->get_id()); - $basket->delete(); + $repository = $em->getRepository('\Entities\Basket'); + /* @var $repository \Repositories\BasketRepository */ + $basket = $repository->findUserBasket($Request->get('courChuId'), $user, true); + + $em->remove($basket); + $em->flush(); unset($basket); } -if ($parm["act"] == "NEWCHU" && ($parm["p0"] != "" && $parm["p0"] != null)) +$courChuId = $Request->get('courChuId'); + +if ($Request->get('act') == "NEWCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) { - $basket = basket_adapter::create($appbox, $parm['p0'], $user); - $parm['courChuId'] = $basket->get_ssel_id(); + $basket = new \Entities\Basket(); + $basket->setName($Request->get('p0')); + $basket->setOwner($user); + + $em->persist($basket); + $em->flush(); + + $courChuId = $basket->getId(); } -$basket_coll = new basketCollection($appbox, $usr_id, 'name ASC', array('regroup')); -$baskets = $basket_coll->get_baskets(); + +$repository = $em->getRepository('\Entities\Basket'); +/* @var $repository \Repositories\BasketRepository */ +$baskets = $repository->findActiveByUser($user); $out = "
    "; $out .= '"; $out .= ''; -$basket = basket_adapter::getInstance($appbox, $parm['courChuId'], $user->get_id()); -$jscriptnochu = $basket->get_name() . " : " . sprintf(_('paniers:: %d documents dans le panier'), count($basket->get_elements())); +$em = $Core->getEntityManager(); +$repository = $em->getRepository('\Entities\Basket'); +/* @var $repository \Repositories\BasketRepository */ +$basket = $repository->findUserBasket($courChuId, $user, true); -$nbElems = count($basket->get_elements()); +$jscriptnochu = $basket->getName() . " : " . sprintf(_('paniers:: %d documents dans le panier'), $basket->getElements()->count()); + +$nbElems = $basket->getElements()->count(); ?>
    get_size(); +$totSizeMega = $basket->getSize(); echo '
    ' . sprintf(_('paniers:: paniers:: %d documents dans le panier'), $nbElems) . - ($appbox->get_registry()->get('GV_viewSizeBaket') ? ' (' . $totSizeMega . ' Mo)' : '') . '
    '; + ($Core->getRegistry()->get('GV_viewSizeBaket') ? ' (' . $totSizeMega . ' Mo)' : '') . '
    '; ?>
    0 && $basket->is_mine()) - { + echo $out; ?>
    has_right("addtoalbum")) - { ?>
    0 && ($ACL->has_right("candwnldhd") || $ACL->has_right("candwnldpreview") || $ACL->has_right("cancmd") > 0 )) - { -?>
    0) - { -?>
    0 && ($ACL->has_right("candwnldhd") || $ACL->has_right("candwnldpreview") || $ACL->has_right("cancmd") > 0 )) + { + ?>
    0) +{ + ?>
    title="">
get_pusher() instanceof user) +if ($basket->getPusher() instanceof user) +{ + ?>
getPusher()->get_display_name()) + ?>
getElements() as $basket_element) + { + $dim = $dim1 = $top = 0; + + $thumbnail = $basket_element->getRecord()->get_thumbnail(); + + if ($thumbnail->get_width() > $thumbnail->get_height()) // cas d'un format paysage { -?>
get_display_name()) -?>
get_width() > 67) + { + $dim1 = 67; + $top = ceil((67 - 67 * $thumbnail->get_height() / $thumbnail->get_width()) / 2); + } + else // miniature + { + $dim1 = $thumbnail->get_width(); + $top = ceil((67 - $thumbnail->get_height()) / 2); + } + $dim = "width:" . $dim1 . "px"; + } + else // cas d'un format portrait + { + if ($thumbnail->get_height() > 55) + { + $dim1 = 55; + $top = ceil((67 - 55) / 2); + } + else // miniature + { + $dim1 = $thumbnail->get_height(); + $top = ceil((67 - $thumbnail->get_height()) / 2); + } + $dim = "height:" . $dim1 . "px"; } - foreach ($basket->get_elements() as $basket_element) + if ($thumbnail->get_height() > 42) + $classSize = "hThumbnail"; + else + $classSize = "vThumbnail"; + + $tooltip = ""; + + $record = $basket_element->getRecord(); + if ($Core->getRegistry()->get('GV_rollover_chu')) { - - $dim = $dim1 = $top = 0; - - $thumbnail = $basket_element->get_record()->get_thumbnail(); - - if ($thumbnail->get_width() > $thumbnail->get_height()) // cas d'un format paysage - { - if ($thumbnail->get_width() > 67) - { - $dim1 = 67; - $top = ceil((67 - 67 * $thumbnail->get_height() / $thumbnail->get_width()) / 2); - } - else // miniature - { - $dim1 = $thumbnail->get_width(); - $top = ceil((67 - $thumbnail->get_height()) / 2); - } - $dim = "width:" . $dim1 . "px"; - } - else // cas d'un format portrait - { - if ($thumbnail->get_height() > 55) - { - $dim1 = 55; - $top = ceil((67 - 55) / 2); - } - else // miniature - { - $dim1 = $thumbnail->get_height(); - $top = ceil((67 - $thumbnail->get_height()) / 2); - } - $dim = "height:" . $dim1 . "px"; - } - - if ($thumbnail->get_height() > 42) - $classSize = "hThumbnail"; - else - $classSize = "vThumbnail"; - - $tooltip = ""; - - $record = $basket_element->get_record(); - if ($appbox->get_registry()->get('GV_rollover_chu')) - { - $tooltip = 'tooltipsrc="/prod/tooltip/caption/' . $record->get_sbas_id() . '/' . $record->get_record_id() . '/basket/"'; - } -?>
); return(false);" - style="position:relative; top:px; " - class=" baskTips" src="get_url() ?>">
is_mine())//le panier est a moi, je peux effacer des elements - { -?>
get_sbas_id() . '/' . $record->get_record_id() . '/basket/"'; + } + ?>
style="position:relative; top:px; " + class=" baskTips" src="get_url() ?>">
ACL()->has_right_on_base($record->get_base_id(), 'candwnldhd') || $user->ACL()->has_right_on_base($record->get_base_id(), 'candwnldpreview') || $user->ACL()->has_right_on_base($record->get_base_id(), 'cancmd') || $user->ACL()->has_preview_grant($record)) { -?>
- + ?>
+ + + -get('GV_RootPath') . 'www/skins/client/'; + $css = array(); + $cssPath = $registry->get('GV_RootPath') . 'www/skins/client/'; -if ($hdir = opendir($cssPath)) -{ - while (false !== ($file = readdir($hdir))) - { - - if (substr($file, 0, 1) == "." || mb_strtolower($file) == "cvs") - continue; - if (is_dir($cssPath . $file)) + if ($hdir = opendir($cssPath)) { - $css[$file] = $file; + while (false !== ($file = readdir($hdir))) + { + + if (substr($file, 0, 1) == "." || mb_strtolower($file) == "cvs") + continue; + if (is_dir($cssPath . $file)) + { + $css[$file] = $file; + } + } + closedir($hdir); } - } - closedir($hdir); -} -$cssfile = false; -$baskStatus = '1'; -$mode_pres = ''; + $cssfile = false; + $baskStatus = '1'; + $mode_pres = ''; -$cssfile = $user->getPrefs('client_css'); -$baskStatus = $user->getPrefs('client_basket_status'); -$mode_pres = $user->getPrefs('client_view'); -$start_page = $user->getPrefs('start_page'); -$start_page_query = $user->getPrefs('start_page_query'); + $cssfile = $user->getPrefs('client_css'); + $baskStatus = $user->getPrefs('client_basket_status'); + $mode_pres = $user->getPrefs('client_view'); + $start_page = $user->getPrefs('start_page'); + $start_page_query = $user->getPrefs('start_page_query'); -if (!$cssfile && isset($css['000000'])) - $cssfile = '000000'; + if (!$cssfile && isset($css['000000'])) + $cssfile = '000000'; -$cssfile = 'skins/client/000000/clientcolor.css'; -?> + $cssfile = 'skins/client/000000/clientcolor.css'; + ?> - - - + + + +
-display('common/menubar.twig', array('module' => 'client', 'events' => $events_mngr)); -?> + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); + echo $twig->render('common/menubar.twig', array('module' => 'client', 'events' => $events_mngr)); + ?>
-get('GV_client_coll_ckbox') === 'popup') - { - // liste des collections : popup -?> -
- + get('GV_client_coll_ckbox') === 'popup') + { + // liste des collections : popup + ?> +
+ -get_databoxes()) > 0); - $options = ''; + get_databoxes()) > 0); + $options = ''; @@ -229,67 +239,67 @@ if ($cssfile) } foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) { - $allbcol[] = $coll->get_base_id(); - $n_allbcol++; + $allbcol[] = $coll->get_base_id(); + $n_allbcol++; - echo ''; + echo ''; - $options .= ''; + $options .= ''; - $allbases[] = $coll->get_base_id(); + $allbases[] = $coll->get_base_id(); + } + if ($n_allbcol > 1) + { + $options .= ''; + } + } + if ($showbases) + { + $options .= "\n"; + } } - if ($n_allbcol > 1) - { - $options .= ''; - } - } - if ($showbases) - { - $options .= "\n"; - } + echo ''; + ?> +
+ ' . $options . ''; -?> -
- + ?>
-get('GV_defaultQuery_type') == 0 ? $sel1 = " checked='checked'" : $sel2 = " checked='checked'") -?> + get('GV_defaultQuery_type') == 0 ? $sel1 = " checked='checked'" : $sel2 = " checked='checked'") + ?> id="search_type_docs" name="search_type" /> id="search_type_group" name="search_type" /> @@ -306,40 +316,40 @@ if ($cssfile)
-get('GV_client_coll_ckbox') == 'checkbox') - { -?> - - - -get('GV_thesaurus')) - { -?> - actives" onclick="chgOng(4);"> - - - - - + get('GV_client_coll_ckbox') == 'checkbox') + { + ?> + + -
+ get('GV_thesaurus')) + { + ?> + actives" onclick="chgOng(4);"> + + + + + +
-
-get('GV_client_coll_ckbox') == 'checkbox') - { -?> -
-
-
- - -
+
+
+ get('GV_client_coll_ckbox') == 'checkbox') + { + ?> +
+
+
+ + +
@@ -417,159 +427,154 @@ if ($cssfile) '' . '
'; } - elseif ($field['type'] != 'date') - { - $fieldsFilters .= ''; + elseif ($field['type'] != 'date') + { + $fieldsFilters .= ''; + } + } + if ($dateFilters != '' || $sbFilters != '' || $fieldsFilters != '') + { + echo '
' . _('client::recherche: filter sur') . '
' . + '
 
'; + } + } } - } - if ($dateFilters != '' || $sbFilters != '' || $fieldsFilters != '') - { - echo '
' . _('client::recherche: filter sur') . '
' . - '
 
'; - } - } - } -?> -
+ ?> +
-
ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) { $s = "checked"; echo '
'; } -?>
get('GV_view_bas_and_coll')) echo '
'; - } -?> -
-
-
- -get('GV_thesaurus')) - { -?> - -
-
-
- -
+ } + ?>
- + + -
-
+ if ($registry->get('GV_thesaurus')) + { + ?> + +
+
+
+ +
- - - - -
-
- - -
- -get('GV_client_render_topics') == 'popups') - echo queries::dropdown_topics(); - elseif ($registry->get('GV_client_render_topics') == 'tree') - echo queries::tree_topics(); -?> - -
-
- - -
-
-
-
- -
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
    -
  • -
  • -
  • -
-
-
-
-
-
-
-
-
-
-
-
+ +
+
-
-
-
+ + + +
-
-
- -
- -
+ - - +
+
+ +
+
+ + + +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
    +
  • +
  • +
  • +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
--> - + - + - + -get('GV_bitly_user')) !== '' && trim($registry->get('GV_bitly_key')) !== '') - { +}); + + get('GV_bitly_user')) !== '' && trim($registry->get('GV_bitly_key')) !== '') + { $request = new http_request(); -?> + ?> - - get('GV_googleAnalytics')) != '') - { + + get('GV_googleAnalytics')) != '') + { + ?> + + + - - - diff --git a/www/client/jquery.p4client.1.0.js b/www/client/jquery.p4client.1.0.js index 09a5e359fc..80cf90b93d 100644 --- a/www/client/jquery.p4client.1.0.js +++ b/www/client/jquery.p4client.1.0.js @@ -1,1034 +1,1004 @@ -/************* - * GLOBALES - **************/ - -var p4 = { - tot:0, - preview :{open:false,current:false}, - currentViewMode:'classic', - nbNoview:0 - }; - -var baskAjax,baskAjaxrunning; -baskAjaxrunning = false; -var answAjax,answAjaxrunning; -answAjaxrunning = false; - -var wCompare = null; -var language = {}; -var bodySize = {x:0,y:0}; - -/************* - * INITIALISATION - **************/ - - -function acceptCgus(name,value) -{ - setPref(name,value); -} - -function cancelCgus(id) -{ - - $.ajax({ - type: "POST", - url: "/prod/prodFeedBack.php", - data: { - sbas_id:id, - action:'DENY_CGU' - }, - success: function(data){ - if(data == '1') - { - alert(language.cgusRelog); - self.location.replace(self.location.href); - } - } - }); - -} - -function activateCgus() -{ - - $('.cgu-dialog:first').dialog({ - autoOpen : true, - closeOnEscape:false, - draggable:false, - modal:true, - resizable:false, - width:800, - height:600, - open:function() { - $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove(); - var currentdialog = $(this); - $('.cgus-accept',$(this)).bind('click',function(){ - acceptCgus($('.cgus-accept',currentdialog).attr('id'),$('.cgus-accept',currentdialog).attr('date')); - $('.cgu-dialog').dialog('close'); - }); - $('.cgus-cancel',$(this)).bind('click',function(){ - if(confirm(language.warningDenyCgus)) - { - cancelCgus($('.cgus-cancel',currentdialog).attr('id').split('_').pop()); - } - }); - }, - close:function(){ - activateCgus(); - } - }); -} - -$(document).ready(function(){ - activateCgus(); -}); - -$(document).ready(function(){ - $.ajaxSetup({ - - error: function(){ - showModal('error',{title:'Server error'}); - }, - timeout: function(){ - showModal('timeout',{title:'Server not responding'}); - } - }); - - getLanguage(); - $('.datepicker').datepicker({ - firstDay: 1, - changeYear: true, changeMonth:true, - showOn: 'button', buttonImage:'/skins/icons/cal.png', buttonImageOnly: true - }); - - checkFilters(); - window.setTimeout("checkBaskets();", 5000); - - $('.actives').hover(function(){ - $(this).addClass("hover"); - },function(){ - $(this).removeClass("hover"); - }); - - -// if (!$.browser.msie || ($.browser.msie && $.browser.version != '6.0')) { -// $('#bandeau .publilist').hover(function(){ -// $(this).addClass("hover"); -// $(this).children('.hoverlist').show(); -// },function(){ -// $(this).removeClass("hover"); -// $(this).children('.hoverlist').hide(); -// }) -// }else -// { -// $('#bandeau .publilist').hover(function(){ -// $(this).addClass("hover"); -// },function(){ -// $(this).removeClass("hover"); -// }) -// -// } - - sessionactive(); - resize(); - $(window).resize(function(){ - resize(); - resizeSearch(); - }); - initAnswerForm(); - initBasketForm(); - $('#PREVIEWHD').bind('click',function(){ - $(this).hide(); - $(this).empty(); - }); - - $('#PREVIEWHD').trigger('click'); - getBaskets(); - afterSearch(); - $(this).bind('keydown',function(event) - { - if(p4.preview.open) - { - switch(event.keyCode) - { - case 39: - getNext(); - break; - case 37: - getPrevious(); - break; - case 27: - if ($('#MODALDL').is(':visible')) { - hideDwnl(); - } - else { - closePreview(); - } - break; - case 32: - if(p4.slideShow) - stopSlide(); - else - startSlide(); - break; - } - } - else - { - switch(event.keyCode) - { - case 39: - $('#NEXT_PAGE').trigger('click'); - break; - case 27: - hideDwnl(); - break; - case 37: - $('#PREV_PAGE').trigger('click'); - break; - case 38: - $('#answers').scrollTop($('#answers').scrollTop()-50); - break; - case 40: - $('#answers').scrollTop($('#answers').scrollTop()+50); - break; - } - } - }); - - $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px'); - - } -); - -function resizePreview(){ - $('#PREVIEWCURRENTCONT').width($('#PREVIEWCURRENT').width() - 80 - ($('#PREVMAINREG').length>0?$('#PREVMAINREG').width():0) - 90); - - var h = $('#PREVIEWBOX').height(); - h = h - $('#PREVIEWTITLE').height(); - $.each($('div.preview_col'), function(i, n){ - $(n).height(h); - }); - $('#PREVIEWIMGCONT').height(h - $('#PREVIEWCURRENT').height()); - - $('#PREVIEWIMGDESC').height(h-$('#PREVIEWOTHERS').height()); - $('#PREVIEWIMGDESC .descBoxes').height($('#PREVIEWIMGDESC').height() - 30); - - p4.preview.height = $('#PREVIEWIMGCONT').height(); - p4.preview.width = $('#PREVIEWIMGCONT').width(); - setPreview(); -} - -function controlPubliSize() -{ - $('#publications ul').height('auto'); - if(50+$('#publications ul').height()>bodySize.y) - $('#publications ul').height(bodySize.y-50); -} - -function pquit(){ - if (parent.opener) - self.close(); - else - { - document.forms['logout'].submit(); - } - -} - -function resize(){ - - var h = bodySize.y = $(window).height() - $('#mainMenu').outerHeight(); - var w = bodySize.x = $(window).width(); - - - controlPubliSize(); - var rightw = w - 265; - rightw = ((rightw) > 0) ? rightw : 0; - - $('#container').height($(window).height()); - $('#container').width($(window).width()); - $('#right').width(rightw); - - $('#answers').height(h - $('#nb_answersEXT').outerHeight() - $('#navigation').outerHeight() - 20); - $('#answers').width(rightw); - - resizeSearch(); - - if (p4.preview.open) { - - resizePreview(); - } - if ($.browser.msie && $.browser.version == '6.0') { - $('#PREVIEWBOX').height(h * 0.94); - $('#OVERLAY,#OVERLAY2').width(w); - $('#OVERLAY,#OVERLAY2').height(h); - $('#left').height(h); - $('#right').height(h); - } - bodyW = rightw; - - if($('#MODALDL').is(':visible')) - { - $('#MODALDL').css({ - top:((h-$('#MODALDL').height())/2), - left:((w-$('#MODALDL').width())/2) - }); - } - reModCol(); -} - -function getHome(cas){ - switch (cas) { - case 'QUERY': - newSearch(); - break; - case 'PUBLI': - case 'HELP': - $.ajax({ - type: "POST", - url: "/client/clientFeedBack.php", - dataType: 'html', - data: { - action: "HOME", - type: cas - }, - beforeSend: function(){ -// if (answAjaxrunning) -// answAjax.abort(); - clearAnswers(); - answAjaxrunning = true; - $('#answers').addClass('loading'); - - }, - error: function(){ - answAjaxrunning = false; - $('#answers').removeClass('loading'); - }, - timeout: function(){ - answAjaxrunning = false; - $('#answers').removeClass('loading'); - }, - success: function(data){ - $('#answers').append(data); - afterSearch(); - - if(cas == 'PUBLI') - { - $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px'); - } - - return; - } - - }); - break; - - - default: - break; - } -} - - -function changeModCol(){ - reModCol(); - doSearch(); -} - -function getLanguage(){ - $.ajax({ - type: "POST", - url: "./clientFeedBack.php", - dataType: 'json', - data: { - action: "LANGUAGE" - }, - success: function(data){ - language = data; - return; - } - }); -} -function initBasketForm(){ - var options = { - target: '#baskets', - beforeSend: function(){ - if (baskAjaxrunning) - baskAjax.abort(); - baskAjaxrunning = true; - $('.baskIndicator').addClass('baskLoading'); - }, - error: function(){ - baskAjaxrunning = false; - $('#baskets').removeClass('loading'); - $('.baskIndicator').removeClass('baskLoading'); - }, - timeout: function(){ - baskAjaxrunning = false; - $('#baskets').removeClass('loading'); - $('.baskIndicator').removeClass('baskLoading'); - }, - success: function(){ - baskAjaxrunning = false; - if(p4.preview.open && $.browser.msie && $.browser.version == '6.0') - { - $('select').css({ - visibility: 'hidden' - }); - } - setBaskStatus(); - $('#baskets').removeClass('loading'); - $('.baskIndicator').removeClass('baskLoading'); - $('#blocBask img.baskTips').tooltip(); - - $("#flechenochu").bind('click', function(){ - baskDisplay = false; - saveBaskStatus(false); - $("#blocBask").slideToggle("slow"); - $("#blocNoBask").slideToggle("slow").queue(function(){ - $('#baskets').height($('#blocNoBask').height() + 6); - resizeSearch(); - $(this).dequeue(); - }); - }); - $("#flechechu").bind('click', function(){ - baskDisplay = true; - saveBaskStatus(true); - $("#blocNoBask").slideToggle("slow"); - $("#blocBask").slideToggle("slow").queue(function(){ - $('#baskets').height($('#blocBask').height() + 6); - resizeSearch(); - $(this).dequeue(); - }); - }); - $('#formChuBaskId')[0].value = $('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; - $('#formChubas')[0].value = $('#formChuact')[0].value = $('#formChup0')[0].value = ''; - return; - } - }; - baskAjax = $('#formChu').ajaxForm(options); -} -function setBaskStatus(){ - if (baskDisplay) { - $("#blocNoBask").hide(); - $("#blocBask").show(); - $('#baskets').height($('#blocBask').height() + 6); - } - else { - $("#blocNoBask").show(); - $('#baskets').height($('#blocNoBask').height() + 6); - $("#blocBask").hide(); - } - resizeSearch(); -} - -function saveBaskStatus(value) { - $.post("clientFeedBack.php", { - action: "BASK_STATUS", - mode: (value?'1':'0') - }, function(data){ - return; - }); -} - - -function checkBaskets(){ - $.post("clientFeedBack.php", { - action: 'BASKUPDATE' - }, function(data){ - if(parseInt(data)>p4.nbNoview) - getBaskets(); - window.setTimeout("checkBaskets();", 52000); - return; - }); -} - -function initAnswerForm(){ - var options = { - target: '#answers', - beforeSend: function(formData){ - clearAnswers(); - if (answAjaxrunning) - return; - answAjaxrunning = true; - $('#tooltip').css({ - 'display': 'none' - }); - $('#answers').addClass('loading'); - }, - error: function(){ - answAjaxrunning = false; - $('#answers').removeClass('loading'); - }, - timeout: function(){ - answAjaxrunning = false; - $('#answers').removeClass('loading'); - }, - success: function(){ - answAjaxrunning = false; - afterSearch(); - return; - } - }; - $('#searchForm').ajaxForm(options); -} -/************* - * SEARCH - **************/ - -function afterSearch() -{ - - $('#answers').removeClass('loading'); - $("#answers").scrollTop(0); - $('div.infoTips, div.previewTips,img.captionTips',$('#answers')).tooltip(); - $('#nb_answers a.infoTips').tooltip(); -} - -function chkSbas(val,el){ - var bool = false; - if($(el)[0].checked) - bool = true; - $('.basItem' + val).each(function(){ - $(this)[0].checked = bool; - }); -} - -function chgOngSearch(tab){ - tTabs = new Array("ongSearch", "ongAdvSearch", "ongTopic"); - if($('#'+tab).length == 0) - return; - for (i = 0; i <= tTabs.length; i++) { - if ((o = $('#' + tTabs[i]))) - var rmC = (tTabs[i] == tab) ? "inactif" : "actif"; - var addC = (tTabs[i] == tab) ? "actif" : "inactif"; - o.addClass(addC).removeClass(rmC); - - - if ((o = document.getElementById("id" + tTabs[i]))) { - o.style.display = (tTabs[i] == tab) ? "" : "none"; - } - } - $('#idongAdvSearch :text').each(function(){ - this.value = ""; - }); - if (tab == "ongAdvSearch") { - document.getElementById("idongSearch").style.display = ""; - } - - resizeSearch(); -} - -function doSpecialSearch(qry, allbase){ -// if($('#ongSearch').length>0) -// chgOngSearch('ongSearch'); -// else -// if($('#ongAdvSearch').length>0) -// chgOngSearch('ongAdvSearch'); - if (allbase) { - $('input.basItem').each(function(){ - this.checked = true; - }); - var first = true; - $('#basSelector option').each(function(){ - this.selected = first; - first = false; - }); - } - $("form[name='search'] input[name='qry']")[0].value = decodeURIComponent(qry).replace(/\+/g, " "); - doSearch(); -} - -function clearAnswers(){ - $('#formAnswerPage')[0].value = ''; - $("#nb_answers").empty(); - $("#navigation").empty(); - $("#answers").empty(); -} - -function newSearch() -{ - $('#searchForm').submit(); -} - -function doSearch() -{ - $('#searchForm').submit(); -} - -function chgOng(num){ - for (i = 1; i <= 5; i++) { - if ((o = document.getElementById("idOnglet" + i))) - o.className = (i == num) ? "actif" : "inactif"; - if ((o = document.getElementById("onglet" + i))) - o.style.display = (i == num) ? "block" : "none"; - } - return; -} - -function checkBases(etat){ - $('.basItem, .basChecker').each(function(){ - this.checked = etat; - }); -} - -function resizeSearch(){ - - var searchh = (bodySize.y-$('#baskets').height()); - searchh = ((searchh)>0)?searchh:0; - var menu = $('#bigTabsBckg').height(); - $('#search').height(searchh); - $('#idongTopic').height($("#search").height()-8-menu); - $('#searchMiddle').height($("#search").height()-8-menu-$('#mainSearch').height()); -} -/************* - * Topics - **************/ - -function doThesSearch(type,sbid,term,field) -{ - - if(type=='T') - v = '*:"' + term.replace("(", "[").replace(")", "]") + '"'; - else - v = '"' + term + '" IN ' + field; - doSpecialSearch(v, true); -} - -function chgProp(path, v, k){ - var q2; - if (!k) - k = "*"; - if (k != null) - v = v + " [" + k + "]"; - document.getElementById("thprop_a_" + path).innerHTML = '"' + v + '"'; - - q = document.getElementById("thprop_q").innerText; - if (!q) - if (document.getElementById("thprop_q") && document.getElementById("thprop_q").textContent) - q = document.getElementById("thprop_q").textContent; - - q2 = ""; - - for (i = 0; i < q.length; i++) - q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i); // correction pour safari ! - doSpecialSearch(q2, true); - return (false); -} - -function clktri(id){ - var o = $('#TOPIC_UL' + id); - if ($('#TOPIC_UL' + id).hasClass('closed')) - $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened'); - else - $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed'); -} - - - -/************* - * CHUTIER - **************/ - -function evt_add_in_chutier(base_id, record_id){ - $('#formChubas')[0].value = base_id; - $('#formChuact')[0].value = "ADDIMG"; - $('#formChup0')[0].value = record_id; - $('#formChu').submit(); -} - -function chg_chu() -{ - var id = document.getElementById("chutier_name").value; - document.forms["formChu"].courChuId.value = id; - $("#formChu").submit(); -} - -function getBaskets() -{ - $('#formChu').submit(); -} - - -function newBasket(){ - var buttons = {}; - - buttons["OK"] = function(e){saveNewBask();$(this).dialog('close');}; - buttons[language.annuler] = function(e){$(this).dialog('close');}; - - $('#DIALOG').empty().append("").attr('title',language.createWinInvite).dialog({ - autoOpen:false, - closeOnEscape :true, - resizable:false, - draggable:false, - modal:true - }).dialog('open').dialog('option','buttons',buttons); - -} - -function saveNewBask(){ - var tmp = $('#newBaskName')[0].value; - if (tmp == null) - return; - mytest = false; - for (k = 0; (k < tmp.length && !mytest); k++) { - if (tmp.charAt(k) != " ") - mytest = true; - } - if (!mytest) { - alert(language.chuNameEmpty); - return; - } - document.forms["formChu"].act.value = "NEWCHU"; - document.forms["formChu"].p0.value = tmp; - $("#formChu").submit(); -} - -function evt_chutier(arg_commande){ - switch (arg_commande) { - case "DELSSEL": - if (confirm(language.confirmDelBasket)) { - if (document.forms["formChu"]) { - document.forms["formChu"].act.value = "DELCHU"; - document.forms["formChu"].p0.value = document.forms["formChu"].courChuId.value; - $("#formChu").submit(); - } - } - break; - } -} - -function reload_chu(id){ - document.forms["formChu"].courChuId.value = id; - $("#formChu").submit(); -} - -function evt_del_in_chutier(selid){ - document.forms["formChu"].act.value = "DELIMG"; - document.forms["formChu"].p0.value = selid; - $("#formChu").submit(); -} - -function openCompare(sselid){ - $('#ssel2val')[0].value = sselid; - $('#validatorEject').submit(); -} - -function setVisible(el){ - el.style.visibility = 'visible'; -} - -function beforeAnswer(){ - if ($('#basSelector')) { - var serialBas = $('#basSelector')[0].options[$('#basSelector')[0].selectedIndex].value; - serialBas = serialBas.split(';'); - $.each($('.basItem'), function(i, el){ - el.checked = false; - }); - $.each(serialBas, function(i, n){ - $('#basChk' + n)[0].checked = true; - }); - } - return true; -} - -function gotopage(pag){ - if (document.forms["search"]) { - document.forms["search"].nba.value = p4.tot; - document.forms["search"].pag.value = pag; - $("#answers").innerHTML = ""; - $('#searchForm').submit(); - } - return (false); -} - - -function evt_print(basrec){ - var url = "/include/printpage.php?callclient=1"; - - - if(typeof(basrec) == 'undefined') - url += "&SSTTID="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; - else - url += "&lst=" + basrec; - - var top; - var left; - - $('#MODALDL').attr('src',url); - - - var t = (bodySize.y - 300) / 2; - var l = (bodySize.x - 490) / 2; - - $('#MODALDL').css({ - 'display': 'block', - 'opacity': 0, - 'width': '490px', - 'position': 'absolute', - 'top': t, - 'left': l, - 'height': '300px' - }).fadeTo(500, 1); - - showOverlay(2); -} - - -function evt_dwnl(lst) -{ - var dialog_box = $('#dialog_dwnl'); - - dialog_box = $('#dialog_dwnl'); - - dialog_box.empty().addClass('loading').dialog({ - width:800, - height:600, - modal:true, - closeOnEscape : true, - resizable : false, - zIndex:10000, - overlay: { - backgroundColor: '#000', - opacity: 0.7 - }, - beforeclose:function(){ - tinyMCE.execCommand('mceRemoveControl',true,'sendmail_message'); - tinyMCE.execCommand('mceRemoveControl',true,'order_usage'); - } - }).dialog('open'); - - if(typeof(lst) == 'undefined') - var datas = "&SSTTID="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; - else - var datas = "&lst=" + lst; - - $.post("/include/multiexports.php", datas, function(data) { - - dialog_box.removeClass('loading').empty().append(data); - $('.tabs', dialog_box).tabs(); - tinyMCE.execCommand('mceAddControl',true,'sendmail_message'); - tinyMCE.execCommand('mceAddControl',true,'order_usage'); - - $('.close_button', dialog_box).bind('click',function(){ - dialog_box.dialog('close').dialog('destroy'); - }); - return false; - }); - -} - - -//function evt_dwnl(lst){ -// var top; -// var left; -// -// var url = "" + -// "/include/multiexports.php" + -// "?" + -// "&callclient=1"; -// -// -// $('#MODALDL').attr('src',url); -// -// -// var t = (bodySize.y - 400) / 2; -// var l = (bodySize.x - 550) / 2; -// -// $('#MODALDL').css({ -// 'display': 'block', -// 'opacity': 0, -// 'width': '550px', -// 'position': 'absolute', -// 'top': t, -// 'left': l, -// 'height': '400px' -// }).fadeTo(500, 1); -// -// showOverlay(2); -//} - -function profil(value) -{ - var top; - var left; - - if(value==undefined) - value = "0"; - - var url = "" + - "/include/profile.php" + - "?callclient=1&onglet="+value; - - $('#MODALDL').attr('src',url); - - - var t = (bodySize.y - 550) / 2; - var l = (bodySize.x - 490) / 2; - - $('#MODALDL').css({ - 'display': 'block', - 'opacity': 0, - 'width': '490px', - 'position': 'absolute', - 'top': t, - 'left': l, - 'height': '550px' - }).fadeTo(500, 1); - - showOverlay(2); -} - -function setCss(color) -{ - $('#skinCss').attr('href','/include/minify/f=skins/common/main.css,skins/client/'+color+'/clientcolor.css,'+ - 'skins/client/'+color+'/ui.core.css,'+ - 'skins/client/'+color+'/ui.datepicker.css,'+ - 'skins/client/'+color+'/ui.theme.css'); - $.post("clientFeedBack.php", { - action: "CSS", - color: color, - t: Math.random() - }, function(data){ - return; - }); - if ($.browser.msie && $.browser.version == '6.0') - $('select').hide().show(); -} - -function lessPubli(sselid) -{ - $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle(); - $('#PUBLICONT'+sselid).css({height: '135px'}); - $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle(); -} - -function morePubli(sselid) -{ - $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle(); - $('#PUBLICONT'+sselid).css({height: 'auto'}); - $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle(); -} - -function toggleFilter(filter,ele) -{ - var el = $('#'+filter); - if(el.is(':hidden')) - $(ele).parent().addClass('open'); - else - $(ele).parent().removeClass('open'); - $('#'+filter).slideToggle('fast'); -} - -function checkFilters() -{ - var danger = false; - var d = {}; - $('.filter_danger').each(function(){ - d[$(this).attr('id')] = false; - - }); - - $('.basContTitle .base_filter :text').each(function(){ - if($(this)[0].value != "") - { - danger = true; - - d['filter_danger'+parseInt($(this).attr('db'))] = true; - } - }); - $('.basContTitle .base_filter :checkbox').each(function(){ - if($(this)[0].checked) - { - danger = true; - - d['filter_danger'+parseInt($(this).attr('db'))] = true; - } - }); - $('.basContTitle .base_filter select').each(function(){ - if($(this)[0].selectedIndex != 0) - { - danger = true; - - d['filter_danger'+parseInt($(this).attr('db'))] = true; - } - }); - - $.each(d,function(i,bool){ - if(bool) - $('#'+i).show(); - else - $('#'+i).hide(); - }); - if(danger) - $('#filter_danger').show(); - else - $('#filter_danger').hide(); -} - -function removeFilters(bas) -{ - if (typeof(bas) == 'undefined') { - $('.basContTitle .base_filter :checkbox').each(function(){ - $(this)[0].checked = false; - }); - $('.basContTitle .base_filter :text').each(function(){ - $(this)[0].value = ""; - }); - $('.basContTitle .base_filter select').each(function(){ - $(this)[0].selectedIndex = 0; - }); - } - else { - $('#Filters' + bas + ' :checkbox').each(function(){ - $(this)[0].checked = false; - }); - $('#Filters' + bas + ' :text').each(function(){ - $(this)[0].value = ""; - }); - $('#Filters' + bas + ' select').each(function(){ - $(this)[0].selectedIndex = 0; - }); - } - checkFilters(); -} - -function execLastAct(lastAct) -{ - if(lastAct.act) - { - switch (lastAct.act) - { - case 'dwnl': - if(lastAct.SSTTID) - { - if (baskAjaxrunning) { - setTimeout("execLastAct(lastAct);", 500); - } - else { - if($('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value != lastAct.SSTTID) - { - $('#chutier_name option').each(function(i, n){ - if (lastAct.SSTTID == this.value) { - $('#chutier_name')[0].selectedIndex = i; - $('#chutier_name').trigger('change'); - setTimeout("execLastAct(lastAct);", 500); - } - }); - }else - evt_dwnl(); - } - } - else - if(lastAct.lst) - { - evt_dwnl(lastAct.lst); - } - break; - } - } - return; -} - +/************* + * GLOBALES + **************/ + +var p4 = { + tot:0, + preview :{open:false,current:false}, + currentViewMode:'classic', + nbNoview:0 + }; + +var baskAjax,baskAjaxrunning; +baskAjaxrunning = false; +var answAjax,answAjaxrunning; +answAjaxrunning = false; + +var wCompare = null; +var language = {}; +var bodySize = {x:0,y:0}; + +/************* + * INITIALISATION + **************/ + + +function acceptCgus(name,value) +{ + setPref(name,value); +} + +function cancelCgus(id) +{ + + $.ajax({ + type: "POST", + url: "/prod/prodFeedBack.php", + data: { + sbas_id:id, + action:'DENY_CGU' + }, + success: function(data){ + if(data == '1') + { + alert(language.cgusRelog); + self.location.replace(self.location.href); + } + } + }); + +} + +function activateCgus() +{ + + $('.cgu-dialog:first').dialog({ + autoOpen : true, + closeOnEscape:false, + draggable:false, + modal:true, + resizable:false, + width:800, + height:600, + open:function() { + $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove(); + var currentdialog = $(this); + $('.cgus-accept',$(this)).bind('click',function(){ + acceptCgus($('.cgus-accept',currentdialog).attr('id'),$('.cgus-accept',currentdialog).attr('date')); + $('.cgu-dialog').dialog('close'); + }); + $('.cgus-cancel',$(this)).bind('click',function(){ + if(confirm(language.warningDenyCgus)) + { + cancelCgus($('.cgus-cancel',currentdialog).attr('id').split('_').pop()); + } + }); + }, + close:function(){ + activateCgus(); + } + }); +} + +$(document).ready(function(){ + activateCgus(); +}); + +$(document).ready(function(){ + $.ajaxSetup({ + + error: function(){ + showModal('error',{title:'Server error'}); + }, + timeout: function(){ + showModal('timeout',{title:'Server not responding'}); + } + }); + + getLanguage(); + $('.datepicker').datepicker({ + firstDay: 1, + changeYear: true, changeMonth:true, + showOn: 'button', buttonImage:'/skins/icons/cal.png', buttonImageOnly: true + }); + + checkFilters(); + window.setTimeout("checkBaskets();", 5000); + + $('.actives').hover(function(){ + $(this).addClass("hover"); + },function(){ + $(this).removeClass("hover"); + }); + + +// if (!$.browser.msie || ($.browser.msie && $.browser.version != '6.0')) { +// $('#bandeau .publilist').hover(function(){ +// $(this).addClass("hover"); +// $(this).children('.hoverlist').show(); +// },function(){ +// $(this).removeClass("hover"); +// $(this).children('.hoverlist').hide(); +// }) +// }else +// { +// $('#bandeau .publilist').hover(function(){ +// $(this).addClass("hover"); +// },function(){ +// $(this).removeClass("hover"); +// }) +// +// } + + sessionactive(); + resize(); + $(window).resize(function(){ + resize(); + resizeSearch(); + }); + initAnswerForm(); + initBasketForm(); + $('#PREVIEWHD').bind('click',function(){ + $(this).hide(); + $(this).empty(); + }); + + $('#PREVIEWHD').trigger('click'); + getBaskets(); + afterSearch(); + $(this).bind('keydown',function(event) + { + if(p4.preview.open) + { + switch(event.keyCode) + { + case 39: + getNext(); + break; + case 37: + getPrevious(); + break; + case 27: + if ($('#MODALDL').is(':visible')) { + hideDwnl(); + } + else { + closePreview(); + } + break; + case 32: + if(p4.slideShow) + stopSlide(); + else + startSlide(); + break; + } + } + else + { + switch(event.keyCode) + { + case 39: + $('#NEXT_PAGE').trigger('click'); + break; + case 27: + hideDwnl(); + break; + case 37: + $('#PREV_PAGE').trigger('click'); + break; + case 38: + $('#answers').scrollTop($('#answers').scrollTop()-50); + break; + case 40: + $('#answers').scrollTop($('#answers').scrollTop()+50); + break; + } + } + }); + + $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px'); + + } +); + +function resizePreview(){ + $('#PREVIEWCURRENTCONT').width($('#PREVIEWCURRENT').width() - 80 - ($('#PREVMAINREG').length>0?$('#PREVMAINREG').width():0) - 90); + + var h = $('#PREVIEWBOX').height(); + h = h - $('#PREVIEWTITLE').height(); + $.each($('div.preview_col'), function(i, n){ + $(n).height(h); + }); + $('#PREVIEWIMGCONT').height(h - $('#PREVIEWCURRENT').height()); + + $('#PREVIEWIMGDESC').height(h-$('#PREVIEWOTHERS').height()); + $('#PREVIEWIMGDESC .descBoxes').height($('#PREVIEWIMGDESC').height() - 30); + + p4.preview.height = $('#PREVIEWIMGCONT').height(); + p4.preview.width = $('#PREVIEWIMGCONT').width(); + setPreview(); +} + +function controlPubliSize() +{ + $('#publications ul').height('auto'); + if(50+$('#publications ul').height()>bodySize.y) + $('#publications ul').height(bodySize.y-50); +} + +function pquit(){ + if (parent.opener) + self.close(); + else + { + document.forms['logout'].submit(); + } + +} + +function resize(){ + + var h = bodySize.y = $(window).height() - $('#mainMenu').outerHeight(); + var w = bodySize.x = $(window).width(); + + + controlPubliSize(); + var rightw = w - 265; + rightw = ((rightw) > 0) ? rightw : 0; + + $('#container').height($(window).height()); + $('#container').width($(window).width()); + $('#right').width(rightw); + + $('#answers').height(h - $('#nb_answersEXT').outerHeight() - $('#navigation').outerHeight() - 20); + $('#answers').width(rightw); + + resizeSearch(); + + if (p4.preview.open) { + + resizePreview(); + } + if ($.browser.msie && $.browser.version == '6.0') { + $('#PREVIEWBOX').height(h * 0.94); + $('#OVERLAY,#OVERLAY2').width(w); + $('#OVERLAY,#OVERLAY2').height(h); + $('#left').height(h); + $('#right').height(h); + } + bodyW = rightw; + + if($('#MODALDL').is(':visible')) + { + $('#MODALDL').css({ + top:((h-$('#MODALDL').height())/2), + left:((w-$('#MODALDL').width())/2) + }); + } + reModCol(); +} + +function getHome(cas){ + switch (cas) { + case 'QUERY': + newSearch(); + break; + case 'PUBLI': + case 'HELP': + $.ajax({ + type: "POST", + url: "/client/clientFeedBack.php", + dataType: 'html', + data: { + action: "HOME", + type: cas + }, + beforeSend: function(){ +// if (answAjaxrunning) +// answAjax.abort(); + clearAnswers(); + answAjaxrunning = true; + $('#answers').addClass('loading'); + + }, + error: function(){ + answAjaxrunning = false; + $('#answers').removeClass('loading'); + }, + timeout: function(){ + answAjaxrunning = false; + $('#answers').removeClass('loading'); + }, + success: function(data){ + $('#answers').append(data); + afterSearch(); + + if(cas == 'PUBLI') + { + $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px'); + } + + return; + } + + }); + break; + + + default: + break; + } +} + + +function changeModCol(){ + reModCol(); + doSearch(); +} + +function getLanguage(){ + $.ajax({ + type: "POST", + url: "./clientFeedBack.php", + dataType: 'json', + data: { + action: "LANGUAGE" + }, + success: function(data){ + language = data; + return; + } + }); +} +function initBasketForm(){ + var options = { + target: '#baskets', + beforeSend: function(){ + if (baskAjaxrunning) + baskAjax.abort(); + baskAjaxrunning = true; + $('.baskIndicator').addClass('baskLoading'); + }, + error: function(){ + baskAjaxrunning = false; + $('#baskets').removeClass('loading'); + $('.baskIndicator').removeClass('baskLoading'); + }, + timeout: function(){ + baskAjaxrunning = false; + $('#baskets').removeClass('loading'); + $('.baskIndicator').removeClass('baskLoading'); + }, + success: function(){ + baskAjaxrunning = false; + if(p4.preview.open && $.browser.msie && $.browser.version == '6.0') + { + $('select').css({ + visibility: 'hidden' + }); + } + setBaskStatus(); + $('#baskets').removeClass('loading'); + $('.baskIndicator').removeClass('baskLoading'); + $('#blocBask img.baskTips').tooltip(); + + $("#flechenochu").bind('click', function(){ + baskDisplay = false; + saveBaskStatus(false); + $("#blocBask").slideToggle("slow"); + $("#blocNoBask").slideToggle("slow").queue(function(){ + $('#baskets').height($('#blocNoBask').height() + 6); + resizeSearch(); + $(this).dequeue(); + }); + }); + $("#flechechu").bind('click', function(){ + baskDisplay = true; + saveBaskStatus(true); + $("#blocNoBask").slideToggle("slow"); + $("#blocBask").slideToggle("slow").queue(function(){ + $('#baskets').height($('#blocBask').height() + 6); + resizeSearch(); + $(this).dequeue(); + }); + }); + $('#formChuBaskId')[0].value = $('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; + $('#formChubas')[0].value = $('#formChuact')[0].value = $('#formChup0')[0].value = ''; + return; + } + }; + baskAjax = $('#formChu').ajaxForm(options); +} +function setBaskStatus(){ + if (baskDisplay) { + $("#blocNoBask").hide(); + $("#blocBask").show(); + $('#baskets').height($('#blocBask').height() + 6); + } + else { + $("#blocNoBask").show(); + $('#baskets').height($('#blocNoBask').height() + 6); + $("#blocBask").hide(); + } + resizeSearch(); +} + +function saveBaskStatus(value) { + $.post("clientFeedBack.php", { + action: "BASK_STATUS", + mode: (value?'1':'0') + }, function(data){ + return; + }); +} + + +function checkBaskets(){ + $.post("clientFeedBack.php", { + action: 'BASKUPDATE' + }, function(data){ + if(parseInt(data)>p4.nbNoview) + getBaskets(); + window.setTimeout("checkBaskets();", 52000); + return; + }); +} + +function initAnswerForm(){ + var options = { + target: '#answers', + beforeSend: function(formData){ + clearAnswers(); + if (answAjaxrunning) + return; + answAjaxrunning = true; + $('#tooltip').css({ + 'display': 'none' + }); + $('#answers').addClass('loading'); + }, + error: function(){ + answAjaxrunning = false; + $('#answers').removeClass('loading'); + }, + timeout: function(){ + answAjaxrunning = false; + $('#answers').removeClass('loading'); + }, + success: function(){ + answAjaxrunning = false; + afterSearch(); + return; + } + }; + $('#searchForm').ajaxForm(options); +} +/************* + * SEARCH + **************/ + +function afterSearch() +{ + + $('#answers').removeClass('loading'); + $("#answers").scrollTop(0); + $('div.infoTips, div.previewTips,img.captionTips',$('#answers')).tooltip(); + $('#nb_answers a.infoTips').tooltip(); +} + +function chkSbas(val,el){ + var bool = false; + if($(el)[0].checked) + bool = true; + $('.basItem' + val).each(function(){ + $(this)[0].checked = bool; + }); +} + +function chgOngSearch(tab){ + tTabs = new Array("ongSearch", "ongAdvSearch", "ongTopic"); + if($('#'+tab).length == 0) + return; + for (i = 0; i <= tTabs.length; i++) { + if ((o = $('#' + tTabs[i]))) + var rmC = (tTabs[i] == tab) ? "inactif" : "actif"; + var addC = (tTabs[i] == tab) ? "actif" : "inactif"; + o.addClass(addC).removeClass(rmC); + + + if ((o = document.getElementById("id" + tTabs[i]))) { + o.style.display = (tTabs[i] == tab) ? "" : "none"; + } + } + $('#idongAdvSearch :text').each(function(){ + this.value = ""; + }); + if (tab == "ongAdvSearch") { + document.getElementById("idongSearch").style.display = ""; + } + + resizeSearch(); +} + +function doSpecialSearch(qry, allbase){ +// if($('#ongSearch').length>0) +// chgOngSearch('ongSearch'); +// else +// if($('#ongAdvSearch').length>0) +// chgOngSearch('ongAdvSearch'); + if (allbase) { + $('input.basItem').each(function(){ + this.checked = true; + }); + var first = true; + $('#basSelector option').each(function(){ + this.selected = first; + first = false; + }); + } + $("form[name='search'] input[name='qry']")[0].value = decodeURIComponent(qry).replace(/\+/g, " "); + doSearch(); +} + +function clearAnswers(){ + $('#formAnswerPage')[0].value = ''; + $("#nb_answers").empty(); + $("#navigation").empty(); + $("#answers").empty(); +} + +function newSearch() +{ + $('#searchForm').submit(); +} + +function doSearch() +{ + $('#searchForm').submit(); +} + +function chgOng(num){ + for (i = 1; i <= 5; i++) { + if ((o = document.getElementById("idOnglet" + i))) + o.className = (i == num) ? "actif" : "inactif"; + if ((o = document.getElementById("onglet" + i))) + o.style.display = (i == num) ? "block" : "none"; + } + return; +} + +function checkBases(etat){ + $('.basItem, .basChecker').each(function(){ + this.checked = etat; + }); +} + +function resizeSearch(){ + + var searchh = (bodySize.y-$('#baskets').height()); + searchh = ((searchh)>0)?searchh:0; + var menu = $('#bigTabsBckg').height(); + $('#search').height(searchh); + $('#idongTopic').height($("#search").height()-8-menu); + $('#searchMiddle').height($("#search").height()-8-menu-$('#mainSearch').height()); +} +/************* + * Topics + **************/ + +function doThesSearch(type,sbid,term,field) +{ + + if(type=='T') + v = '*:"' + term.replace("(", "[").replace(")", "]") + '"'; + else + v = '"' + term + '" IN ' + field; + doSpecialSearch(v, true); +} + +function chgProp(path, v, k){ + var q2; + if (!k) + k = "*"; + if (k != null) + v = v + " [" + k + "]"; + document.getElementById("thprop_a_" + path).innerHTML = '"' + v + '"'; + + q = document.getElementById("thprop_q").innerText; + if (!q) + if (document.getElementById("thprop_q") && document.getElementById("thprop_q").textContent) + q = document.getElementById("thprop_q").textContent; + + q2 = ""; + + for (i = 0; i < q.length; i++) + q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i); // correction pour safari ! + doSpecialSearch(q2, true); + return (false); +} + +function clktri(id){ + var o = $('#TOPIC_UL' + id); + if ($('#TOPIC_UL' + id).hasClass('closed')) + $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened'); + else + $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed'); +} + + + +/************* + * CHUTIER + **************/ + +function evt_add_in_chutier(sbas_id, record_id){ + $('#formChubas')[0].value = sbas_id; + $('#formChuact')[0].value = "ADDIMG"; + $('#formChup0')[0].value = record_id; + $('#formChu').submit(); +} + +function chg_chu() +{ + var id = document.getElementById("chutier_name").value; + document.forms["formChu"].courChuId.value = id; + $("#formChu").submit(); +} + +function getBaskets() +{ + $('#formChu').submit(); +} + + +function newBasket(){ + var buttons = {}; + + buttons["OK"] = function(e){saveNewBask();$(this).dialog('close');}; + buttons[language.annuler] = function(e){$(this).dialog('close');}; + + $('#DIALOG').empty().append("").attr('title',language.createWinInvite).dialog({ + autoOpen:false, + closeOnEscape :true, + resizable:false, + draggable:false, + modal:true + }).dialog('open').dialog('option','buttons',buttons); + +} + +function saveNewBask(){ + var tmp = $('#newBaskName')[0].value; + if (tmp == null) + return; + mytest = false; + for (k = 0; (k < tmp.length && !mytest); k++) { + if (tmp.charAt(k) != " ") + mytest = true; + } + if (!mytest) { + alert(language.chuNameEmpty); + return; + } + document.forms["formChu"].act.value = "NEWCHU"; + document.forms["formChu"].p0.value = tmp; + $("#formChu").submit(); +} + +function evt_chutier(arg_commande){ + switch (arg_commande) { + case "DELSSEL": + if (confirm(language.confirmDelBasket)) { + if (document.forms["formChu"]) { + document.forms["formChu"].act.value = "DELCHU"; + document.forms["formChu"].p0.value = document.forms["formChu"].courChuId.value; + $("#formChu").submit(); + } + } + break; + } +} + +function reload_chu(id){ + document.forms["formChu"].courChuId.value = id; + $("#formChu").submit(); +} + +function evt_del_in_chutier(selid){ + document.forms["formChu"].act.value = "DELIMG"; + document.forms["formChu"].p0.value = selid; + $("#formChu").submit(); +} + +function openCompare(sselid){ + $('#ssel2val')[0].value = sselid; + $('#validatorEject').submit(); +} + +function setVisible(el){ + el.style.visibility = 'visible'; +} + +function beforeAnswer(){ + if ($('#basSelector')) { + var serialBas = $('#basSelector')[0].options[$('#basSelector')[0].selectedIndex].value; + serialBas = serialBas.split(';'); + $.each($('.basItem'), function(i, el){ + el.checked = false; + }); + $.each(serialBas, function(i, n){ + $('#basChk' + n)[0].checked = true; + }); + } + return true; +} + +function gotopage(pag){ + if (document.forms["search"]) { + document.forms["search"].nba.value = p4.tot; + document.forms["search"].pag.value = pag; + $("#answers").innerHTML = ""; + $('#searchForm').submit(); + } + return (false); +} + + +function evt_print(basrec){ + var url = "/include/printpage.php?callclient=1"; + + + if(typeof(basrec) == 'undefined') + url += "&SSTTID="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; + else + url += "&lst=" + basrec; + + var top; + var left; + + $('#MODALDL').attr('src',url); + + + var t = (bodySize.y - 300) / 2; + var l = (bodySize.x - 490) / 2; + + $('#MODALDL').css({ + 'display': 'block', + 'opacity': 0, + 'width': '490px', + 'position': 'absolute', + 'top': t, + 'left': l, + 'height': '300px' + }).fadeTo(500, 1); + + showOverlay(2); +} + + +function evt_dwnl(lst) +{ + var dialog_box = $('#dialog_dwnl'); + + dialog_box = $('#dialog_dwnl'); + + dialog_box.empty().addClass('loading').dialog({ + width:800, + height:600, + modal:true, + closeOnEscape : true, + resizable : false, + zIndex:10000, + overlay: { + backgroundColor: '#000', + opacity: 0.7 + }, + beforeclose:function(){ + tinyMCE.execCommand('mceRemoveControl',true,'sendmail_message'); + tinyMCE.execCommand('mceRemoveControl',true,'order_usage'); + } + }).dialog('open'); + + if(typeof(lst) == 'undefined') + var datas = "&SSTTID="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value; + else + var datas = "&lst=" + lst; + + $.post("/include/multiexports.php", datas, function(data) { + + dialog_box.removeClass('loading').empty().append(data); + $('.tabs', dialog_box).tabs(); + tinyMCE.execCommand('mceAddControl',true,'sendmail_message'); + tinyMCE.execCommand('mceAddControl',true,'order_usage'); + + $('.close_button', dialog_box).bind('click',function(){ + dialog_box.dialog('close').dialog('destroy'); + }); + return false; + }); + +} + +function profil(value) +{ + var top; + var left; + + if(value==undefined) + value = "0"; + + var url = "" + + "/include/profile.php" + + "?callclient=1&onglet="+value; + + $('#MODALDL').attr('src',url); + + + var t = (bodySize.y - 550) / 2; + var l = (bodySize.x - 490) / 2; + + $('#MODALDL').css({ + 'display': 'block', + 'opacity': 0, + 'width': '490px', + 'position': 'absolute', + 'top': t, + 'left': l, + 'height': '550px' + }).fadeTo(500, 1); + + showOverlay(2); +} + +function setCss(color) +{ + $('#skinCss').attr('href','/include/minify/f=skins/common/main.css,skins/client/'+color+'/clientcolor.css,'+ + 'skins/client/'+color+'/ui.core.css,'+ + 'skins/client/'+color+'/ui.datepicker.css,'+ + 'skins/client/'+color+'/ui.theme.css'); + $.post("clientFeedBack.php", { + action: "CSS", + color: color, + t: Math.random() + }, function(data){ + return; + }); + if ($.browser.msie && $.browser.version == '6.0') + $('select').hide().show(); +} + +function lessPubli(sselid) +{ + $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle(); + $('#PUBLICONT'+sselid).css({height: '135px'}); + $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle(); +} + +function morePubli(sselid) +{ + $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle(); + $('#PUBLICONT'+sselid).css({height: 'auto'}); + $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle(); +} + +function toggleFilter(filter,ele) +{ + var el = $('#'+filter); + if(el.is(':hidden')) + $(ele).parent().addClass('open'); + else + $(ele).parent().removeClass('open'); + $('#'+filter).slideToggle('fast'); +} + +function checkFilters() +{ + var danger = false; + var d = {}; + $('.filter_danger').each(function(){ + d[$(this).attr('id')] = false; + + }); + + $('.basContTitle .base_filter :text').each(function(){ + if($(this)[0].value != "") + { + danger = true; + + d['filter_danger'+parseInt($(this).attr('db'))] = true; + } + }); + $('.basContTitle .base_filter :checkbox').each(function(){ + if($(this)[0].checked) + { + danger = true; + + d['filter_danger'+parseInt($(this).attr('db'))] = true; + } + }); + $('.basContTitle .base_filter select').each(function(){ + if($(this)[0].selectedIndex != 0) + { + danger = true; + + d['filter_danger'+parseInt($(this).attr('db'))] = true; + } + }); + + $.each(d,function(i,bool){ + if(bool) + $('#'+i).show(); + else + $('#'+i).hide(); + }); + if(danger) + $('#filter_danger').show(); + else + $('#filter_danger').hide(); +} + +function removeFilters(bas) +{ + if (typeof(bas) == 'undefined') { + $('.basContTitle .base_filter :checkbox').each(function(){ + $(this)[0].checked = false; + }); + $('.basContTitle .base_filter :text').each(function(){ + $(this)[0].value = ""; + }); + $('.basContTitle .base_filter select').each(function(){ + $(this)[0].selectedIndex = 0; + }); + } + else { + $('#Filters' + bas + ' :checkbox').each(function(){ + $(this)[0].checked = false; + }); + $('#Filters' + bas + ' :text').each(function(){ + $(this)[0].value = ""; + }); + $('#Filters' + bas + ' select').each(function(){ + $(this)[0].selectedIndex = 0; + }); + } + checkFilters(); +} + +function execLastAct(lastAct) +{ + if(lastAct.act) + { + switch (lastAct.act) + { + case 'dwnl': + if(lastAct.SSTTID) + { + if (baskAjaxrunning) { + setTimeout("execLastAct(lastAct);", 500); + } + else { + if($('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value != lastAct.SSTTID) + { + $('#chutier_name option').each(function(i, n){ + if (lastAct.SSTTID == this.value) { + $('#chutier_name')[0].selectedIndex = i; + $('#chutier_name').trigger('change'); + setTimeout("execLastAct(lastAct);", 500); + } + }); + }else + evt_dwnl(); + } + } + else + if(lastAct.lst) + { + evt_dwnl(lastAct.lst); + } + break; + } + } + return; +} + diff --git a/www/include/cguUtils.php b/www/include/cguUtils.php index 1bfadca584..23a7533ce9 100644 --- a/www/include/cguUtils.php +++ b/www/include/cguUtils.php @@ -14,8 +14,10 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); + +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +$appbox = appbox::get_instance($Core); $session = $appbox->get_session(); $registry = $appbox->get_registry(); require_once($registry->get('GV_RootPath') . "lib/classes/deprecated/inscript.api.php"); diff --git a/www/include/delses.php b/www/include/delses.php index bb49af90aa..69be3c8b0c 100644 --- a/www/include/delses.php +++ b/www/include/delses.php @@ -17,8 +17,10 @@ */ ignore_user_abort(true); set_time_limit(0); -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); + +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +$appbox = appbox::get_instance($Core); $session = $appbox->get_session(); $request = http_request::getInstance(); $parm = $request->get_parms("app"); diff --git a/www/include/download.php b/www/include/download.php index 405a7634d4..db7a08ab5e 100644 --- a/www/include/download.php +++ b/www/include/download.php @@ -15,11 +15,14 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +$Request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); + +$appbox = appbox::get_instance($Core); $session = $appbox->get_session(); -$gatekeeper = gatekeeper::getInstance(); +$gatekeeper = gatekeeper::getInstance($Core); $gatekeeper->require_session(); @@ -40,15 +43,20 @@ $exportname = "Export_" . date("Y-n-d") . '_' . mt_rand(100, 999); if ($parm["ssttid"] != "") { - $basket = basket_adapter::getInstance($appbox, $parm['ssttid'], $session->get_usr_id()); - $exportname = str_replace(' ', '_', $basket->get_name()) . "_" . date("Y-n-d"); + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + + $basket = $repository->findUserBasket($Request->get('ssttid'), $Core->getAuthenticatedUser(), false); + $exportname = str_replace(' ', '_', $basket->getName()) . "_" . date("Y-n-d"); } $list['export_name'] = $exportname . '.zip'; $endDate = new DateTime('+3 hours'); -$url = random::getUrlToken('download', $session->get_usr_id(), $endDate, serialize($list)); +$url = random::getUrlToken(\random::TYPE_DOWNLOAD, $session->get_usr_id(), $endDate, serialize($list)); if ($url) { @@ -62,7 +70,7 @@ if ($url) ); - $events_mngr = eventsmanager_broker::getInstance($appbox); + $events_mngr = eventsmanager_broker::getInstance($appbox, $Core); $events_mngr->trigger('__DOWNLOAD__', $params); return phrasea::redirect('/download/' . $url); diff --git a/www/include/download_anonymous.php b/www/include/download_anonymous.php index 0b863296c6..94b128ca66 100644 --- a/www/include/download_anonymous.php +++ b/www/include/download_anonymous.php @@ -14,9 +14,11 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; + +$appbox = appbox::get_instance($Core); $request = http_request::getInstance(); $parm = $request->get_parms('token', 'get', 'type'); @@ -107,7 +109,7 @@ phrasea::headers(); background-repeat:no-repeat; } - +
diff --git a/www/include/download_prepare.exe.php b/www/include/download_prepare.exe.php index 43a1bd792a..a7a9df929b 100644 --- a/www/include/download_prepare.exe.php +++ b/www/include/download_prepare.exe.php @@ -15,9 +15,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; -$gatekeeper = gatekeeper::getInstance(); +$gatekeeper = gatekeeper::getInstance($Core); $gatekeeper->require_session(); $request = http_request::getInstance(); diff --git a/www/include/download_prepare.php b/www/include/download_prepare.php index 758b8a13da..8f7366a8f4 100644 --- a/www/include/download_prepare.php +++ b/www/include/download_prepare.php @@ -14,8 +14,10 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); + +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +$appbox = appbox::get_instance($Core); $registry = $appbox->get_registry(); $session = $appbox->get_session(); @@ -41,7 +43,7 @@ if (($list = @unserialize($datas['datas'])) == false) try { - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(\bootstrap::getCore()); $auth = new Session_Authentication_Token($appbox, $parm['token']); $session->authenticate($auth); } @@ -50,7 +52,7 @@ catch (Exception $e) phrasea::headers(204); } -$gatekeeper = gatekeeper::getInstance(); +$gatekeeper = gatekeeper::getInstance($Core); $gatekeeper->require_session(); $unique_file = false; @@ -142,7 +144,7 @@ phrasea::headers(); background-repeat:no-repeat; } - +
diff --git a/www/include/error.php b/www/include/error.php index 0aacee20c4..7e6c2473b9 100644 --- a/www/include/error.php +++ b/www/include/error.php @@ -14,9 +14,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -include_once dirname(__FILE__) . '/../../lib/bootstrap.php'; +include_once __DIR__ . '/../../lib/bootstrap.php'; -$appbox = appbox::get_instance(registry::get_instance()); +$appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); phrasea::use_i18n(Session_Handler::get_locale()); diff --git a/www/include/geonames.feedback.php b/www/include/geonames.feedback.php index 5098b429b3..bac4b3fa5c 100644 --- a/www/include/geonames.feedback.php +++ b/www/include/geonames.feedback.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -include(dirname(__FILE__) . '/../../lib/bootstrap.php'); +include(__DIR__ . '/../../lib/bootstrap.php'); $output = ''; $request = http_request::getInstance(); @@ -27,8 +27,10 @@ switch ($action) { case 'FIND': $geoname = new geonames(); - $twig = new supertwig(); - $output = $twig->render('geonames/city_list.twig', array('geonames'=>$geoname->find_city($parm['city']))); + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); + + $output = $twig->render('geonames/city_list.twig', array('geonames' => $geoname->find_city($parm['city']))); break; } diff --git a/www/include/jquery.common.js b/www/include/jquery.common.js index 9b1135d7a9..b32ec5d06f 100644 --- a/www/include/jquery.common.js +++ b/www/include/jquery.common.js @@ -6,14 +6,14 @@ $(document).ready(function(){ function(){$(this).removeClass('hover');} ); var locale = $.cookie('locale'); - + var jq_date = p4.lng = locale !== null ? locale.split('_').reverse().pop() : 'en'; - + if(jq_date == 'en') { jq_date = 'en-GB'; } - + $.datepicker.setDefaults({showMonthAfterYear: false}); $.datepicker.setDefaults($.datepicker.regional[jq_date]); @@ -23,7 +23,7 @@ $(document).ready(function(){ var cache = $('#mainMenu .helpcontextmenu'); $('.context-menu-item',cache).hover(function(){$(this).addClass('context-menu-item-hover');},function(){$(this).removeClass('context-menu-item-hover');}); - + $('#help-trigger').contextMenu('#mainMenu .helpcontextmenu',{openEvt:'click',dropDown:true,theme:'vista', dropDown:true, showTransition:'slideDown', hideTransition:'hide', @@ -42,14 +42,14 @@ $(document).ready(function(){ else { box.show(); - + fix_notification_height(); - + $(this).addClass('open'); read_notifications(); } }); - + $(this).bind('mousedown',function(){ var not_trigger = $('#notification_trigger'); if(not_trigger.hasClass('open')) @@ -58,12 +58,12 @@ $(document).ready(function(){ $('#notification_box').bind('mousedown',function(event){ event.stopPropagation(); }); - + $('#notification_box div.notification').live('mouseover',function(){$(this).addClass('hover');}); $('#notification_box div.notification').live('mouseout',function(){$(this).removeClass('hover');}); - - + + $(this).bind('mousedown',function(){ var box = $('#notification_box'); if($('#notification_trigger').hasClass('open')) @@ -73,10 +73,10 @@ $(document).ready(function(){ clear_notifications(); } }); - + set_notif_position(); - - + + }); @@ -116,11 +116,11 @@ function fix_notification_height() var n = not.length; var not_t = $('.notification_title',box); var n_t = not_t.length; - + h = not.outerHeight() * n + not_t.outerHeight() * n_t; h = h > 350 ? 350 : h; - - box.stop().animate({height:h}); + + box.stop().animate({height:h}); } function set_notif_position() @@ -149,7 +149,7 @@ function print_notifications(page) if($('#notifications-dialog').length === 0) $('body').append('
'); - + $('#notifications-dialog') .dialog({ title:language.notifications, @@ -170,7 +170,7 @@ function print_notifications(page) } }).dialog('option','buttons',buttons) .dialog('open'); - + $.ajax({ type: "POST", @@ -194,7 +194,7 @@ function print_notifications(page) cont.empty(); else $('.notification_next',cont).remove(); - + for (i in data.notifications) { var id = 'notif_date_'+i; @@ -219,14 +219,14 @@ function print_notifications(page) date_cont.append(html); } } - + var next_ln = $.trim(data.next); - + if(next_ln !== '') { cont.append('
'+next_ln+'
'); } - + // '
'. // '
'. // ''. @@ -235,21 +235,21 @@ function print_notifications(page) // $data['text'].' '. // '
'. // '
' - - + + } }); - + } function read_notifications() { var notifications = []; - + $('#notification_box .unread').each(function(){ notifications.push($(this).attr('id').split('_').pop()); }); - + $.ajax({ type: "POST", url: "/prod/prodFeedBack.php", @@ -266,10 +266,10 @@ function read_notifications() function clear_notifications() { var unread = $('#notification_box .unread'); - + if(unread.length === 0) return; - + unread.removeClass('unread'); $('#notification_trigger .counter').css('visibility','hidden').empty(); } @@ -282,7 +282,7 @@ function clear_notifications() function getMyRss(renew) { - + $.ajax({ type: "POST", url: "/prod/prodFeedBack.php", @@ -291,7 +291,7 @@ function getMyRss(renew) success: function(data){ } }); - + } function setPref(name,value) @@ -304,12 +304,13 @@ function setPref(name,value) jQuery.data['pref_'+name] = $.ajax({ type: "POST", - url: "/prod/prodFeedBack.php", + url: "/prod/UserPreferences/save/", data: { action: "SAVEPREF", prop:name, value:value }, + dataType:'json', timeout: function(){ jQuery.data['pref_'+name] = false; }, @@ -317,6 +318,14 @@ function setPref(name,value) jQuery.data['pref_'+name] = false; }, success: function(data){ + if(data.success) + { + humane.info(data.message); + } + else + { + humane.error(data.message); + } jQuery.data['pref_'+name] = false; return; } @@ -349,7 +358,7 @@ function manageSession(data, showMessages) { if(typeof(showMessages) == "undefined") showMessages = false; - + if(data.status == 'disconnected' || data.status == 'session') { disconnected(); @@ -359,10 +368,10 @@ function manageSession(data, showMessages) { var box = $('#notification_box'); box.empty().append(data.notifications); - + if(box.is(':visible')) fix_notification_height(); - + if($('.notification.unread',box).length > 0) { var trigger = $('#notification_trigger') ; @@ -370,7 +379,7 @@ function manageSession(data, showMessages) .empty() .append($('.notification.unread',box).length); $('.counter',trigger).css('visibility','visible'); - + } else $('#notification_trigger .counter').css('visibility','hidden').empty(); @@ -437,8 +446,9 @@ function disconnected() } function showModal(cas, options){ - + var content = ''; + var callback = null; var button = { "OK": function(e) { @@ -448,7 +458,7 @@ function showModal(cas, options){ }}; var escape = true; var onClose = function(){}; - + switch (cas) { case 'timeout': content = language.serverTimeout; @@ -459,45 +469,15 @@ function showModal(cas, options){ case 'disconnected': content = language.serverDisconnected; escape=false; - button = {"OK":function(e){ - self.location.replace(self.location.href); - }}; - onClose = function(){ - self.location.replace(self.location.href); - }; - break; - case 'prompt': - content = ""; - escape=false; - button = { - "OK":function(e){ - (options.callback)(); - hideOverlay(3); - $(this).dialog("close"); - }, - "Cancel":function(e){ - hideOverlay(3); - $(this).dialog("close"); - } - }; + callback = function(e){ self.location.replace(self.location.href)}; break; default: break; } - - var buttons = {"OK": function(e){$(this).dialog('close');}}; - - $('#DIALOG').empty().append(content).attr('title',options.title).dialog({ - autoOpen:false, - buttons: button, - closeOnEscape :escape, - resizable:false, - draggable:false, - modal:true, - close:onClose - }).dialog('open').dialog('option','buttons',buttons); + + p4.Alerts(options.title, content, callback); + return; - } function showOverlay(n,appendto,callback, zIndex){ @@ -511,7 +491,7 @@ function showOverlay(n,appendto,callback, zIndex){ appendto = 'body'; $(appendto).append(''); } - + var css = { display: 'block', opacity: 0, @@ -522,10 +502,10 @@ function showOverlay(n,appendto,callback, zIndex){ zIndex:zIndex, left:0 }; - + if(parseInt(zIndex) > 0) css['zIndex'] = parseInt(zIndex); - + if(typeof(callback) != 'function') callback = function(){}; $('#'+div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click',function(){(callback)();}); diff --git a/www/include/jquery.tooltip.js b/www/include/jquery.tooltip.js index 7d9b007d4d..326509c66b 100644 --- a/www/include/jquery.tooltip.js +++ b/www/include/jquery.tooltip.js @@ -7,14 +7,14 @@ * Copyright (c) 2006 - 2008 J�rn Zaefferer * * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ - * + * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ - + (function($) { - + // the tooltip element var helper = {}, // the title of the current element, used for restoring @@ -25,7 +25,7 @@ IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent), // flag for mouse tracking track = false; - + $.tooltip = { blocked: false, ajaxTimeout : false, @@ -51,7 +51,6 @@ delayAjax : function(a,b,c) { -// var options_serial = p4.tot_options; var query = p4.tot_query; var datas = { @@ -72,7 +71,7 @@ }); } }; - + $.fn.extend({ tooltip: function(settings) { settings = $.extend({}, $.tooltip.defaults, settings); @@ -83,7 +82,7 @@ this.tooltipText = $(this).attr('title'); this.tooltipSrc = $(this).attr('tooltipsrc'); - this.ajaxLoad = (this.tooltipText === '' && this.tooltipSrc !== ''); + this.ajaxLoad = ($.trim(this.tooltipText) === '' && this.tooltipSrc !== ''); this.ajaxTimeout; this.orEl = $(this); @@ -132,7 +131,7 @@ return this.attr('href') || this.attr('src'); } }); - + function createHelper(settings) { // there can be only one tooltip helper if( helper.parent ) @@ -143,7 +142,7 @@ .appendTo(document.body) // hide it at first .hide(); - + // apply bgiframe if available if ( $.fn.bgiframe ) helper.parent.bgiframe(); @@ -153,11 +152,11 @@ helper.body = $('div.body', helper.parent); helper.url = $('div.url', helper.parent); } - + function settings(element) { return $.data(element, "tooltip"); } - + // main event handler to start showing tooltips function handle(event) { @@ -170,15 +169,15 @@ else visible(); show(); - + // if selected, update the helper position when the mouse moves track = !!settings(this).track; $(document.body).bind('mousemove', update); - + // update at least once update(event); } - + // save elements title before the tooltip is displayed function save(event) { // if this is the current source, or it has no title (occurs with click event), stop @@ -193,7 +192,7 @@ // save current $.tooltip.current = this; title = this.tooltipText; - + // if ( settings(this).bodyHandler ) { // helper.title.hide(); // var bodyContent = settings(this).bodyHandler.call(this); @@ -216,13 +215,13 @@ // } else { // helper.body.html(title).show(); // } - + // if element has href or src, add and show it, otherwise hide it if( settings(this).showURL && $(this).url() ) helper.url.html( $(this).url().replace('http://', '') ).show(); else helper.url.hide(); - + // add an optional class for this tip // helper.parent.addClass(settings(this).extraClass); if(this.ajaxLoad) @@ -241,8 +240,8 @@ function positioning(event) { - - helper.body.html(title).show(); + helper.body.html(title); + helper.body.show(); $this = $.tooltip.current; // fix PNG background for IE if (settings($this).fixPNG ) @@ -252,8 +251,11 @@ var width = 'auto'; var height = 'auto'; var ratio = 1; + var resizeImgTips = false; var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips'); - if ($imgTips[0]) { + + if ($imgTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) { + resizeImgTips = true; width = parseInt($imgTips[0].style.width); height = parseInt($imgTips[0].style.height); ratio = width/height; @@ -326,7 +328,7 @@ //correction par ratio - if ($('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { + if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { if(ratioSurfaceH > ratioImage) { @@ -404,7 +406,7 @@ //si ya une image on re-ajuste au ratio - if ($('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { + if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { if(width == 'auto') width = $('#' + settings($.tooltip.current).id).width(); if(height == 'auto') @@ -440,20 +442,14 @@ top: top }); - $imgTips.css({ - width: width, - height: height -// , -// left: left, -// top: top - }); + if(resizeImgTips) + { + $imgTips.css({ + width: width, + height: height + }); + } -// if($imgTips.size() > 0) -// { -// $('#' + settings($.tooltip.current).id).image_enhance('destroy').image_enhance({ -// zoomable:true -// }); -// } } } @@ -464,7 +460,7 @@ // delete timeout and show helper function show() { tID = null; - + if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) { if (helper.parent.is(":animated")) helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100); @@ -475,7 +471,7 @@ } update(); } - + function fix(event) { if(!settings(this).fixable) @@ -490,21 +486,21 @@ $('#tooltip .tooltip_closer').show(); $.tooltip.blocked = true; } - + function visible(){ $.tooltip.visible = true; helper.parent.css({ visibility:'visible' }); } - + /** * callback for mousemove * updates the helper position * removes itself when no current element */ function update(event) { - + if($.tooltip.blocked) return; @@ -516,7 +512,7 @@ if ( !track && helper.parent.is(":visible")) { $(document.body).unbind('mousemove', update); } - + // if no current element is available, remove this listener if( $.tooltip.current === null ) { $(document.body).unbind('mousemove', update); @@ -525,7 +521,7 @@ // remove position helper classes helper.parent.removeClass("viewport-right").removeClass("viewport-bottom"); - + if(!settings($.tooltip.current).outside) { var left = helper.parent[0].offsetLeft; @@ -547,7 +543,7 @@ top: top }); } - + var v = viewport(), h = helper.parent[0]; // check horizontal position @@ -566,17 +562,17 @@ } } } - + function viewport() { return { x: $(window).width(), y: $(window).height(), - + cx: 0, cy: 0 }; } - + // hide helper and restore added classes and the title function hide(event) { @@ -604,11 +600,11 @@ helper.parent.stop().fadeOut(tsettings.fade, complete); } else complete(); - + if( tsettings.fixPNG ) helper.parent.unfixPNG(); } - + })(jQuery); function unfix_tooltip() diff --git a/www/include/js/jquery.Edit.js b/www/include/js/jquery.Edit.js new file mode 100644 index 0000000000..63c6fd2ad2 --- /dev/null +++ b/www/include/js/jquery.Edit.js @@ -0,0 +1,512 @@ + +(function( window ) { + + function checkVocabId(VocabularyId) + { + if(typeof VocabularyId === 'undefined') + VocabularyId = null; + + if(VocabularyId === '') + VocabularyId = null; + + return VocabularyId; + } + + var recordFieldValue = function(meta_id, value, VocabularyId) { + + VocabularyId = checkVocabId(VocabularyId); + + this.datas = { + meta_id:meta_id, + value:value, + VocabularyId:VocabularyId + }; + + var $this = this; + }; + + recordFieldValue.prototype = { + getValue : function() { + return this.datas.value; + }, + getMetaId : function() { + return this.datas.meta_id; + }, + getVocabularyId : function() { + return this.datas.VocabularyId; + }, + setValue : function(value, VocabularyId) { + + this.datas.value = value; + this.datas.VocabularyId = checkVocabId(VocabularyId); + return this; + }, + remove : function() { + this.datas.value = ''; + this.datas.VocabularyId = null; + + return this; + } + }; + + var databoxField = function(name, meta_struct_id, options) { + + var defaults = { + multi : false, + required : false, + readonly : false, + maxLength : null, + minLength : null, + type : 'string', + separator : null, + vocabularyControl : null, + vocabularyRestricted : false + }, + options = (typeof options == 'object') ? options : {}; + + if(isNaN(meta_struct_id)) + { + throw 'meta_struct_id should be a number'; + } + + this.name = name; + this.meta_struct_id = meta_struct_id; + this.options = jQuery.extend(defaults, options); + + if(this.options.multi === true && this.options.separator === null) + { + this.options.separator = ';'; + } + + }; + + databoxField.prototype = { + getMetaStructId : function() { + return this.meta_struct_id; + }, + getName : function() { + return this.name; + }, + isMulti : function() { + return this.options.multi; + }, + isRequired : function() { + return this.options.required; + }, + isReadonly : function() { + return this.options.readonly; + }, + getMaxLength : function() { + return this.options.maxLength; + }, + getMinLength : function() { + return this.options.minLength; + }, + getType : function() { + return this.options.type; + }, + getSeparator : function() { + return this.options.separator; + } + }; + + var recordField = function(databoxField, arrayValues) { + + this.databoxField = databoxField; + this.options = { + dirty : false + }; + this.datas = new Array(); + + if(arrayValues instanceof Array) + { + if(arrayValues.length > 1 && !databoxField.isMulti()) + throw 'You can not add multiple values to a non multi field'; + + var first = true; + + for(v in arrayValues) + { + if(typeof arrayValues[v] !== 'object') + { + if(window.console) + { + console.error('Trying to add a non-recordFieldValue to the field...'); + } + + continue; + } + + if(isNaN(arrayValues[v].getMetaId())) + { + if(window.console) + { + console.error('Trying to add a recordFieldValue without metaId...'); + } + + continue; + } + + if(!first && this.options.multi === false) + { + if(window.console) + { + console.error('Trying to add multi values in a non-multi field'); + } + } + + if(window.console) + { + console.log('adding a value : ', arrayValues[v]); + } + + this.datas.push(arrayValues[v]); + first = false; + } + } + + var $this = this; + } + recordField.prototype = { + getName : function() { + return this.databoxField.getName(); + }, + getMetaStructId : function() { + return this.databoxField.getMetaStructId(); + }, + isMulti : function() { + return this.databoxField.isMulti(); + }, + isRequired : function() { + return this.databoxField.isRequired(); + }, + isDirty : function() { + return this.options.dirty; + }, + addValue : function(value, merge, VocabularyId) { + + VocabularyId = checkVocabId(VocabularyId); + + merge = !!merge; + + if(this.databoxField.isReadonly()) + { + if(window.console) + { + console.error('Unable to set a value to a readonly field'); + } + + return; + } + + if(window.console) + { + console.log('adding value ',value,' vocId : ', VocabularyId , ' ; merge is ',merge); + } + + if(this.isMulti()) + { + if(!this.hasValue(value, VocabularyId)) + { + if(window.console) + { + console.log('adding new multi value ',value); + } + this.datas.push(new recordFieldValue(null, value, VocabularyId)); + this.options.dirty = true; + } + else + { + if(window.console) + { + console.log('already have ',value); + } + } + } + else + { + if(merge === true && this.isEmpty() === false && VocabularyId === null) + { + if(window.console) + { + console.log('Merging value ',value); + } + this.datas[0].setValue(this.datas[0].getValue() + ' ' + value, VocabularyId); + + this.options.dirty = true; + } + else + { + if(merge === true && this.isEmpty() === false && VocabularyId !== null) + { + if(window.console) + { + console.error('Cannot merge vocabularies'); + } + this.datas[0].setValue(value, VocabularyId); + } + else + { + + if(!this.hasValue(value, VocabularyId)) + { + if(this.datas.length === 0) + { + if(window.console) + { + console.log('Adding new value ',value); + } + this.datas.push(new recordFieldValue(null, value, VocabularyId)); + } + else + { + if(window.console) + { + console.log('Updating value ',value); + } + this.datas[0].setValue(value, VocabularyId); + } + this.options.dirty = true; + } + } + } + } + + return this; + }, + hasValue : function(value, VocabularyId) { + + if(typeof value === 'undefined') + { + if(window.console) + { + console.error('Trying to check the presence of an undefined value'); + } + } + + VocabularyId = checkVocabId(VocabularyId); + + for(d in this.datas) + { + if(VocabularyId !== null) + { + if(this.datas[d].getVocabularyId() === VocabularyId) + { + if(window.console) + { + console.log('already got the vocab ID'); + } + return true; + } + } + else if(this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value) + { + if(window.console) + { + console.log('already got this value'); + } + return true; + } + } + return false; + }, + removeValue : function(value, vocabularyId) { + + if(this.databoxField.isReadonly()) + { + if(window.console) + { + console.error('Unable to set a value to a readonly field'); + } + + return; + } + + vocabularyId = checkVocabId(vocabularyId); + + if(window.console) + { + console.log('Try to remove value ', value, vocabularyId, this.datas); + } + + for(d in this.datas) + { + if(window.console) + { + console.log('loopin... ', this.datas[d].getValue()); + } + if(this.datas[d].getVocabularyId() !== null) + { + if(this.datas[d].getVocabularyId() == vocabularyId) + { + if(window.console) + { + console.log('Found within the vocab ! removing... '); + } + this.datas[d].remove(); + this.options.dirty = true; + } + } + else if(this.datas[d].getValue() == value) + { + if(window.console) + { + console.log('Found ! removing... '); + } + this.datas[d].remove(); + this.options.dirty = true; + } + } + return this; + }, + isEmpty : function() { + var empty = true; + + for(d in this.datas) + { + if(this.datas[d].getValue() !== '') + empty = false; + } + return empty; + }, + empty : function() { + + if(this.databoxField.isReadonly()) + { + if(window.console) + { + console.error('Unable to set a value to a readonly field'); + } + + return; + } + + for(d in this.datas) + { + this.datas[d].remove(); + this.options.dirty = true; + } + return this; + }, + getValue : function() { + + if(this.isMulti()) + throw 'This field is multi, I can not give you a single value'; + + if(this.isEmpty()) + return null; + + return this.datas[0]; + }, + getValues : function() { + + if(!this.isMulti()) + { + throw 'This field is not multi, I can not give you multiple values'; + } + + if(this.isEmpty()) + return new Array(); + + var arrayValues = []; + + for(d in this.datas) + { + if(this.datas[d].getValue() === '') + continue; + + arrayValues.push(this.datas[d]); + } + + return arrayValues; + }, + sort : function(algo) { + this.datas.sort(algo); + + return this; + }, + getSerializedValues : function() { + + var arrayValues = []; + var values = this.getValues(); + + for(v in values) + { + arrayValues.push(values[v].getValue()); + } + + return arrayValues.join(' ' + this.databoxField.getSeparator() + ' '); + }, + replaceValue : function(search, replace) { + + if(this.databoxField.isReadonly()) + { + if(window.console) + { + console.error('Unable to set a value to a readonly field'); + } + + return 0; + } + + var n = 0; + + for(d in this.datas) + { + if(this.datas[d].getVocabularyId() !== null) + { + continue; + } + + var value = this.datas[d].getValue(); + var replacedValue = value.replace(search, replace); + + if(value === replacedValue) + { + continue; + } + + n++; + + this.removeValue(value); + + if(!this.hasValue(replacedValue)) + { + this.addValue(replacedValue); + } + + this.options.dirty = true; + } + + return n; + }, + exportDatas : function() { + + var returnValue = new Array(); + + for(d in this.datas) + { + var temp = { + meta_id : this.datas[d].getMetaId() ? this.datas[d].getMetaId() : '', + meta_struct_id : this.getMetaStructId(), + value : this.datas[d].getValue() + }; + + if(this.datas[d].getVocabularyId()) + { + temp.vocabularyId = this.datas[d].getVocabularyId(); + } + returnValue.push(temp); + } + + return returnValue; + } + }; + + window.p4 = window.p4 || {}; + + window.p4.databoxField = databoxField; + window.p4.recordFieldValue = recordFieldValue; + window.p4.recordField = recordField; + +})(window); \ No newline at end of file diff --git a/www/include/js/jquery.Selection.js b/www/include/js/jquery.Selection.js new file mode 100644 index 0000000000..9297746494 --- /dev/null +++ b/www/include/js/jquery.Selection.js @@ -0,0 +1,283 @@ +/* + * Selection Object + * + * + */ + +(function( window ) { + + var Selectable = function($container, options) { + + var defaults = { + allow_multiple : false, + selector : '', + callbackSelection : null, + selectStart : null, + selectStop : null, + limit : null + }, + options = (typeof options == 'object') ? options : {}; + + var $this = this; + + if($container.data('selectionnable')) + { + /* this container is already selectionnable */ + if(window.console) + { + console.error('Trying to apply new selection to existing one'); + } + + return $container.data('selectionnable'); + } + + this.$container = $container; + this.options = jQuery.extend(defaults, options); + this.datas = new Array(); + + this.$container.data('selectionnable', this); + this.$container.addClass('selectionnable'); + + jQuery(this.options.selector, this.$container) + .live('click', function(event){ + + if(typeof $this.options.selectStart === 'function') + { + $this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this); + } + + var $that = jQuery(this); + + var k = get_value($that, $this); + + if(is_shift_key(event) && jQuery('.last_selected', this.$container).filter($this.options.selector).length != 0) + { + var lst = jQuery($this.options.selector, this.$container); + + var index1 = jQuery.inArray( jQuery('.last_selected', this.$container).filter($this.options.selector)[0], lst ); + var index2 = jQuery.inArray( $that[0], lst ); + + if(index2= 0; + }, + get : function(){ + + return this.datas; + }, + empty : function(){ + var $this = this; + this.datas = new Array(); + + jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected'); + + if(typeof $this.options.selectStop === 'function') + { + $this.options.selectStop(jQuery.Event('selectStop'), $this); + } + + return this; + }, + length : function(){ + + return this.datas.length; + }, + size : function(){ + + return this.datas.length; + }, + serialize : function(separator){ + + separator = separator || ';'; + + return this.datas.join(separator); + }, + selectAll : function(){ + this.select('*'); + + return this; + }, + select : function(selector){ + var $this = this, + stopped = false; + + jQuery(this.options.selector, this.$container).filter(selector).not('.selected').filter(':visible').each(function(){ + if(!$this.hasReachLimit()) + { + $this.push(get_value(this, $this)); + $(this).addClass('selected'); + } + else + { + if(stopped === false) + { + alert(language.max_record_selected); + } + stopped = true; + } + }); + + + if(typeof $this.options.selectStop === 'function') + { + $this.options.selectStop(jQuery.Event('selectStop'), $this); + } + + return this; + } + }; + + window.Selectable = Selectable; +})(window); \ No newline at end of file diff --git a/www/include/js/jquery.lists.js b/www/include/js/jquery.lists.js new file mode 100644 index 0000000000..5d7111f5e7 --- /dev/null +++ b/www/include/js/jquery.lists.js @@ -0,0 +1,285 @@ +var p4 = p4 || {}; + +(function( window, p4, $ ) { + + var Lists = function() { + + }; + + var List = function (id) { + + if(parseInt(id) <= 0) + { + throw 'Invalid list id'; + } + + this.id = id; + }; + + Lists.prototype = { + create : function(name, callback){ + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/', + dataType: 'json', + data: {name : name}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + var list = new List(data.list_id); + callback(list); + } + } + else + { + humane.error(data.message); + } + } + }); + + }, + get : function(callback, type) { + + var $this = this; + type = typeof type === 'undefined' ? 'json' : type; + + $.ajax({ + type: 'GET', + url: '/prod/lists/all/', + dataType: type, + data: {}, + success: function(data){ + if(type == 'json') + { + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback(data.result); + } + } + else + { + humane.error(data.message); + } + } + else + { + if(typeof callback === 'function') + { + callback(data); + } + } + } + }); + } + + } + + List.prototype = { + addUsers : function(arrayUsers, callback) { + + if(!arrayUsers instanceof Array) + { + throw 'addUsers takes array as argument'; + } + + var $this = this; + var data = {usr_ids : $(arrayUsers).toArray()}; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + $this.id + '/add/', + dataType: 'json', + data: data, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this, data); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + addUser : function(usr_id, callback) { + this.addUsers([usr_id], callback); + }, + remove : function(callback) { + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + this.id + '/delete/', + dataType: 'json', + data: {}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + update : function(name, callback) { + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + this.id + '/update/', + dataType: 'json', + data: { name : name }, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + removeUser : function(usr_id, callback) { + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + this.id + '/remove/' + usr_id + '/', + dataType: 'json', + data: {}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this, data); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + shareWith : function(usr_id, role, callback) { + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + this.id + '/share/' + usr_id + '/', + dataType: 'json', + data: {role : role}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + unshareWith : function(callback) { + + var $this = this; + + $.ajax({ + type: 'POST', + url: '/prod/lists/list/' + this.id + '/unshare/' + usr_id + '/', + dataType: 'json', + data: {}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this); + } + } + else + { + humane.error(data.message); + } + } + }); + }, + get : function(callback) { + + var $this = this; + + $.ajax({ + type: 'GET', + url: '/prod/lists/list/' + this.id + '/', + dataType: 'json', + data: {}, + success: function(data){ + if(data.success) + { + humane.info(data.message); + + if(typeof callback === 'function') + { + callback($this, data); + } + } + else + { + humane.error(data.message); + } + } + }); + } + } + + p4.Lists = new Lists(); + document.List = List; + +})(document, p4, jQuery); \ No newline at end of file diff --git a/www/include/js/tests/jquery.Edit.js.html b/www/include/js/tests/jquery.Edit.js.html new file mode 100644 index 0000000000..b39120cde1 --- /dev/null +++ b/www/include/js/tests/jquery.Edit.js.html @@ -0,0 +1,390 @@ + + + + + + + + + + + + +

QUnit example

+

+
+

+
    +
    test markup, will be hidden
    + + diff --git a/www/include/js/tests/jquery.Selection.js.html b/www/include/js/tests/jquery.Selection.js.html new file mode 100644 index 0000000000..b380692699 --- /dev/null +++ b/www/include/js/tests/jquery.Selection.js.html @@ -0,0 +1,163 @@ + + + + + + + + + + + + +

    QUnit example

    +

    +
    +

    +
      +
      test markup, will be hidden
      +
      +
        +
      • +
      • +
      • +
      • +
      • +
      • +
      • +
      • +
      • +
      • +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + diff --git a/www/include/jslibs/jquery-1.5.2.js b/www/include/jslibs/jquery-1.7.1.js similarity index 60% rename from www/include/jslibs/jquery-1.5.2.js rename to www/include/jslibs/jquery-1.7.1.js index 1565e3b44a..8ccd0ea786 100644 --- a/www/include/jslibs/jquery-1.5.2.js +++ b/www/include/jslibs/jquery-1.7.1.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v1.5.2 + * jQuery JavaScript Library v1.7.1 * http://jquery.com/ * * Copyright 2011, John Resig @@ -11,12 +11,14 @@ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * - * Date: Thu Mar 31 15:28:23 2011 -0400 + * Date: Mon Nov 21 21:11:03 2011 -0500 */ (function( window, undefined ) { // Use the correct document accordingly with window argument (sandbox) -var document = window.document; +var document = window.document, + navigator = window.navigator, + location = window.location; var jQuery = (function() { // Define a local copy of jQuery @@ -35,8 +37,8 @@ var jQuery = function( selector, context ) { rootjQuery, // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, + // Prioritize #id over to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, @@ -45,9 +47,6 @@ var jQuery = function( selector, context ) { trimLeft = /^\s+/, trimRight = /\s+$/, - // Check for digits - rdigit = /\d/, - // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, @@ -63,6 +62,15 @@ var jQuery = function( selector, context ) { rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, @@ -107,7 +115,7 @@ jQuery.fn = jQuery.prototype = { if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; - this.selector = "body"; + this.selector = selector; this.length = 1; return this; } @@ -115,7 +123,13 @@ jQuery.fn = jQuery.prototype = { // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? - match = quickExpr.exec( selector ); + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { @@ -123,7 +137,7 @@ jQuery.fn = jQuery.prototype = { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; - doc = (context ? context.ownerDocument || context : document); + doc = ( context ? context.ownerDocument || context : document ); // If a single string is passed in and it's a single tag // just do a createElement and skip the rest @@ -140,7 +154,7 @@ jQuery.fn = jQuery.prototype = { } else { ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; } return jQuery.merge( this, selector ); @@ -170,7 +184,7 @@ jQuery.fn = jQuery.prototype = { // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); + return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) @@ -184,7 +198,7 @@ jQuery.fn = jQuery.prototype = { return rootjQuery.ready( selector ); } - if (selector.selector !== undefined) { + if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } @@ -196,7 +210,7 @@ jQuery.fn = jQuery.prototype = { selector: "", // The current version of jQuery being used - jquery: "1.5.2", + jquery: "1.7.1", // The default length of a jQuery object is 0 length: 0, @@ -241,7 +255,7 @@ jQuery.fn = jQuery.prototype = { ret.context = this.context; if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } @@ -262,15 +276,16 @@ jQuery.fn = jQuery.prototype = { jQuery.bindReady(); // Add the callback - readyList.done( fn ); + readyList.add( fn ); return this; }, eq: function( i ) { + i = +i; return i === -1 ? this.slice( i ) : - this.slice( i, +i + 1 ); + this.slice( i, i + 1 ); }, first: function() { @@ -372,9 +387,11 @@ jQuery.extend = jQuery.fn.extend = function() { jQuery.extend({ noConflict: function( deep ) { - window.$ = _$; + if ( window.$ === jQuery ) { + window.$ = _$; + } - if ( deep ) { + if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } @@ -388,15 +405,19 @@ jQuery.extend({ // the ready event fires. See #6781 readyWait: 1, + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + // Handle when the DOM is ready ready: function( wait ) { - // A third-party is pushing the ready event forwards - if ( wait === true ) { - jQuery.readyWait--; - } - - // Make sure that the DOM is not already loaded - if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); @@ -411,11 +432,11 @@ jQuery.extend({ } // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); + readyList.fireWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).unbind( "ready" ); + jQuery( document ).trigger( "ready" ).off( "ready" ); } } }, @@ -425,7 +446,7 @@ jQuery.extend({ return; } - readyList = jQuery._Deferred(); + readyList = jQuery.Callbacks( "once memory" ); // Catch cases where $(document).ready() is called after the // browser event has already occurred. @@ -446,7 +467,7 @@ jQuery.extend({ } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes - document.attachEvent("onreadystatechange", DOMContentLoaded); + document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); @@ -481,8 +502,8 @@ jQuery.extend({ return obj && typeof obj === "object" && "setInterval" in obj; }, - isNaN: function( obj ) { - return obj == null || !rdigit.test( obj ) || isNaN( obj ); + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { @@ -499,10 +520,15 @@ jQuery.extend({ return false; } - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 return false; } @@ -523,7 +549,7 @@ jQuery.extend({ }, error: function( msg ) { - throw msg; + throw new Error( msg ); }, parseJSON: function( data ) { @@ -534,67 +560,66 @@ jQuery.extend({ // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test(data.replace(rvalidescape, "@") - .replace(rvalidtokens, "]") - .replace(rvalidbraces, "")) ) { + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { - // Try to use the native JSON parser first - return window.JSON && window.JSON.parse ? - window.JSON.parse( data ) : - (new Function("return " + data))(); + return ( new Function( "return " + data ) )(); - } else { - jQuery.error( "Invalid JSON: " + data ); } + jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing - // (xml & tmp used internally) - parseXML: function( data , xml , tmp ) { - - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); + parseXML: function( data ) { + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; } - - tmp = xml.documentElement; - - if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } - return xml; }, noop: function() {}, - // Evalulates a script in a global context + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { - if ( data && rnotwhite.test(data) ) { - // Inspired by code by Andrea Giammarchi - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement, - script = document.createElement( "script" ); - - if ( jQuery.support.scriptEval() ) { - script.appendChild( document.createTextNode( data ) ); - } else { - script.text = data; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709). - head.insertBefore( script, head.firstChild ); - head.removeChild( script ); + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); } }, + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }, @@ -603,7 +628,7 @@ jQuery.extend({ each: function( object, callback, args ) { var name, i = 0, length = object.length, - isObj = length === undefined || jQuery.isFunction(object); + isObj = length === undefined || jQuery.isFunction( object ); if ( args ) { if ( isObj ) { @@ -629,8 +654,11 @@ jQuery.extend({ } } } else { - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } } } @@ -658,10 +686,8 @@ jQuery.extend({ if ( array != null ) { // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type(array); + var type = jQuery.type( array ); if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { push.call( ret, array ); @@ -673,14 +699,22 @@ jQuery.extend({ return ret; }, - inArray: function( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } + inArray: function( elem, array, i ) { + var len; - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } } } @@ -725,15 +759,30 @@ jQuery.extend({ // arg is for internal usage only map: function( elems, callback, arg ) { - var ret = [], value; + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their - // new value (or values). - for ( var i = 0, length = elems.length; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); - if ( value != null ) { - ret[ ret.length ] = value; + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } } } @@ -744,36 +793,35 @@ jQuery.extend({ // A global GUID counter for objects guid: 1, - proxy: function( fn, proxy, thisObject ) { - if ( arguments.length === 2 ) { - if ( typeof proxy === "string" ) { - thisObject = fn; - fn = thisObject[ proxy ]; - proxy = undefined; - - } else if ( proxy && !jQuery.isFunction( proxy ) ) { - thisObject = proxy; - proxy = undefined; - } + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; } - if ( !proxy && fn ) { + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), proxy = function() { - return fn.apply( thisObject || this, arguments ); + return fn.apply( context, args.concat( slice.call( arguments ) ) ); }; - } // Set the guid of unique handler to the same of original handler, so it can be removed - if ( fn ) { - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - } + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - // So proxy can be declared as an argument return proxy; }, // Mutifunctional method to get and set values to a collection - // The value/s can be optionally by executed if its a function + // The value/s can optionally be executed if it's a function access: function( elems, key, value, exec, fn, pass ) { var length = elems.length; @@ -802,7 +850,7 @@ jQuery.extend({ }, now: function() { - return (new Date()).getTime(); + return ( new Date() ).getTime(); }, // Use of jQuery.browser is frowned upon. @@ -820,24 +868,24 @@ jQuery.extend({ }, sub: function() { - function jQuerySubclass( selector, context ) { - return new jQuerySubclass.fn.init( selector, context ); + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); } - jQuery.extend( true, jQuerySubclass, this ); - jQuerySubclass.superclass = this; - jQuerySubclass.fn = jQuerySubclass.prototype = this(); - jQuerySubclass.fn.constructor = jQuerySubclass; - jQuerySubclass.subclass = this.subclass; - jQuerySubclass.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { - context = jQuerySubclass(context); + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); } - return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; - jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; - var rootjQuerySubclass = jQuerySubclass(document); - return jQuerySubclass; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; }, browser: {} @@ -859,12 +907,6 @@ if ( jQuery.browser.webkit ) { jQuery.browser.safari = true; } -if ( indexOf ) { - jQuery.inArray = function( elem, array ) { - return indexOf.call( array, elem ); - }; -} - // IE doesn't match non-breaking spaces with \s if ( rnotwhite.test( "\xA0" ) ) { trimLeft = /^[\s\xA0]+/; @@ -910,167 +952,365 @@ function doScrollCheck() { jQuery.ready(); } -// Expose jQuery to the global object return jQuery; })(); -var // Promise methods - promiseMethods = "then done fail isResolved isRejected promise".split( " " ), - // Static reference to slice +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!memory; + } + }; + + return self; +}; + + + + +var // Static reference to slice sliceDeferred = [].slice; jQuery.extend({ - // Create a simple deferred (one callbacks list) - _Deferred: function() { - var // callbacks list - callbacks = [], - // stored [ context , args ] - fired, - // to avoid firing when already doing so - firing, - // flag to know if the deferred has been cancelled - cancelled, - // the deferred itself - deferred = { - // done( f1, f2, ...) - done: function() { - if ( !cancelled ) { - var args = arguments, - i, - length, - elem, - type, - _fired; - if ( fired ) { - _fired = fired; - fired = 0; - } - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - deferred.done.apply( deferred, elem ); - } else if ( type === "function" ) { - callbacks.push( elem ); - } - } - if ( _fired ) { - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); - } - } - return this; - }, - - // resolve with given context and args - resolveWith: function( context, args ) { - if ( !cancelled && !fired && !firing ) { - // make sure args are available (#8421) - args = args || []; - firing = 1; - try { - while( callbacks[ 0 ] ) { - callbacks.shift().apply( context, args ); - } - } - finally { - fired = [ context, args ]; - firing = 0; - } - } - return this; - }, - - // resolve with this as context and given arguments - resolve: function() { - deferred.resolveWith( this, arguments ); - return this; - }, - - // Has this deferred been resolved? - isResolved: function() { - return !!( firing || fired ); - }, - - // Cancel - cancel: function() { - cancelled = 1; - callbacks = []; - return this; - } - }; - - return deferred; - }, - - // Full fledged deferred (two callbacks list) Deferred: function( func ) { - var deferred = jQuery._Deferred(), - failDeferred = jQuery._Deferred(), - promise; - // Add errorDeferred methods, then and promise - jQuery.extend( deferred, { - then: function( doneCallbacks, failCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ); - return this; + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList }, - fail: failDeferred.done, - rejectWith: failDeferred.resolveWith, - reject: failDeferred.resolve, - isRejected: failDeferred.isResolved, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - if ( promise ) { - return promise; + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } } - promise = obj = {}; + return obj; } - var i = promiseMethods.length; - while( i-- ) { - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; - } - return obj; - } - } ); - // Make sure only one callback list will be used - deferred.done( failDeferred.cancel ).fail( deferred.cancel ); - // Unexpose cancel - delete deferred.cancel; + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + // Call given func if any if ( func ) { func.call( deferred, deferred ); } + + // All done! return deferred; }, // Deferred helper when: function( firstParam ) { - var args = arguments, + var args = sliceDeferred.call( arguments, 0 ), i = 0, length = args.length, + pValues = new Array( length ), count = length, + pCount = length, deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? firstParam : - jQuery.Deferred(); + jQuery.Deferred(), + promise = deferred.promise(); function resolveFunc( i ) { return function( value ) { args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; if ( !( --count ) ) { - // Strange bug in FF4: - // Values changed onto the arguments object sometimes end up as undefined values - // outside the $.when method. Cloning the object into a fresh array solves the issue - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); + deferred.resolveWith( deferred, args ); } }; } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } if ( length > 1 ) { - for( ; i < length; i++ ) { - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject ); + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); } else { --count; } @@ -1081,36 +1321,51 @@ jQuery.extend({ } else if ( deferred !== firstParam ) { deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); } - return deferred.promise(); + return promise; } }); -(function() { +jQuery.support = (function() { - jQuery.support = {}; + var support, + all, + a, + select, + opt, + input, + marginDiv, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; - var div = document.createElement("div"); + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = "
      a"; - div.style.display = "none"; - div.innerHTML = "
      a"; - - var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0], - select = document.createElement("select"), - opt = select.appendChild( document.createElement("option") ), - input = div.getElementsByTagName("input")[0]; + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; // Can't get basic test support if ( !all || !all.length || !a ) { - return; + return {}; } - jQuery.support = { + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, + leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables @@ -1121,17 +1376,17 @@ jQuery.extend({ htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute - // (IE uses .cssText insted) - style: /red/.test( a.getAttribute("style") ), + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", + hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), + opacity: /^0.55/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) @@ -1140,123 +1395,151 @@ jQuery.extend({ // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) - checkOn: input.value === "on", + checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, deleteExpando: true, - optDisabled: false, - checkClone: false, noCloneEvent: true, - noCloneChecked: true, - boxModel: null, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, - reliableHiddenOffsets: true, reliableMarginRight: true }; + // Make sure checked status is properly cloned input.checked = true; - jQuery.support.noCloneChecked = input.cloneNode( true ).checked; + support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as diabled) + // (WebKit marks them as disabled) select.disabled = true; - jQuery.support.optDisabled = !opt.disabled; - - var _scriptEval = null; - jQuery.support.scriptEval = function() { - if ( _scriptEval === null ) { - var root = document.documentElement, - script = document.createElement("script"), - id = "script" + jQuery.now(); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - if ( window[ id ] ) { - _scriptEval = true; - delete window[ id ]; - } else { - _scriptEval = false; - } - - root.removeChild( script ); - } - - return _scriptEval; - }; + support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; - - } catch(e) { - jQuery.support.deleteExpando = false; + } catch( e ) { + support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent("onclick", function click() { + div.attachEvent( "onclick", function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) - jQuery.support.noCloneEvent = false; - div.detachEvent("onclick", click); + support.noCloneEvent = false; }); - div.cloneNode(true).fireEvent("onclick"); + div.cloneNode( true ).fireEvent( "onclick" ); } - div = document.createElement("div"); - div.innerHTML = ""; + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; - var fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); + input.setAttribute("checked", "checked"); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - // Figure out if the W3C box model works as expected - // document.body must exist before we can do this + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + div.innerHTML = ""; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = marginDiv = div = input = null; + + // Run tests that need a body at doc ready jQuery(function() { - var div = document.createElement("div"), + var container, outer, inner, table, td, offsetSupport, + conMarginTop, ptlm, vb, style, html, body = document.getElementsByTagName("body")[0]; - // Frameset documents with no body should not run this code if ( !body ) { + // Return for frameset docs that don't have a body return; } - div.style.width = div.style.paddingLeft = "1px"; - body.appendChild( div ); - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; + conMarginTop = 1; + ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; + vb = "visibility:hidden;border:0;"; + style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; + html = "
      " + + "" + + "
      "; - if ( "zoom" in div.style ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; + container = document.createElement("div"); + container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
      "; - jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; - } - - div.innerHTML = "
      t
      "; - var tds = div.getElementsByTagName("td"); + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a @@ -1265,63 +1548,77 @@ jQuery.extend({ // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) - jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; + div.innerHTML = "
      t
      "; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); - tds[0].style.display = ""; - tds[1].style.display = "none"; + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height - // (IE < 8 fail this test) - jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; - div.innerHTML = ""; + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( document.defaultView && document.defaultView.getComputedStyle ) { - div.style.width = "1px"; - div.style.marginRight = "0"; - jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0; + // Figure out if the W3C box model works as expected + div.innerHTML = ""; + div.style.width = div.style.paddingLeft = "1px"; + jQuery.boxModel = support.boxModel = div.offsetWidth === 2; + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "
      "; + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); } - body.removeChild( div ).style.display = "none"; - div = tds = null; + div.style.cssText = ptlm + vb; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + body.removeChild( container ); + div = container = null; + + jQuery.extend( support, offsetSupport ); }); - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( !el.attachEvent ) { - return true; - } - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - return isSupported; - }; - - jQuery.support.submitBubbles = eventSupported("submit"); - jQuery.support.changeBubbles = eventSupported("change"); - - // release memory in IE - div = all = a = null; + return support; })(); -var rbrace = /^(?:\{.*\}|\[.*\])$/; + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, @@ -1344,7 +1641,6 @@ jQuery.extend({ hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); }, @@ -1353,7 +1649,9 @@ jQuery.extend({ return; } - var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary @@ -1365,11 +1663,12 @@ jQuery.extend({ // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all - if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { return; } @@ -1377,18 +1676,17 @@ jQuery.extend({ // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { - elem[ jQuery.expando ] = id = ++jQuery.uuid; + elem[ internalKey ] = id = ++jQuery.uuid; } else { - id = jQuery.expando; + id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } @@ -1398,37 +1696,53 @@ jQuery.extend({ // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { - cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); + cache[ id ] = jQuery.extend( cache[ id ], name ); } else { - cache[ id ] = jQuery.extend(cache[ id ], name); + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } - thisCache = cache[ id ]; + privateCache = thisCache = cache[ id ]; - // Internal jQuery data is stored in a separate object inside the object's data + // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined - // data - if ( pvt ) { - if ( !thisCache[ internalKey ] ) { - thisCache[ internalKey ] = {}; + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; } - thisCache = thisCache[ internalKey ]; + thisCache = thisCache.data; } if ( data !== undefined ) { - thisCache[ name ] = data; + thisCache[ jQuery.camelCase( name ) ] = data; } - // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should - // not attempt to inspect the internal events object using jQuery.data, as this - // internal data object is undocumented and subject to change. - if ( name === "events" && !thisCache[name] ) { - return thisCache[ internalKey ] && thisCache[ internalKey ].events; + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; } - return getByName ? thisCache[ name ] : thisCache; + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { @@ -1436,13 +1750,18 @@ jQuery.extend({ return; } - var internalKey = jQuery.expando, isNode = elem.nodeType, + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, // See jQuery.data for more information - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + id = isNode ? elem[ internalKey ] : internalKey; // If there is already no cache entry for this object, there is no // purpose in continuing @@ -1451,22 +1770,44 @@ jQuery.extend({ } if ( name ) { - var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; + + thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { - delete thisCache[ name ]; + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed - if ( !isEmptyDataObject(thisCache) ) { + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information - if ( pvt ) { - delete cache[ id ][ internalKey ]; + if ( !pvt ) { + delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it @@ -1475,43 +1816,28 @@ jQuery.extend({ } } - var internalCache = cache[ id ][ internalKey ]; - // Browsers that fail expando deletion also refuse to delete expandos on // the window, but it will allow it on all other JS objects; other browsers // don't care - if ( jQuery.support.deleteExpando || cache != window ) { + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { delete cache[ id ]; } else { cache[ id ] = null; } - // We destroyed the entire user cache at once because it's faster than - // iterating through each key, but we need to continue to persist internal - // data if it existed - if ( internalCache ) { - cache[ id ] = {}; - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - - cache[ id ][ internalKey ] = internalCache; - - // Otherwise, we need to eliminate the expando on the node to avoid + // We destroyed the cache and need to eliminate the expando on the node to avoid // false lookups in the cache for entries that no longer exist - } else if ( isNode ) { + if ( isNode ) { // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; + delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); + elem.removeAttribute( internalKey ); } else { - elem[ jQuery.expando ] = null; + elem[ internalKey ] = null; } } }, @@ -1537,22 +1863,25 @@ jQuery.extend({ jQuery.fn.extend({ data: function( key, value ) { - var data = null; + var parts, attr, name, + data = null; if ( typeof key === "undefined" ) { if ( this.length ) { data = jQuery.data( this[0] ); - if ( this[0].nodeType === 1 ) { - var attr = this[0].attributes, name; + if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { + attr = this[0].attributes; for ( var i = 0, l = attr.length; i < l; i++ ) { name = attr[i].name; if ( name.indexOf( "data-" ) === 0 ) { - name = name.substr( 5 ); + name = jQuery.camelCase( name.substring(5) ); + dataAttr( this[0], name, data[ name ] ); } } + jQuery._data( this[0], "parsedAttrs", true ); } } @@ -1564,7 +1893,7 @@ jQuery.fn.extend({ }); } - var parts = key.split("."); + parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { @@ -1582,12 +1911,12 @@ jQuery.fn.extend({ } else { return this.each(function() { - var $this = jQuery( this ), + var self = jQuery( this ), args = [ parts[0], value ]; - $this.triggerHandler( "setData" + parts[1] + "!", args ); + self.triggerHandler( "setData" + parts[1] + "!", args ); jQuery.data( this, key, value ); - $this.triggerHandler( "changeData" + parts[1] + "!", args ); + self.triggerHandler( "changeData" + parts[1] + "!", args ); }); } }, @@ -1603,14 +1932,17 @@ function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { - data = elem.getAttribute( "data-" + key ); + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : - !jQuery.isNaN( data ) ? parseFloat( data ) : + jQuery.isNumeric( data ) ? parseFloat( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} @@ -1626,11 +1958,14 @@ function dataAttr( elem, key, data ) { return data; } -// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON -// property to be considered empty objects; this property always exists in -// order to make sure JSON.stringify does not expose internal metadata +// checks a cache object for emptiness function isEmptyDataObject( obj ) { for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } if ( name !== "toJSON" ) { return false; } @@ -1642,35 +1977,78 @@ function isEmptyDataObject( obj ) { +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); } + }, - type = (type || "fx") + "queue"; - var q = jQuery._data( elem, type ); + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } return q || []; } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), - fn = queue.shift(); + fn = queue.shift(), + hooks = {}; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { @@ -1681,16 +2059,18 @@ jQuery.extend({ // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { - queue.unshift("inprogress"); + queue.unshift( "inprogress" ); } - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); } if ( !queue.length ) { - jQuery.removeData( elem, type + "queue", true ); + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); } } }); @@ -1705,7 +2085,7 @@ jQuery.fn.extend({ if ( data === undefined ) { return jQuery.queue( this[0], type ); } - return this.each(function( i ) { + return this.each(function() { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { @@ -1718,23 +2098,54 @@ jQuery.fn.extend({ jQuery.dequeue( this, type ); }); }, - // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; }); }, - clearQueue: function( type ) { return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise(); } }); @@ -1742,66 +2153,67 @@ jQuery.fn.extend({ var rclass = /[\n\t\r]/g, - rspaces = /\s+/, + rspace = /\s+/, rreturn = /\r/g, - rspecialurl = /^(?:href|src|style)$/, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea)?$/i, - rradiocheck = /^(?:radio|checkbox)$/i; - -jQuery.props = { - "for": "htmlFor", - "class": "className", - readonly: "readOnly", - maxlength: "maxLength", - cellspacing: "cellSpacing", - rowspan: "rowSpan", - colspan: "colSpan", - tabindex: "tabIndex", - usemap: "useMap", - frameborder: "frameBorder" -}; + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.attr ); }, - removeAttr: function( name, fn ) { - return this.each(function(){ - jQuery.attr( this, name, "" ); - if ( this.nodeType === 1 ) { - this.removeAttribute( name ); - } + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.prop ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} }); }, addClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.addClass( value.call(this, i, self.attr("class")) ); + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspaces ); + classNames = value.split( rspace ); - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; if ( elem.nodeType === 1 ) { - if ( !elem.className ) { + if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { - var className = " " + elem.className + " ", - setClass = elem.className; + setClass = " " + elem.className + " "; - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - setClass += " " + classNames[c]; + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); @@ -1814,24 +2226,25 @@ jQuery.fn.extend({ }, removeClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.removeClass( value.call(this, i, self.attr("class")) ); + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split( rspaces ); + classNames = ( value || "" ).split( rspace ); - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { - var className = (" " + elem.className + " ").replace(rclass, " "); - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[c] + " ", " "); + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); } elem.className = jQuery.trim( className ); @@ -1850,9 +2263,8 @@ jQuery.fn.extend({ isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this); - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } @@ -1863,7 +2275,7 @@ jQuery.fn.extend({ i = 0, self = jQuery( this ), state = stateVal, - classNames = value.split( rspaces ); + classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list @@ -1884,9 +2296,11 @@ jQuery.fn.extend({ }, hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { return true; } } @@ -1895,82 +2309,42 @@ jQuery.fn.extend({ }, val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + if ( !arguments.length ) { - var elem = this[0]; - if ( elem ) { - if ( jQuery.nodeName( elem, "option" ) ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; } - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - } - - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { - return elem.getAttribute("value") === null ? "on" : elem.value; - } - - // Everything else, we just grab the value - return (elem.value || "").replace(rreturn, ""); + ret = elem.value; + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; } - return undefined; + return; } - var isFunction = jQuery.isFunction(value); + isFunction = jQuery.isFunction( value ); - return this.each(function(i) { - var self = jQuery(this), val = value; + return this.each(function( i ) { + var self = jQuery(this), val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { - val = value.call(this, i, self.val()); + val = value.call( this, i, self.val() ); + } else { + val = value; } // Treat null/undefined as ""; convert numbers to string @@ -1978,27 +2352,16 @@ jQuery.fn.extend({ val = ""; } else if ( typeof val === "number" ) { val += ""; - } else if ( jQuery.isArray(val) ) { - val = jQuery.map(val, function (value) { + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { - this.checked = jQuery.inArray( self.val(), val ) >= 0; + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - } else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(val); - - jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - this.selectedIndex = -1; - } - - } else { + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); @@ -2006,6 +2369,74 @@ jQuery.fn.extend({ }); jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + attrFn: { val: true, css: true, @@ -2018,239 +2449,473 @@ jQuery.extend({ }, attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + // don't get/set attributes on text, comment and attribute nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) { - return undefined; + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; } if ( pass && name in jQuery.attrFn ) { - return jQuery(elem)[name](value); + return jQuery( elem )[ name ]( value ); } - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), - // Whether we are setting (or getting) - set = value !== undefined; + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } - // Try to normalize/fix the name - name = notxml && jQuery.props[ name ] || name; + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - // Only do all the following if this is a node (faster for style) - if ( elem.nodeType === 1 ) { - // These attributes require special treatment - var special = rspecialurl.test( name ); + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } - // Safari mis-reports the default selected property of an option - // Accessing the parent's selectedIndex property fixes it - if ( name === "selected" && !jQuery.support.optSelected ) { - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; + if ( value !== undefined ) { - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; - // If applicable, access the attribute via the DOM 0 way - // 'in' checks fail in Blackberry 4.7 #6931 - if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { - if ( set ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; - if ( value === null ) { - if ( elem.nodeType === 1 ) { - elem.removeAttribute( name ); - } - - } else { - elem[ name ] = value; - } - } - - // browsers index elements by id/name on forms, give priority to attributes. - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { - return elem.getAttributeNode( name ).nodeValue; - } - - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name === "tabIndex" ) { - var attributeNode = elem.getAttributeNode( "tabIndex" ); - - return attributeNode && attributeNode.specified ? - attributeNode.value : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - - return elem[ name ]; - } - - if ( !jQuery.support.style && notxml && name === "style" ) { - if ( set ) { - elem.style.cssText = "" + value; - } - - return elem.style.cssText; - } - - if ( set ) { - // convert the value to a string (all browsers do this but IE) see #1070 + } else { elem.setAttribute( name, "" + value ); + return value; } - // Ensure that missing attributes return undefined - // Blackberry 4.7 returns "" from getAttribute #6938 - if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { - return undefined; - } + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; - var attr = !jQuery.support.hrefNormalized && notxml && special ? - // Some attributes require a special call on IE - elem.getAttribute( name, 2 ) : - elem.getAttribute( name ); + } else { + + ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined - return attr === null ? undefined : attr; + return ret === null ? + undefined : + ret; } - // Handle everything which isn't a DOM element node - if ( set ) { - elem[ name ] = value; + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + + // See #9699 for explanation of this approach (setting first, then removal) + jQuery.attr( elem, name, "" ); + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( rboolean.test( name ) && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } } - return elem[ name ]; } }); +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + -var rnamespaces = /\.(.*)$/, - rformElems = /^(?:textarea|input|select)$/i, - rperiod = /\./g, - rspace = / /g, - rescape = /[^\w\s.|`]/g, - fcleanup = function( nm ) { - return nm.replace(rescape, "\\$&"); +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, + rhoverHack = /\bhover(\.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } - // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6) - // Minor release fix for bug #8018 - try { - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - } - catch ( e ) {} - - if ( handler === false ) { - handler = returnFalse; - } else if ( !handler ) { - // Fixes bug #7229. Fix recommended by jdalton - return; - } - - var handleObjIn, handleObj; - + // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; } - // Make sure that the function being executed has a unique ID + // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } - // Init the element's event structure - var elemData = jQuery._data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events, - eventHandle = elemData.handle; - + // Init the element's event structure and main handler, if this is the first + events = elemData.events; if ( !events ) { elemData.events = events = {}; } - + eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; } - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { - var type, i = 0, namespaces; + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; - } else { - namespaces = []; - handleObj.namespace = ""; - } + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; - handleObj.type = type; - if ( !handleObj.guid ) { - handleObj.guid = handler.guid; - } + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue + // Init the event handler queue if we're the first + handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; + handlers.delegateCount = 0; - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false + // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { @@ -2270,10 +2935,14 @@ jQuery.event = { } } - // Add the function to the element's handler list - handlers.push( handleObj ); + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } - // Keep track of which events have been used, for global triggering + // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } @@ -2284,299 +2953,230 @@ jQuery.event = { global: {}, // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { return; } - if ( handler === false ) { - handler = returnFalse; - } + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; - var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } - continue; } special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - for ( j = pos || 0; j < eventType.length; j++ ) { + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } + if ( handleObj.selector ) { + eventType.delegateCount--; } - - if ( pos != null ) { - break; + if ( special.remove ) { + special.remove.call( elem, handleObj ); } } } - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } - ret = null; delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; + handle = elemData.handle; if ( handle ) { handle.elem = null; } - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem, undefined, true ); - } + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); } }, - // bubbling is internal - trigger: function( event, data, elem /*, bubbling */ ) { + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + // Event object or event type var type = event.type || event, - bubbling = arguments[3]; + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - if ( !bubbling ) { - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - jQuery.extend( jQuery.Event(type), event ) : - // Just the event type (string) - jQuery.Event(type); + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } - if ( type.indexOf("!") >= 0 ) { - event.type = type = type.slice(0, -1); - event.exclusive = true; - } + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } - // Handle a global trigger - if ( !elem ) { - // Don't bubble custom events when global (to avoid too much overhead) - event.stopPropagation(); + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } - // Only trigger if we've ever bound an event for it - if ( jQuery.event.global[ type ] ) { - // XXX This code smells terrible. event.js should not be directly - // inspecting the data cache - jQuery.each( jQuery.cache, function() { - // internalKey variable is just used to make it easier to find - // and potentially change this stuff later; currently it just - // points to jQuery.expando - var internalKey = jQuery.expando, - internalCache = this[ internalKey ]; - if ( internalCache && internalCache.events && internalCache.events[ type ] ) { - jQuery.event.trigger( event, data, internalCache.handle.elem ); - } - }); + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } + return; + } - // Handle triggering a single element - - // don't do events on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // Clean up in case it is reused - event.result = undefined; + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { event.target = elem; - - // Clone the incoming data, if any - data = jQuery.makeArray( data ); - data.unshift( event ); } - event.currentTarget = elem; + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); - // Trigger the event, it is assumed that "handle" is a function - var handle = jQuery._data( elem, "handle" ); - - if ( handle ) { - handle.apply( elem, data ); + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; } - var parent = elem.parentNode || elem.ownerDocument; + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - // Trigger an inline bound script - try { - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { - event.result = false; - event.preventDefault(); - } + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; } - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (inlineError) {} - - if ( !event.isPropagationStopped() && parent ) { - jQuery.event.trigger( event, data, parent, true ); - - } else if ( !event.isDefaultPrevented() ) { - var old, - target = event.target, - targetType = type.replace( rnamespaces, "" ), - isClick = jQuery.nodeName( target, "a" ) && targetType === "click", - special = jQuery.event.special[ targetType ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { - - try { - if ( target[ targetType ] ) { - // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + targetType ]; - - if ( old ) { - target[ "on" + targetType ] = null; - } - - jQuery.event.triggered = event.type; - target[ targetType ](); - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (triggerError) {} - - if ( old ) { - target[ "on" + targetType ] = old; - } - - jQuery.event.triggered = undefined; + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } - }, - handle: function( event ) { - var all, handlers, namespaces, namespace_re, events, - namespace_sort = [], - args = jQuery.makeArray( arguments ); + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - event = args[0] = jQuery.event.fix( event || window.event ); - event.currentTarget = this; + cur = eventPath[i][0]; + event.type = eventPath[i][1]; - // Namespaced event handlers - all = event.type.indexOf(".") < 0 && !event.exclusive; - - if ( !all ) { - namespaces = event.type.split("."); - event.type = namespaces.shift(); - namespace_sort = namespaces.slice(0).sort(); - namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } } + event.type = type; - event.namespace = event.namespace || namespace_sort.join("."); + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { - events = jQuery._data(this, "events"); + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - handlers = (events || {})[ event.type ]; + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - if ( events && handlers ) { - // Clone the handlers to prevent manipulation - handlers = handlers.slice(0); + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Filter the functions by class - if ( all || namespace_re.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } + if ( old ) { + elem[ ontype ] = null; } - if ( event.isImmediatePropagationStopped() ) { - break; + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; } } } @@ -2585,90 +3185,193 @@ jQuery.event = { return event.result; }, - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Determine handlers that should run if there are delegated events + // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + event = jQuery.Event( originalEvent ); - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; + for ( i = copy.length; i; ) { + prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } - // Fix target property, if necessary + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { - // Fixes #1925 where srcElement might not be defined either - event.target = event.srcElement || document; + event.target = originalEvent.srcElement || document; } - // check if target is a textnode (safari) + // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, - body = document.body; - - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { - event.which = event.charCode != null ? event.charCode : event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { event.metaKey = event.ctrlKey; } - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - special: { ready: { // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop + setup: jQuery.bindReady }, - live: { - add: function( handleObj ) { - jQuery.event.add( this, - liveConvert( handleObj.origType, handleObj.selector ), - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); - }, + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, - remove: function( handleObj ) { - jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); - } + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" }, beforeunload: { @@ -2685,9 +3388,35 @@ jQuery.event = { } } } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } } }; +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { @@ -2700,10 +3429,10 @@ jQuery.removeEvent = document.removeEventListener ? } }; -jQuery.Event = function( src ) { +jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src ); + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); } // Event object @@ -2713,17 +3442,21 @@ jQuery.Event = function( src ) { // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = jQuery.now(); + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; @@ -2779,229 +3512,142 @@ jQuery.Event.prototype = { isImmediatePropagationStopped: returnFalse }; -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - - // Firefox sometimes assigns relatedTarget a XUL element - // which we cannot access the parentNode property of - try { - - // Chrome does something similar, the parentNode property - // can be accessed but is null. - if ( parent && parent !== document && !parent.parentNode ) { - return; - } - // Traverse up the tree - while ( parent && parent !== this ) { - parent = parent.parentNode; - } - - if ( parent !== this ) { - // set the correct event type - event.type = event.data; - - // handle event if we actually just moused on to a non sub-element - jQuery.event.handle.apply( this, arguments ); - } - - // assuming we've left the element since we most likely mousedover a xul element - } catch(e) { } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events +// Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; } }; }); -// submit delegation +// IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, - type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, - type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - trigger( "submit", this, arguments ); - } - }); - - } else { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { return false; } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener }, - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); } }; - } -// change delegation, happens here so we have bind. +// IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { - var changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( elem.nodeName.toLowerCase() === "select" ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery._data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery._data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - e.liveFired = undefined; - jQuery.event.trigger( e, arguments[1], elem ); - } - }; - jQuery.event.special.change = { - filters: { - focusout: testChange, - beforedeactivate: testChange, + setup: function() { - click: function( e ) { - var elem = e.target, type = elem.type; - - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { - testChange.call( this, e ); + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = elem.type; - - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information - beforeactivate: function( e ) { - var elem = e.target; - jQuery._data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { return false; } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return rformElems.test( this.nodeName ); + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); }, - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); return rformElems.test( this.nodeName ); } }; - - changeFilters = jQuery.event.special.change.filters; - - // Handle when the input is .focus()'d - changeFilters.focus = changeFilters.beforeactivate; -} - -function trigger( type, elem, args ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - // Don't pass args or remember liveFired; they apply to the donor event. - var event = jQuery.extend( {}, args[ 0 ] ); - event.type = type; - event.originalEvent = {}; - event.liveFired = undefined; - jQuery.event.handle.call( elem, event ); - if ( event.isDefaultPrevented() ) { - args[ 0 ].preventDefault(); - } } // Create "bubbling" focus and blur events -if ( document.addEventListener ) { +if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - + // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0; - + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { @@ -3014,82 +3660,120 @@ if ( document.addEventListener ) { } } }; - - function handler( donor ) { - // Donor event is always a native one; fix it and switch its type. - // Let focusin/out handler cancel the donor focus/blur event. - var e = jQuery.event.fix( donor ); - e.type = fix; - e.originalEvent = {}; - jQuery.event.trigger( e, null, e.target ); - if ( e.isDefaultPrevented() ) { - donor.preventDefault(); - } - } }); } -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); } return this; } - if ( jQuery.isFunction( data ) || data === false ) { - fn = data; - data = undefined; - } - - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }) : fn; - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; } } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on.call( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); + return this.on( types, selector, data, fn ); }, - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); }, trigger: function( type, data ) { @@ -3097,38 +3781,36 @@ jQuery.fn.extend({ jQuery.event.trigger( type, data, this ); }); }, - triggerHandler: function( type, data ) { if ( this[0] ) { - var event = jQuery.Event( type ); - event.preventDefault(); - event.stopPropagation(); - jQuery.event.trigger( event, data, this[0] ); - return event.result; + return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, - i = 1; + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; while ( i < args.length ) { - jQuery.proxy( fn, args[ i++ ] ); + args[ i++ ].guid = guid; } - return this.click( jQuery.proxy( fn, function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - })); + return this.click( toggler ); }, hover: function( fnOver, fnOut ) { @@ -3136,165 +3818,9 @@ jQuery.fn.extend({ } }); -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( typeof types === "object" && !types.preventDefault ) { - for ( var key in types ) { - context[ name ]( key, data, types[key], selector ); - } - - return this; - } - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( type === "focus" || type === "blur" ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - for ( var j = 0, l = context.length; j < l; j++ ) { - jQuery.event.add( context[j], "live." + liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - } - - } else { - // unbind live handler - context.unbind( "live." + liveConvert( type, selector ), fn ); - } - } - - return this; - }; -}); - -function liveHandler( event ) { - var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, - elems = [], - selectors = [], - events = jQuery._data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) - if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { - return; - } - - if ( event.namespace ) { - namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - close = match[i]; - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { - elem = close.elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - event.type = handleObj.preType; - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj, level: close.level }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - - if ( maxLevel && match.level > maxLevel ) { - break; - } - - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - ret = match.handleObj.origHandler.apply( match.elem, arguments ); - - if ( ret === false || event.isPropagationStopped() ) { - maxLevel = match.level; - - if ( ret === false ) { - stop = false; - } - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); -} - jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { @@ -3304,16 +3830,25 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl } return arguments.length > 0 ? - this.bind( name, data, fn ) : + this.on( name, null, data, fn ) : this.trigger( name ); }; if ( jQuery.attrFn ) { jQuery.attrFn[ name ] = true; } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } }); + /*! * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation @@ -3323,11 +3858,13 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true, rBackslash = /\\/g, + rReturn = /\r\n/g, rNonWord = /\W/; // Here we check if the JavaScript engine is using some sort of @@ -3379,7 +3916,7 @@ var Sizzle = function( selector, context, results, seed ) { if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); + set = posProcess( parts[0] + parts[1], context, seed ); } else { set = Expr.relative[ parts[0] ] ? @@ -3393,7 +3930,7 @@ var Sizzle = function( selector, context, results, seed ) { selector += parts.shift(); } - set = posProcess( selector, set ); + set = posProcess( selector, set, seed ); } } @@ -3512,18 +4049,17 @@ Sizzle.matchesSelector = function( node, expr ) { }; Sizzle.find = function( expr, context, isXML ) { - var set; + var set, i, len, match, type, left; if ( !expr ) { return []; } - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var match, - type = Expr.order[i]; + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; + left = match[1]; match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { @@ -3549,17 +4085,18 @@ Sizzle.find = function( expr, context, isXML ) { Sizzle.filter = function( expr, set, inplace, not ) { var match, anyFound, + type, found, item, filter, left, + i, pass, old = expr, result = [], curLoop = set, isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); while ( expr && set.length ) { - for ( var type in Expr.filter ) { + for ( type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var found, item, - filter = Expr.filter[ type ], - left = match[1]; + filter = Expr.filter[ type ]; + left = match[1]; anyFound = false; @@ -3585,10 +4122,10 @@ Sizzle.filter = function( expr, set, inplace, not ) { } if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + for ( i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; + pass = not ^ found; if ( inplace && found != null ) { if ( pass ) { @@ -3639,7 +4176,46 @@ Sizzle.filter = function( expr, set, inplace, not ) { }; Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; }; var Expr = Sizzle.selectors = { @@ -3941,42 +4517,50 @@ var Expr = Sizzle.selectors = { var attr = elem.getAttribute( "type" ), type = elem.type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case - return "text" === type && ( attr === type || attr === null ); + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); }, radio: function( elem ) { - return "radio" === elem.type; + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; }, checkbox: function( elem ) { - return "checkbox" === elem.type; + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; }, file: function( elem ) { - return "file" === elem.type; + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; }, + password: function( elem ) { - return "password" === elem.type; + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; }, submit: function( elem ) { - return "submit" === elem.type; + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; }, image: function( elem ) { - return "image" === elem.type; + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; }, reset: function( elem ) { - return "reset" === elem.type; + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; }, button: function( elem ) { - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; }, input: function( elem ) { return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; } }, setFilters: { @@ -4021,7 +4605,7 @@ var Expr = Sizzle.selectors = { return filter( elem, i, match, array ); } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; @@ -4040,7 +4624,10 @@ var Expr = Sizzle.selectors = { }, CHILD: function( elem, match ) { - var type = match[1], + var first, last, + doneName, parent, cache, + count, diff, + type = match[1], node = elem; switch ( type ) { @@ -4068,18 +4655,18 @@ var Expr = Sizzle.selectors = { return true; case "nth": - var first = match[2], - last = match[3]; + first = match[2]; + last = match[3]; if ( first === 1 && last === 0 ) { return true; } - var doneName = match[0], - parent = elem.parentNode; + doneName = match[0]; + parent = elem.parentNode; - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { @@ -4087,10 +4674,10 @@ var Expr = Sizzle.selectors = { } } - parent.sizcache = doneName; + parent[ expando ] = doneName; } - var diff = elem.nodeIndex - last; + diff = elem.nodeIndex - last; if ( first === 0 ) { return diff === 0; @@ -4106,7 +4693,7 @@ var Expr = Sizzle.selectors = { }, TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; }, CLASS: function( elem, match ) { @@ -4116,7 +4703,9 @@ var Expr = Sizzle.selectors = { ATTR: function( elem, match ) { var name = match[1], - result = Expr.attrHandle[ name ] ? + result = Sizzle.attr ? + Sizzle.attr( elem, name ) : + Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : @@ -4127,6 +4716,8 @@ var Expr = Sizzle.selectors = { return result == null ? type === "!=" : + !type && Sizzle.attr ? + result != null : type === "=" ? value === check : type === "*=" ? @@ -4229,6 +4820,16 @@ if ( document.documentElement.compareDocumentPosition ) { } else { sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + var al, bl, ap = [], bp = [], @@ -4236,13 +4837,8 @@ if ( document.documentElement.compareDocumentPosition ) { bup = b.parentNode, cur = aup; - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - // If the nodes are siblings (or identical) we can do a quick check - } else if ( aup === bup ) { + if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected @@ -4302,26 +4898,6 @@ if ( document.documentElement.compareDocumentPosition ) { }; } -// Utility function for retreiving the text value of an array of DOM nodes -Sizzle.getText = function( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += Sizzle.getText( elem.childNodes ); - } - } - - return ret; -}; - // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ @@ -4599,13 +5175,13 @@ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { elem = elem[dir]; while ( elem ) { - if ( elem.sizcache === doneName ) { + if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; + elem[ expando ] = doneName; elem.sizset = i; } @@ -4632,14 +5208,14 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { elem = elem[dir]; while ( elem ) { - if ( elem.sizcache === doneName ) { + if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { - elem.sizcache = doneName; + elem[ expando ] = doneName; elem.sizset = i; } @@ -4687,7 +5263,7 @@ Sizzle.isXML = function( elem ) { return documentElement ? documentElement.nodeName !== "HTML" : false; }; -var posProcess = function( selector, context ) { +var posProcess = function( selector, context, seed ) { var match, tmpSet = [], later = "", @@ -4703,13 +5279,16 @@ var posProcess = function( selector, context ) { selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); + Sizzle( selector, root[i], tmpSet, seed ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; @@ -4739,17 +5318,30 @@ var runtil = /Until$/, jQuery.fn.extend({ find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), - length = 0; + var self = this, + i, l; - for ( var i = 0, l = this.length; i < l; i++ ) { + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique - for ( var n = length; n < ret.length; n++ ) { - for ( var r = 0; r < length; r++ ) { + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; @@ -4782,47 +5374,42 @@ jQuery.fn.extend({ }, is: function( selector ) { - return !!selector && jQuery.filter( selector, this ).length > 0; + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var ret = [], i, l, cur = this[0]; - + + // Array (deprecated as of jQuery 1.7) if ( jQuery.isArray( selectors ) ) { - var match, selector, - matches = {}, - level = 1; + var level = 1; - if ( cur && selectors.length ) { - for ( i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { - if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); } } - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[selector]; - - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } + cur = cur.parentNode; + level++; } return ret; } - var pos = POS.test( selectors ) ? - jQuery( selectors, context || this.context ) : null; + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; for ( i = 0, l = this.length; i < l; i++ ) { cur = this[i]; @@ -4834,14 +5421,14 @@ jQuery.fn.extend({ } else { cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context ) { + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { break; } } } } - ret = ret.length > 1 ? jQuery.unique(ret) : ret; + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, @@ -4849,12 +5436,17 @@ jQuery.fn.extend({ // Determine the position of an element within // the matched set of elements index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used @@ -4864,7 +5456,7 @@ jQuery.fn.extend({ add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : - jQuery.makeArray( selector ), + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? @@ -4925,12 +5517,7 @@ jQuery.each({ } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ), - // The variable 'args' was introduced in - // https://github.com/jquery/jquery/commit/52a0238 - // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. - // http://code.google.com/p/v8/issues/detail?id=1050 - args = slice.call(arguments); + var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; @@ -4946,7 +5533,7 @@ jQuery.each({ ret = ret.reverse(); } - return this.pushStack( ret, name, args.join(",") ); + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); }; }); @@ -5002,6 +5589,11 @@ jQuery.extend({ // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); @@ -5010,7 +5602,7 @@ function winnow( elements, qualifier, keep ) { } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; + return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { @@ -5026,22 +5618,42 @@ function winnow( elements, qualifier, keep ) { } return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /", "" ], legend: [ 1, "
      ", "
      " ], @@ -5051,7 +5663,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, col: [ 2, "", "
      " ], area: [ 1, "", "" ], _default: [ 0, "", "" ] - }; + }, + safeFragment = createSafeFragment( document ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; @@ -5102,7 +5715,7 @@ jQuery.fn.extend({ } return elem; - }).append(this); + }).append( this ); } return this; @@ -5129,8 +5742,10 @@ jQuery.fn.extend({ }, wrap: function( html ) { - return this.each(function() { - jQuery( this ).wrapAll( html ); + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, @@ -5164,7 +5779,7 @@ jQuery.fn.extend({ this.parentNode.insertBefore( elem, this ); }); } else if ( arguments.length ) { - var set = jQuery(arguments[0]); + var set = jQuery.clean( arguments ); set.push.apply( set, this.toArray() ); return this.pushStack( set, "before", arguments ); } @@ -5177,7 +5792,7 @@ jQuery.fn.extend({ }); } else if ( arguments.length ) { var set = this.pushStack( this, "after", arguments ); - set.push.apply( set, jQuery(arguments[0]).toArray() ); + set.push.apply( set, jQuery.clean(arguments) ); return set; } }, @@ -5232,7 +5847,7 @@ jQuery.fn.extend({ null; // See if we can take a shortcut and just use innerHTML - } else if ( typeof value === "string" && !rnocache.test( value ) && + } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) && (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { @@ -5358,7 +5973,7 @@ jQuery.fn.extend({ // in certain situations (Bug #8070). // Fragments from the fragment cache must always be cloned and never used // in place. - results.cacheable || (l > 1 && i < lastIndex) ? + results.cacheable || ( l > 1 && i < lastIndex ) ? jQuery.clone( fragment, true, true ) : fragment ); @@ -5387,44 +6002,49 @@ function cloneCopyEvent( src, dest ) { return; } - var internalKey = jQuery.expando, - oldData = jQuery.data( src ), - curData = jQuery.data( dest, oldData ); + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; - // Switch to use the internal data object, if it exists, for the next - // stage of data copying - if ( (oldData = oldData[ internalKey ]) ) { - var events = oldData.events; - curData = curData[ internalKey ] = jQuery.extend({}, oldData); + if ( events ) { + delete curData.handle; + curData.events = {}; - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( var type in events ) { - for ( var i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); - } + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); } } } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } } -function cloneFixAttributes(src, dest) { +function cloneFixAttributes( src, dest ) { + var nodeName; + // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } - var nodeName = dest.nodeName.toLowerCase(); - // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want - dest.clearAttributes(); + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events - dest.mergeAttributes(src); + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); // IE6-8 fail to clone children inside object elements that use // the proprietary classid attribute value (rather than the type @@ -5463,22 +6083,38 @@ function cloneFixAttributes(src, dest) { } jQuery.buildFragment = function( args, nodes, scripts ) { - var fragment, cacheable, cacheresults, - doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); + var fragment, cacheable, cacheresults, doc, + first = args[ 0 ]; + + // nodes may contain either an explicit document object, + // a jQuery collection or context object. + // If nodes[0] contains a valid object to assign to doc + if ( nodes && nodes[0] ) { + doc = nodes[0].ownerDocument || nodes[0]; + } + + // Ensure that an attr object doesn't incorrectly stand in as a document object + // Chrome and Firefox seem to allow this to occur and will throw exception + // Fixes #8950 + if ( !doc.createDocumentFragment ) { + doc = document; + } // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put or elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && - args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { cacheable = true; - cacheresults = jQuery.fragments[ args[0] ]; - if ( cacheresults ) { - if ( cacheresults !== 1 ) { - fragment = cacheresults; - } + + cacheresults = jQuery.fragments[ first ]; + if ( cacheresults && cacheresults !== 1 ) { + fragment = cacheresults; } } @@ -5488,7 +6124,7 @@ jQuery.buildFragment = function( args, nodes, scripts ) { } if ( cacheable ) { - jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; + jQuery.fragments[ first ] = cacheresults ? fragment : 1; } return { fragment: fragment, cacheable: cacheable }; @@ -5514,7 +6150,7 @@ jQuery.each({ } else { for ( var i = 0, l = insert.length; i < l; i++ ) { - var elems = (i > 0 ? this.clone(true) : this).get(); + var elems = ( i > 0 ? this.clone(true) : this ).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } @@ -5525,10 +6161,10 @@ jQuery.each({ }); function getAll( elem ) { - if ( "getElementsByTagName" in elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { return elem.getElementsByTagName( "*" ); - - } else if ( "querySelectorAll" in elem ) { + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { return elem.querySelectorAll( "*" ); } else { @@ -5536,12 +6172,41 @@ function getAll( elem ) { } } +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( elem.type === "checkbox" || elem.type === "radio" ) { + elem.defaultChecked = elem.checked; + } +} +// Finds all inputs and passes them to fixDefaultChecked +function findInputs( elem ) { + var nodeName = ( elem.nodeName || "" ).toLowerCase(); + if ( nodeName === "input" ) { + fixDefaultChecked( elem ); + // Skip scripts, get other children + } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } +} + +// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js +function shimCloneNode( elem ) { + var div = document.createElement( "div" ); + safeFragment.appendChild( div ); + + div.innerHTML = elem.outerHTML; + return div.firstChild; +} + jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var clone = elem.cloneNode(true), - srcElements, - destElements, - i; + var srcElements, + destElements, + i, + // IE<=8 does not properly clone detached, unknown element nodes + clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ? + elem.cloneNode( true ) : + shimCloneNode( elem ); if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { @@ -5553,8 +6218,7 @@ jQuery.extend({ cloneFixAttributes( elem, clone ); - // Using Sizzle here is crazy slow, so we use getElementsByTagName - // instead + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll( elem ); destElements = getAll( clone ); @@ -5562,7 +6226,10 @@ jQuery.extend({ // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { - cloneFixAttributes( srcElements[i], destElements[i] ); + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } } } @@ -5580,10 +6247,15 @@ jQuery.extend({ } } + srcElements = destElements = null; + // Return the cloned set return clone; -}, + }, + clean: function( elems, context, fragment, scripts ) { + var checkScriptType; + context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' @@ -5591,7 +6263,7 @@ jQuery.extend({ context = context.ownerDocument || context[0] && context[0].ownerDocument || document; } - var ret = []; + var ret = [], j; for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { @@ -5603,54 +6275,76 @@ jQuery.extend({ } // Convert html string into DOM nodes - if ( typeof elem === "string" && !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1>"); - } else if ( typeof elem === "string" ) { - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, "<$1>"); + // Trim whitespace, otherwise indexOf won't work as expected + var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), + wrap = wrapMap[ tag ] || wrapMap._default, + depth = wrap[0], + div = context.createElement("div"); - // Trim whitespace, otherwise indexOf won't work as expected - var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), - wrap = wrapMap[ tag ] || wrapMap._default, - depth = wrap[0], - div = context.createElement("div"); + // Append wrapper element to unknown element safe doc fragment + if ( context === document ) { + // Use the fragment we've already created for this document + safeFragment.appendChild( div ); + } else { + // Use a fragment created with the owner document + createSafeFragment( context ).appendChild( div ); + } - // Go to html and back, then peel off extra wrappers - div.innerHTML = wrap[1] + elem + wrap[2]; + // Go to html and back, then peel off extra wrappers + div.innerHTML = wrap[1] + elem + wrap[2]; - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { - // String was a , *may* have spurious - var hasBody = rtbody.test(elem), - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : + // String was a
      , *may* have spurious + var hasBody = rtbody.test(elem), + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : - // String was a bare or - wrap[1] === "
      " && !hasBody ? - div.childNodes : - []; + // String was a bare or + wrap[1] === "
      " && !hasBody ? + div.childNodes : + []; - for ( var j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } } } - } + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + elem = div.childNodes; } + } - elem = div.childNodes; + // Resets defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + var len; + if ( !jQuery.support.appendChecked ) { + if ( elem[0] && typeof (len = elem.length) === "number" ) { + for ( j = 0; j < len; j++ ) { + findInputs( elem[j] ); + } + } else { + findInputs( elem ); + } } if ( elem.nodeType ) { @@ -5661,13 +6355,18 @@ jQuery.extend({ } if ( fragment ) { + checkScriptType = function( elem ) { + return !elem.type || rscriptType.test( elem.type ); + }; for ( i = 0; ret[i]; i++ ) { if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); } else { if ( ret[i].nodeType === 1 ) { - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); + var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType ); + + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); } fragment.appendChild( ret[i] ); } @@ -5678,7 +6377,9 @@ jQuery.extend({ }, cleanData: function( elems ) { - var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special, + var data, id, + cache = jQuery.cache, + special = jQuery.event.special, deleteExpando = jQuery.support.deleteExpando; for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { @@ -5689,7 +6390,7 @@ jQuery.extend({ id = elem[ jQuery.expando ]; if ( id ) { - data = cache[ id ] && cache[ id ][ internalKey ]; + data = cache[ id ]; if ( data && data.events ) { for ( var type in data.events ) { @@ -5729,7 +6430,7 @@ function evalScript( i, elem ) { dataType: "script" }); } else { - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); } if ( elem.parentNode ) { @@ -5742,11 +6443,11 @@ function evalScript( i, elem ) { var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, - rdashAlpha = /-([a-z])/ig, // fixed for IE9, see #8346 rupper = /([A-Z]|^ms)/g, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, + rrelNum = /^([\-+])=([\-+.\de]+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssWidth = [ "Left", "Right" ], @@ -5754,11 +6455,7 @@ var ralpha = /alpha\([^)]*\)/i, curCSS, getComputedStyle, - currentStyle, - - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; + currentStyle; jQuery.fn.css = function( name, value ) { // Setting 'undefined' is a no-op @@ -5793,11 +6490,14 @@ jQuery.extend({ // Exclude the following css properties to add px cssNumber: { - "zIndex": true, + "fillOpacity": true, "fontWeight": true, + "lineHeight": true, "opacity": true, - "zoom": true, - "lineHeight": true + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true }, // Add in properties whose names you wish to fix before @@ -5815,20 +6515,29 @@ jQuery.extend({ } // Make sure that we're working with the right name - var ret, origName = jQuery.camelCase( name ), + var ret, type, origName = jQuery.camelCase( name ), style = elem.style, hooks = jQuery.cssHooks[ origName ]; name = jQuery.cssProps[ origName ] || origName; // Check if we're setting a value if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + // Make sure that NaN and null values aren't set. See: #7116 - if ( typeof value === "number" && isNaN( value ) || value == null ) { + if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } @@ -5853,11 +6562,17 @@ jQuery.extend({ }, css: function( elem, name, extra ) { - // Make sure that we're working with the right name - var ret, origName = jQuery.camelCase( name ), - hooks = jQuery.cssHooks[ origName ]; + var ret, hooks; - name = jQuery.cssProps[ origName ] || origName; + // Make sure that we're working with the right name + name = jQuery.camelCase( name ); + hooks = jQuery.cssHooks[ name ]; + name = jQuery.cssProps[ name ] || name; + + // cssFloat needs a special treatment + if ( name === "cssFloat" ) { + name = "float"; + } // If a hook was provided get the computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { @@ -5865,7 +6580,7 @@ jQuery.extend({ // Otherwise, if a way to get the computed value exists, use that } else if ( curCSS ) { - return curCSS( elem, name, origName ); + return curCSS( elem, name ); } }, @@ -5885,10 +6600,6 @@ jQuery.extend({ for ( name in options ) { elem.style[ name ] = old[ name ]; } - }, - - camelCase: function( string ) { - return string.replace( rdashAlpha, fcamelCase ); } }); @@ -5902,44 +6613,21 @@ jQuery.each(["height", "width"], function( i, name ) { if ( computed ) { if ( elem.offsetWidth !== 0 ) { - val = getWH( elem, name, extra ); - + return getWH( elem, name, extra ); } else { jQuery.swap( elem, cssShow, function() { val = getWH( elem, name, extra ); }); } - if ( val <= 0 ) { - val = curCSS( elem, name, name ); - - if ( val === "0px" && currentStyle ) { - val = currentStyle( elem, name, name ); - } - - if ( val != null ) { - // Should return "auto" instead of 0, use 0 for - // temporary backwards-compat - return val === "" || val === "auto" ? "0px" : val; - } - } - - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - - // Should return "auto" instead of 0, use 0 for - // temporary backwards-compat - return val === "" || val === "auto" ? "0px" : val; - } - - return typeof val === "string" ? val : val + "px"; + return val; } }, set: function( elem, value ) { if ( rnumpx.test( value ) ) { // ignore negative width and height values #1599 - value = parseFloat(value); + value = parseFloat( value ); if ( value >= 0 ) { return value + "px"; @@ -5956,27 +6644,39 @@ if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity - return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? - (parseFloat(RegExp.$1) / 100) + "" : + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( parseFloat( RegExp.$1 ) / 100 ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { - var style = elem.style; + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; - // Set the alpha filter to set the opacity - var opacity = jQuery.isNaN(value) ? - "" : - "alpha(opacity=" + value * 100 + ")", - filter = style.filter || ""; + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { - style.filter = ralpha.test(filter) ? - filter.replace(ralpha, opacity) : - style.filter + ' ' + opacity; + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; } }; } @@ -6004,16 +6704,13 @@ jQuery(function() { }); if ( document.defaultView && document.defaultView.getComputedStyle ) { - getComputedStyle = function( elem, newName, name ) { + getComputedStyle = function( elem, name ) { var ret, defaultView, computedStyle; name = name.replace( rupper, "-$1" ).toLowerCase(); - if ( !(defaultView = elem.ownerDocument.defaultView) ) { - return undefined; - } - - if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) { + if ( (defaultView = elem.ownerDocument.defaultView) && + (computedStyle = defaultView.getComputedStyle( elem, null )) ) { ret = computedStyle.getPropertyValue( name ); if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { ret = jQuery.style( elem, name ); @@ -6026,25 +6723,32 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) { if ( document.documentElement.currentStyle ) { currentStyle = function( elem, name ) { - var left, + var left, rsLeft, uncomputed, ret = elem.currentStyle && elem.currentStyle[ name ], - rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], style = elem.style; + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret === null && style && (uncomputed = style[ name ]) ) { + ret = uncomputed; + } + // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { + // Remember the original values left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } - style.left = name === "fontSize" ? "1em" : (ret || 0); + style.left = name === "fontSize" ? "1em" : ( ret || 0 ); ret = style.pixelLeft + "px"; // Revert the changed values @@ -6061,27 +6765,52 @@ if ( document.documentElement.currentStyle ) { curCSS = getComputedStyle || currentStyle; function getWH( elem, name, extra ) { - var which = name === "width" ? cssWidth : cssHeight, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight; - if ( extra === "border" ) { - return val; + // Start with offset property + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + which = name === "width" ? cssWidth : cssHeight, + i = 0, + len = which.length; + + if ( val > 0 ) { + if ( extra !== "border" ) { + for ( ; i < len; i++ ) { + if ( !extra ) { + val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; + } else { + val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; + } + } + } + + return val + "px"; } - jQuery.each( which, function() { - if ( !extra ) { - val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0; + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ] || 0; + } + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Add padding, border, margin + if ( extra ) { + for ( ; i < len; i++ ) { + val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; + if ( extra !== "padding" ) { + val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; + } } + } - if ( extra === "margin" ) { - val += parseFloat(jQuery.css( elem, "margin" + this )) || 0; - - } else { - val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0; - } - }); - - return val; + return val + "px"; } if ( jQuery.expr && jQuery.expr.filters ) { @@ -6089,7 +6818,7 @@ if ( jQuery.expr && jQuery.expr.filters ) { var width = elem.offsetWidth, height = elem.offsetHeight; - return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none"); + return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { @@ -6105,9 +6834,9 @@ var r20 = /%20/g, rCRLF = /\r?\n/g, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, @@ -6115,10 +6844,6 @@ var r20 = /%20/g, rselectTextarea = /^(?:select|textarea)/i, rspacesAjax = /\s+/, rts = /([?&])_=[^&]*/, - rucHeaders = /(^|\-)([a-z])/g, - rucHeadersFunc = function( _, $1, $2 ) { - return $1 + $2.toUpperCase(); - }, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, // Keep a copy of the old load method @@ -6146,12 +6871,15 @@ var r20 = /%20/g, ajaxLocation, // Document location segments - ajaxLocParts; + ajaxLocParts, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing -// a field from document.location if document.domain has been set +// a field from window.location if document.domain has been set try { - ajaxLocation = document.location.href; + ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location @@ -6183,7 +6911,7 @@ function addToPrefiltersOrTransports( structure ) { placeBefore; // For each dataType in the dataTypeExpression - for(; i < length; i++ ) { + for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element @@ -6199,7 +6927,7 @@ function addToPrefiltersOrTransports( structure ) { }; } -//Base inspection function for prefilters and transports +// Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { @@ -6214,7 +6942,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX executeOnly = ( structure === prefilters ), selection; - for(; i < length && ( executeOnly || !selection ); i++ ) { + for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already @@ -6239,6 +6967,22 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX return selection; } +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + jQuery.fn.extend({ load: function( url, params, callback ) { if ( typeof url !== "string" && _load ) { @@ -6346,9 +7090,9 @@ jQuery.fn.extend({ // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ - return this.bind( o, f ); + return this.on( o, f ); }; -} ); +}); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { @@ -6367,7 +7111,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) { dataType: type }); }; -} ); +}); jQuery.extend({ @@ -6382,23 +7126,16 @@ jQuery.extend({ // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. - ajaxSetup: function ( target, settings ) { - if ( !settings ) { - // Only one parameter, we extend ajaxSettings - settings = target; - target = jQuery.extend( true, jQuery.ajaxSettings, settings ); + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); } else { - // target was provided, we extend into it - jQuery.extend( true, target, jQuery.ajaxSettings, settings ); - } - // Flatten fields we don't want deep extended - for( var field in { context: 1, url: 1 } ) { - if ( field in settings ) { - target[ field ] = settings[ field ]; - } else if( field in jQuery.ajaxSettings ) { - target[ field ] = jQuery.ajaxSettings[ field ]; - } + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; } + ajaxExtend( target, settings ); return target; }, @@ -6426,7 +7163,7 @@ jQuery.extend({ html: "text/html", text: "text/plain", json: "application/json, text/javascript", - "*": "*/*" + "*": allTypes }, contents: { @@ -6456,6 +7193,15 @@ jQuery.extend({ // Parse text as xml "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true } }, @@ -6486,13 +7232,14 @@ jQuery.extend({ jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), - completeDeferred = jQuery._Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // ifModified key ifModifiedKey, // Headers (they are sent all at once) requestHeaders = {}, + requestHeadersNames = {}, // Response headers responseHeadersString, responseHeaders, @@ -6516,7 +7263,9 @@ jQuery.extend({ // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { - requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value; + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; } return this; }, @@ -6563,7 +7312,7 @@ jQuery.extend({ // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) - function done( status, statusText, responses, headers ) { + function done( status, nativeStatusText, responses, headers ) { // Called once if ( state === 2 ) { @@ -6586,11 +7335,12 @@ jQuery.extend({ responseHeadersString = headers || ""; // Set readyState - jqXHR.readyState = status ? 4 : 0; + jqXHR.readyState = status > 0 ? 4 : 0; var isSuccess, success, error, + statusText = nativeStatusText, response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, lastModified, etag; @@ -6632,7 +7382,7 @@ jQuery.extend({ // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; - if( !statusText || status ) { + if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; @@ -6642,7 +7392,7 @@ jQuery.extend({ // Set data for the fake xhr object jqXHR.status = status; - jqXHR.statusText = statusText; + jqXHR.statusText = "" + ( nativeStatusText || statusText ); // Success/Error if ( isSuccess ) { @@ -6661,10 +7411,10 @@ jQuery.extend({ } // Complete - completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] ); + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] ); + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); @@ -6676,14 +7426,14 @@ jQuery.extend({ deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.done; + jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { - for( tmp in map ) { + for ( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { @@ -6745,6 +7495,8 @@ jQuery.extend({ // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter @@ -6758,30 +7510,33 @@ jQuery.extend({ ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end - s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - requestHeaders[ "Content-Type" ] = s.contentType; + jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { ifModifiedKey = ifModifiedKey || s.url; if ( jQuery.lastModified[ ifModifiedKey ] ) { - requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ]; + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); } if ( jQuery.etag[ ifModifiedKey ] ) { - requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ]; + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); } } // Set the Accepts header for the server, depending on the dataType - requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : - s.accepts[ "*" ]; + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); // Check for headers option for ( i in s.headers ) { @@ -6825,11 +7580,11 @@ jQuery.extend({ transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done - if ( status < 2 ) { + if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { - jQuery.error( e ); + throw e; } } } @@ -6857,7 +7612,7 @@ jQuery.extend({ // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); - } ); + }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older @@ -6873,7 +7628,7 @@ jQuery.extend({ }); function buildParams( prefix, obj, traditional, add ) { - if ( jQuery.isArray( obj ) && obj.length ) { + if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { @@ -6893,16 +7648,9 @@ function buildParams( prefix, obj, traditional, add ) { }); } else if ( !traditional && obj != null && typeof obj === "object" ) { - // If we see an array here, it is empty and should be treated as an empty - // object - if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) { - add( prefix, "" ); - // Serialize object item. - } else { - for ( var name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } + for ( var name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { @@ -6940,7 +7688,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) { firstDataType; // Fill responseXXX fields - for( type in responseFields ) { + for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } @@ -7019,13 +7767,13 @@ function ajaxConvert( s, response ) { conv2; // For each dataType in the chain - for( i = 1; i < length; i++ ) { + for ( i = 1; i < length; i++ ) { // Create converters map // with lowercased keys if ( i === 1 ) { - for( key in s.converters ) { - if( typeof key === "string" ) { + for ( key in s.converters ) { + if ( typeof key === "string" ) { converters[ key.toLowerCase() ] = s.converters[ key ]; } } @@ -7036,7 +7784,7 @@ function ajaxConvert( s, response ) { current = dataTypes[ i ]; // If current is auto dataType, update it to prev - if( current === "*" ) { + if ( current === "*" ) { current = prev; // If no auto and dataTypes are actually different } else if ( prev !== "*" && prev !== current ) { @@ -7048,7 +7796,7 @@ function ajaxConvert( s, response ) { // If there is no direct converter, search transitively if ( !conv ) { conv2 = undefined; - for( conv1 in converters ) { + for ( conv1 in converters ) { tmp = conv1.split( " " ); if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { conv2 = converters[ tmp[1] + " " + current ]; @@ -7095,13 +7843,12 @@ jQuery.ajaxSetup({ // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - var dataIsString = ( typeof s.data === "string" ); + var inspectData = s.contentType === "application/x-www-form-urlencoded" && + ( typeof s.data === "string" ); if ( s.dataTypes[ 0 ] === "jsonp" || - originalSettings.jsonpCallback || - originalSettings.jsonp != null || s.jsonp !== false && ( jsre.test( s.url ) || - dataIsString && jsre.test( s.data ) ) ) { + inspectData && jsre.test( s.data ) ) ) { var responseContainer, jsonpCallback = s.jsonpCallback = @@ -7109,20 +7856,12 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { previous = window[ jsonpCallback ], url = s.url, data = s.data, - replace = "$1" + jsonpCallback + "$2", - cleanUp = function() { - // Set callback back to previous value - window[ jsonpCallback ] = previous; - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( previous ) ) { - window[ jsonpCallback ]( responseContainer[ 0 ] ); - } - }; + replace = "$1" + jsonpCallback + "$2"; if ( s.jsonp !== false ) { url = url.replace( jsre, replace ); if ( s.url === url ) { - if ( dataIsString ) { + if ( inspectData ) { data = data.replace( jsre, replace ); } if ( s.data === data ) { @@ -7140,8 +7879,15 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { responseContainer = [ response ]; }; - // Install cleanUp function - jqXHR.then( cleanUp, cleanUp ); + // Clean-up function + jqXHR.always(function() { + // Set callback back to previous value + window[ jsonpCallback ] = previous; + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( previous ) ) { + window[ jsonpCallback ]( responseContainer[ 0 ] ); + } + }); // Use data converter to retrieve json after script execution s.converters["script json"] = function() { @@ -7157,7 +7903,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { // Delegate to script return "script"; } -} ); +}); @@ -7187,7 +7933,7 @@ jQuery.ajaxPrefilter( "script", function( s ) { s.type = "GET"; s.global = false; } -} ); +}); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { @@ -7215,7 +7961,7 @@ jQuery.ajaxTransport( "script", function(s) { // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { - if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; @@ -7246,27 +7992,20 @@ jQuery.ajaxTransport( "script", function(s) { } }; } -} ); +}); -var // #5280: next active xhr id and list of active xhrs' callbacks - xhrId = jQuery.now(), - xhrCallbacks, - - // XHR used to determine supports properties - testXHR; - -// #5280: Internet Explorer will keep connections alive if we don't abort on unload -function xhrOnUnloadAbort() { - jQuery( window ).unload(function() { +var // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { // Abort all pending requests for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( 0, 1 ); } - }); -} + } : false, + xhrId = 0, + xhrCallbacks; // Functions to create xhrs function createStandardXHR() { @@ -7296,15 +8035,13 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject ? // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; -// Test if we can create an xhr object -testXHR = jQuery.ajaxSettings.xhr(); -jQuery.support.ajax = !!testXHR; - -// Does this browser support crossDomain XHR requests -jQuery.support.cors = testXHR && ( "withCredentials" in testXHR ); - -// No need for the temporary xhr anymore -testXHR = undefined; +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { @@ -7387,7 +8124,9 @@ if ( jQuery.support.ajax ) { // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; - delete xhrCallbacks[ handle ]; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } } // If it's an abort @@ -7448,15 +8187,18 @@ if ( jQuery.support.ajax ) { if ( !s.async || xhr.readyState === 4 ) { callback(); } else { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - xhrOnUnloadAbort(); + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; } - // Add to list of active xhrs callbacks - handle = xhrId++; - xhr.onreadystatechange = xhrCallbacks[ handle ] = callback; + xhr.onreadystatechange = callback; } }, @@ -7474,6 +8216,7 @@ if ( jQuery.support.ajax ) { var elemdisplay = {}, + iframe, iframeDoc, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, timerId, @@ -7484,42 +8227,49 @@ var elemdisplay = {}, [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], // opacity animations [ "opacity" ] - ]; + ], + fxNow; jQuery.fn.extend({ show: function( speed, easing, callback ) { var elem, display; if ( speed || speed === 0 ) { - return this.animate( genFx("show", 3), speed, easing, callback); + return this.animate( genFx("show", 3), speed, easing, callback ); } else { for ( var i = 0, j = this.length; i < j; i++ ) { - elem = this[i]; - display = elem.style.display; + elem = this[ i ]; - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { - display = elem.style.display = ""; - } + if ( elem.style ) { + display = elem.style.display; - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { - jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { + display = elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( display === "" && jQuery.css(elem, "display") === "none" ) { + jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); + } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( i = 0; i < j; i++ ) { - elem = this[i]; - display = elem.style.display; + elem = this[ i ]; - if ( display === "" || display === "none" ) { - elem.style.display = jQuery._data(elem, "olddisplay") || ""; + if ( elem.style ) { + display = elem.style.display; + + if ( display === "" || display === "none" ) { + elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; + } } } @@ -7532,18 +8282,27 @@ jQuery.fn.extend({ return this.animate( genFx("hide", 3), speed, easing, callback); } else { - for ( var i = 0, j = this.length; i < j; i++ ) { - var display = jQuery.css( this[i], "display" ); + var elem, display, + i = 0, + j = this.length; - if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { - jQuery._data( this[i], "olddisplay", display ); + for ( ; i < j; i++ ) { + elem = this[i]; + if ( elem.style ) { + display = jQuery.css( elem, "display" ); + + if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { + jQuery._data( elem, "olddisplay", display ); + } } } // Set the display of the elements in a second loop // to avoid the constant reflow for ( i = 0; i < j; i++ ) { - this[i].style.display = "none"; + if ( this[i].style ) { + this[i].style.display = "none"; + } } return this; @@ -7578,35 +8337,57 @@ jQuery.fn.extend({ }, animate: function( prop, speed, easing, callback ) { - var optall = jQuery.speed(speed, easing, callback); + var optall = jQuery.speed( speed, easing, callback ); if ( jQuery.isEmptyObject( prop ) ) { - return this.each( optall.complete ); + return this.each( optall.complete, [ false ] ); } - return this[ optall.queue === false ? "each" : "queue" ](function() { + // Do not change referenced properties as per-property easing will be lost + prop = jQuery.extend( {}, prop ); + + function doAnimation() { // XXX 'this' does not always have a nodeName when running the // test suite - var opt = jQuery.extend({}, optall), p, + if ( optall.queue === false ) { + jQuery._mark( this ); + } + + var opt = jQuery.extend( {}, optall ), isElement = this.nodeType === 1, hidden = isElement && jQuery(this).is(":hidden"), - self = this; + name, val, p, e, + parts, start, end, unit, + method; + + // will store per property easing and be used to determine when an animation is complete + opt.animatedProperties = {}; for ( p in prop ) { - var name = jQuery.camelCase( p ); + // property name normalization + name = jQuery.camelCase( p ); if ( p !== name ) { prop[ name ] = prop[ p ]; delete prop[ p ]; - p = name; } - if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { - return opt.complete.call(this); + val = prop[ name ]; + + // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) + if ( jQuery.isArray( val ) ) { + opt.animatedProperties[ name ] = val[ 1 ]; + val = prop[ name ] = val[ 0 ]; + } else { + opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; } - if ( isElement && ( p === "height" || p === "width" ) ) { + if ( val === "hide" && hidden || val === "show" && !hidden ) { + return opt.complete.call( this ); + } + + if ( isElement && ( name === "height" || name === "width" ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and @@ -7614,66 +8395,60 @@ jQuery.fn.extend({ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; // Set display property to inline-block for height/width - // animations on inline elements that are having width/height - // animated + // animations on inline elements that are having width/height animated if ( jQuery.css( this, "display" ) === "inline" && jQuery.css( this, "float" ) === "none" ) { - if ( !jQuery.support.inlineBlockNeedsLayout ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { this.style.display = "inline-block"; } else { - var display = defaultDisplay(this.nodeName); - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( display === "inline" ) { - this.style.display = "inline-block"; - - } else { - this.style.display = "inline"; - this.style.zoom = 1; - } + this.style.zoom = 1; } } } - - if ( jQuery.isArray( prop[p] ) ) { - // Create (if needed) and add to specialEasing - (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; - prop[p] = prop[p][0]; - } } if ( opt.overflow != null ) { this.style.overflow = "hidden"; } - opt.curAnim = jQuery.extend({}, prop); + for ( p in prop ) { + e = new jQuery.fx( this, opt, p ); + val = prop[ p ]; - jQuery.each( prop, function( name, val ) { - var e = new jQuery.fx( self, opt, name ); + if ( rfxtypes.test( val ) ) { - if ( rfxtypes.test(val) ) { - e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); + // Tracks whether to show or hide based on private + // data attached to the element + method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); + if ( method ) { + jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); + e[ method ](); + } else { + e[ val ](); + } } else { - var parts = rfxnum.exec(val), - start = e.cur(); + parts = rfxnum.exec( val ); + start = e.cur(); if ( parts ) { - var end = parseFloat( parts[2] ), - unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" ); + end = parseFloat( parts[2] ); + unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); // We need to compute starting value if ( unit !== "px" ) { - jQuery.style( self, name, (end || 1) + unit); - start = ((end || 1) / e.cur()) * start; - jQuery.style( self, name, start + unit); + jQuery.style( this, p, (end || 1) + unit); + start = ( (end || 1) / e.cur() ) * start; + jQuery.style( this, p, start + unit); } // If a +=/-= token was provided, we're doing a relative animation if ( parts[1] ) { - end = ((parts[1] === "-=" ? -1 : 1) * end) + start; + end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; } e.custom( start, end, unit ); @@ -7682,48 +8457,94 @@ jQuery.fn.extend({ e.custom( start, val, "" ); } } - }); + } // For JS strict compliance return true; - }); + } + + return optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); }, - stop: function( clearQueue, gotoEnd ) { - var timers = jQuery.timers; - - if ( clearQueue ) { - this.queue([]); + stop: function( type, clearQueue, gotoEnd ) { + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); } - this.each(function() { - // go in reverse order so anything added to the queue during the loop is ignored - for ( var i = timers.length - 1; i >= 0; i-- ) { - if ( timers[i].elem === this ) { - if (gotoEnd) { - // force the next step to be the last - timers[i](true); - } + return this.each(function() { + var index, + hadTimers = false, + timers = jQuery.timers, + data = jQuery._data( this ); - timers.splice(i, 1); + // clear marker counters if we know they won't be + if ( !gotoEnd ) { + jQuery._unmark( true, this ); + } + + function stopQueue( elem, data, index ) { + var hooks = data[ index ]; + jQuery.removeData( elem, index, true ); + hooks.stop( gotoEnd ); + } + + if ( type == null ) { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { + stopQueue( this, data, index ); + } + } + } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ + stopQueue( this, data, index ); + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + if ( gotoEnd ) { + + // force the next step to be the last + timers[ index ]( true ); + } else { + timers[ index ].saveState(); + } + hadTimers = true; + timers.splice( index, 1 ); } } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( !( gotoEnd && hadTimers ) ) { + jQuery.dequeue( this, type ); + } }); - - // start the next in the queue if the last step wasn't forced - if ( !gotoEnd ) { - this.dequeue(); - } - - return this; } }); +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout( clearFxNow, 0 ); + return ( fxNow = jQuery.now() ); +} + +function clearFxNow() { + fxNow = undefined; +} + +// Generate parameters to create a standard animation function genFx( type, num ) { var obj = {}; - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { obj[ this ] = type; }); @@ -7732,9 +8553,9 @@ function genFx( type, num ) { // Generate shortcuts for custom animations jQuery.each({ - slideDown: genFx("show", 1), - slideUp: genFx("hide", 1), - slideToggle: genFx("toggle", 1), + slideDown: genFx( "show", 1 ), + slideUp: genFx( "hide", 1 ), + slideToggle: genFx( "toggle", 1 ), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } @@ -7746,25 +8567,34 @@ jQuery.each({ jQuery.extend({ speed: function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, - easing: fn && easing || easing && !jQuery.isFunction(easing) && easing + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } // Queueing opt.old = opt.complete; - opt.complete = function() { - if ( opt.queue !== false ) { - jQuery(this).dequeue(); - } + + opt.complete = function( noUnmark ) { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } else if ( noUnmark !== false ) { + jQuery._unmark( this ); + } }; return opt; @@ -7775,7 +8605,7 @@ jQuery.extend({ return firstNum + diff * p; }, swing: function( p, n, firstNum, diff ) { - return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; + return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum; } }, @@ -7786,9 +8616,7 @@ jQuery.extend({ this.elem = elem; this.prop = prop; - if ( !options.orig ) { - options.orig = {}; - } + options.orig = options.orig || {}; } }); @@ -7800,12 +8628,12 @@ jQuery.fx.prototype = { this.options.step.call( this.elem, this.now, this ); } - (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); + ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); }, // Get the current size cur: function() { - if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { + if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { return this.elem[ this.prop ]; } @@ -7822,34 +8650,45 @@ jQuery.fx.prototype = { var self = this, fx = jQuery.fx; - this.startTime = jQuery.now(); - this.start = from; + this.startTime = fxNow || createFxNow(); this.end = to; - this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); - this.now = this.start; + this.now = this.start = from; this.pos = this.state = 0; + this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); function t( gotoEnd ) { - return self.step(gotoEnd); + return self.step( gotoEnd ); } + t.queue = this.options.queue; t.elem = this.elem; + t.saveState = function() { + if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { + jQuery._data( self.elem, "fxshow" + self.prop, self.start ); + } + }; if ( t() && jQuery.timers.push(t) && !timerId ) { - timerId = setInterval(fx.tick, fx.interval); + timerId = setInterval( fx.tick, fx.interval ); } }, // Simple 'show' function show: function() { + var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); + // Remember where we started, so that we can go back to it later - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); + this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); this.options.show = true; // Begin the animation - // Make sure that we start at a small width/height to avoid any - // flash of content - this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); + // Make sure that we start at a small width/height to avoid any flash of content + if ( dataShow !== undefined ) { + // This show is picking up where a previous hide or show left off + this.custom( this.cur(), dataShow ); + } else { + this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); + } // Start by showing the element jQuery( this.elem ).show(); @@ -7858,69 +8697,84 @@ jQuery.fx.prototype = { // Simple 'hide' function hide: function() { // Remember where we started, so that we can go back to it later - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); + this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); this.options.hide = true; // Begin the animation - this.custom(this.cur(), 0); + this.custom( this.cur(), 0 ); }, // Each step of an animation step: function( gotoEnd ) { - var t = jQuery.now(), done = true; + var p, n, complete, + t = fxNow || createFxNow(), + done = true, + elem = this.elem, + options = this.options; - if ( gotoEnd || t >= this.options.duration + this.startTime ) { + if ( gotoEnd || t >= options.duration + this.startTime ) { this.now = this.end; this.pos = this.state = 1; this.update(); - this.options.curAnim[ this.prop ] = true; + options.animatedProperties[ this.prop ] = true; - for ( var i in this.options.curAnim ) { - if ( this.options.curAnim[i] !== true ) { + for ( p in options.animatedProperties ) { + if ( options.animatedProperties[ p ] !== true ) { done = false; } } if ( done ) { // Reset the overflow - if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { - var elem = this.elem, - options = this.options; + if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { - jQuery.each( [ "", "X", "Y" ], function (index, value) { - elem.style[ "overflow" + value ] = options.overflow[index]; - } ); + jQuery.each( [ "", "X", "Y" ], function( index, value ) { + elem.style[ "overflow" + value ] = options.overflow[ index ]; + }); } // Hide the element if the "hide" operation was done - if ( this.options.hide ) { - jQuery(this.elem).hide(); + if ( options.hide ) { + jQuery( elem ).hide(); } // Reset the properties, if the item has been hidden or shown - if ( this.options.hide || this.options.show ) { - for ( var p in this.options.curAnim ) { - jQuery.style( this.elem, p, this.options.orig[p] ); + if ( options.hide || options.show ) { + for ( p in options.animatedProperties ) { + jQuery.style( elem, p, options.orig[ p ] ); + jQuery.removeData( elem, "fxshow" + p, true ); + // Toggle data is no longer needed + jQuery.removeData( elem, "toggle" + p, true ); } } // Execute the complete function - this.options.complete.call( this.elem ); + // in the event that the complete function throws an exception + // we must ensure it won't be called twice. #5684 + + complete = options.complete; + if ( complete ) { + + options.complete = false; + complete.call( elem ); + } } return false; } else { - var n = t - this.startTime; - this.state = n / this.options.duration; - - // Perform the easing function, defaults to swing - var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; - var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); - this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); - this.now = this.start + ((this.end - this.start) * this.pos); + // classical easing cannot be used with an Infinity duration + if ( options.duration == Infinity ) { + this.now = t; + } else { + n = t - this.startTime; + this.state = n / options.duration; + // Perform the easing function, defaults to swing + this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); + this.now = this.start + ( (this.end - this.start) * this.pos ); + } // Perform the next step of the animation this.update(); } @@ -7931,11 +8785,15 @@ jQuery.fx.prototype = { jQuery.extend( jQuery.fx, { tick: function() { - var timers = jQuery.timers; + var timer, + timers = jQuery.timers, + i = 0; - for ( var i = 0; i < timers.length; i++ ) { - if ( !timers[i]() ) { - timers.splice(i--, 1); + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); } } @@ -7965,7 +8823,7 @@ jQuery.extend( jQuery.fx, { _default: function( fx ) { if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { - fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; + fx.elem.style[ fx.prop ] = fx.now + fx.unit; } else { fx.elem[ fx.prop ] = fx.now; } @@ -7973,6 +8831,14 @@ jQuery.extend( jQuery.fx, { } }); +// Adds width/height step functions +// Do not set anything below 0 +jQuery.each([ "width", "height" ], function( i, prop ) { + jQuery.fx.step[ prop ] = function( fx ) { + jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); + }; +}); + if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { @@ -7981,17 +8847,45 @@ if ( jQuery.expr && jQuery.expr.filters ) { }; } +// Try to restore the default display value of an element function defaultDisplay( nodeName ) { - if ( !elemdisplay[ nodeName ] ) { - var elem = jQuery("<" + nodeName + ">").appendTo("body"), - display = elem.css("display"); + if ( !elemdisplay[ nodeName ] ) { + + var body = document.body, + elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), + display = elem.css( "display" ); elem.remove(); + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { - display = "block"; + // No iframe to use yet, so create it + if ( !iframe ) { + iframe = document.createElement( "iframe" ); + iframe.frameBorder = iframe.width = iframe.height = 0; + } + + body.appendChild( iframe ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "" : "" ) + "" ); + iframeDoc.close(); + } + + elem = iframeDoc.createElement( nodeName ); + + iframeDoc.body.appendChild( elem ); + + display = jQuery.css( elem, "display" ); + body.removeChild( iframe ); } + // Store the correct default display elemdisplay[ nodeName ] = display; } @@ -8064,8 +8958,6 @@ if ( "getBoundingClientRect" in document.documentElement ) { return jQuery.offset.bodyOffset( elem ); } - jQuery.offset.initialize(); - var computedStyle, offsetParent = elem.offsetParent, prevOffsetParent = elem, @@ -8078,7 +8970,7 @@ if ( "getBoundingClientRect" in document.documentElement ) { left = elem.offsetLeft; while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { break; } @@ -8090,7 +8982,7 @@ if ( "getBoundingClientRect" in document.documentElement ) { top += elem.offsetTop; left += elem.offsetLeft; - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { + if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } @@ -8099,7 +8991,7 @@ if ( "getBoundingClientRect" in document.documentElement ) { offsetParent = elem.offsetParent; } - if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { + if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } @@ -8112,7 +9004,7 @@ if ( "getBoundingClientRect" in document.documentElement ) { left += body.offsetLeft; } - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { top += Math.max( docElem.scrollTop, body.scrollTop ); left += Math.max( docElem.scrollLeft, body.scrollLeft ); } @@ -8122,46 +9014,12 @@ if ( "getBoundingClientRect" in document.documentElement ) { } jQuery.offset = { - initialize: function() { - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0, - html = "
      "; - - jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); - - container.innerHTML = html; - body.insertBefore( container, body.firstChild ); - innerDiv = container.firstChild; - checkDiv = innerDiv.firstChild; - td = innerDiv.nextSibling.firstChild.firstChild; - - this.doesNotAddBorder = (checkDiv.offsetTop !== 5); - this.doesAddBorderForTableAndCells = (td.offsetTop === 5); - - checkDiv.style.position = "fixed"; - checkDiv.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); - checkDiv.style.position = checkDiv.style.top = ""; - - innerDiv.style.overflow = "hidden"; - innerDiv.style.position = "relative"; - - this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); - - this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); - - body.removeChild( container ); - jQuery.offset.initialize = jQuery.noop; - }, bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; - jQuery.offset.initialize(); - - if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } @@ -8181,26 +9039,28 @@ jQuery.offset = { curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1, + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; } - curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; - curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; - if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } - if (options.top != null) { - props.top = (options.top - curOffset.top) + curTop; + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; } - if (options.left != null) { - props.left = (options.left - curOffset.left) + curLeft; + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { @@ -8213,6 +9073,7 @@ jQuery.offset = { jQuery.fn.extend({ + position: function() { if ( !this[0] ) { return null; @@ -8260,29 +9121,16 @@ jQuery.fn.extend({ jQuery.each( ["Left", "Top"], function( i, name ) { var method = "scroll" + name; - jQuery.fn[ method ] = function(val) { - var elem = this[0], win; + jQuery.fn[ method ] = function( val ) { + var elem, win; - if ( !elem ) { - return null; - } + if ( val === undefined ) { + elem = this[ 0 ]; - if ( val !== undefined ) { - // Set the scroll offset - return this.each(function() { - win = getWindow( this ); + if ( !elem ) { + return null; + } - if ( win ) { - win.scrollTo( - !i ? val : jQuery(win).scrollLeft(), - i ? val : jQuery(win).scrollTop() - ); - - } else { - this[ method ] = val; - } - }); - } else { win = getWindow( elem ); // Return the scroll offset @@ -8291,6 +9139,21 @@ jQuery.each( ["Left", "Top"], function( i, name ) { win.document.body[ method ] : elem[ method ]; } + + // Set the scroll offset + return this.each(function() { + win = getWindow( this ); + + if ( win ) { + win.scrollTo( + !i ? val : jQuery( win ).scrollLeft(), + i ? val : jQuery( win ).scrollTop() + ); + + } else { + this[ method ] = val; + } + }); }; }); @@ -8305,22 +9168,28 @@ function getWindow( elem ) { -// Create innerHeight, innerWidth, outerHeight and outerWidth methods +// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function( i, name ) { var type = name.toLowerCase(); // innerHeight and innerWidth - jQuery.fn["inner" + name] = function() { - return this[0] ? - parseFloat( jQuery.css( this[0], type, "padding" ) ) : + jQuery.fn[ "inner" + name ] = function() { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, "padding" ) ) : + this[ type ]() : null; }; // outerHeight and outerWidth - jQuery.fn["outer" + name] = function( margin ) { - return this[0] ? - parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) : + jQuery.fn[ "outer" + name ] = function( margin ) { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : + this[ type ]() : null; }; @@ -8341,9 +9210,10 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { if ( jQuery.isWindow( elem ) ) { // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat - var docElemProp = elem.document.documentElement[ "client" + name ]; + var docElemProp = elem.document.documentElement[ "client" + name ], + body = elem.document.body; return elem.document.compatMode === "CSS1Compat" && docElemProp || - elem.document.body[ "client" + name ] || docElemProp; + body && body[ "client" + name ] || docElemProp; // Get document width or height } else if ( elem.nodeType === 9 ) { @@ -8359,7 +9229,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { var orig = jQuery.css( elem, type ), ret = parseFloat( orig ); - return jQuery.isNaN( ret ) ? orig : ret; + return jQuery.isNumeric( ret ) ? ret : orig; // Set the width or height on the element (default to pixels if value is unitless) } else { @@ -8370,6 +9240,27 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { }); -window.jQuery = window.$ = jQuery; -})(window); + +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + + + +})( window ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png b/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png deleted file mode 100644 index d92ffc6464..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/jquery-ui-1.8.12.custom.css b/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/jquery-ui-1.8.12.custom.css deleted file mode 100644 index c85aabaec0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/jquery-ui-1.8.12.custom.css +++ /dev/null @@ -1,578 +0,0 @@ -/* - * jQuery UI CSS Framework 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } -.ui-widget-content a { color: #222222; } -.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } -.ui-widget-header a { color: #222222; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } -.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } -.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } -.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } -.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } - -/* positioning */ -.ui-icon-carat-1-n { background-position: 0 0; } -.ui-icon-carat-1-ne { background-position: -16px 0; } -.ui-icon-carat-1-e { background-position: -32px 0; } -.ui-icon-carat-1-se { background-position: -48px 0; } -.ui-icon-carat-1-s { background-position: -64px 0; } -.ui-icon-carat-1-sw { background-position: -80px 0; } -.ui-icon-carat-1-w { background-position: -96px 0; } -.ui-icon-carat-1-nw { background-position: -112px 0; } -.ui-icon-carat-2-n-s { background-position: -128px 0; } -.ui-icon-carat-2-e-w { background-position: -144px 0; } -.ui-icon-triangle-1-n { background-position: 0 -16px; } -.ui-icon-triangle-1-ne { background-position: -16px -16px; } -.ui-icon-triangle-1-e { background-position: -32px -16px; } -.ui-icon-triangle-1-se { background-position: -48px -16px; } -.ui-icon-triangle-1-s { background-position: -64px -16px; } -.ui-icon-triangle-1-sw { background-position: -80px -16px; } -.ui-icon-triangle-1-w { background-position: -96px -16px; } -.ui-icon-triangle-1-nw { background-position: -112px -16px; } -.ui-icon-triangle-2-n-s { background-position: -128px -16px; } -.ui-icon-triangle-2-e-w { background-position: -144px -16px; } -.ui-icon-arrow-1-n { background-position: 0 -32px; } -.ui-icon-arrow-1-ne { background-position: -16px -32px; } -.ui-icon-arrow-1-e { background-position: -32px -32px; } -.ui-icon-arrow-1-se { background-position: -48px -32px; } -.ui-icon-arrow-1-s { background-position: -64px -32px; } -.ui-icon-arrow-1-sw { background-position: -80px -32px; } -.ui-icon-arrow-1-w { background-position: -96px -32px; } -.ui-icon-arrow-1-nw { background-position: -112px -32px; } -.ui-icon-arrow-2-n-s { background-position: -128px -32px; } -.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } -.ui-icon-arrow-2-e-w { background-position: -160px -32px; } -.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } -.ui-icon-arrowstop-1-n { background-position: -192px -32px; } -.ui-icon-arrowstop-1-e { background-position: -208px -32px; } -.ui-icon-arrowstop-1-s { background-position: -224px -32px; } -.ui-icon-arrowstop-1-w { background-position: -240px -32px; } -.ui-icon-arrowthick-1-n { background-position: 0 -48px; } -.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } -.ui-icon-arrowthick-1-e { background-position: -32px -48px; } -.ui-icon-arrowthick-1-se { background-position: -48px -48px; } -.ui-icon-arrowthick-1-s { background-position: -64px -48px; } -.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } -.ui-icon-arrowthick-1-w { background-position: -96px -48px; } -.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } -.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } -.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } -.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } -.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } -.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } -.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } -.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } -.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } -.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } -.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } -.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } -.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } -.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } -.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } -.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } -.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } -.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } -.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } -.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } -.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } -.ui-icon-arrow-4 { background-position: 0 -80px; } -.ui-icon-arrow-4-diag { background-position: -16px -80px; } -.ui-icon-extlink { background-position: -32px -80px; } -.ui-icon-newwin { background-position: -48px -80px; } -.ui-icon-refresh { background-position: -64px -80px; } -.ui-icon-shuffle { background-position: -80px -80px; } -.ui-icon-transfer-e-w { background-position: -96px -80px; } -.ui-icon-transferthick-e-w { background-position: -112px -80px; } -.ui-icon-folder-collapsed { background-position: 0 -96px; } -.ui-icon-folder-open { background-position: -16px -96px; } -.ui-icon-document { background-position: -32px -96px; } -.ui-icon-document-b { background-position: -48px -96px; } -.ui-icon-note { background-position: -64px -96px; } -.ui-icon-mail-closed { background-position: -80px -96px; } -.ui-icon-mail-open { background-position: -96px -96px; } -.ui-icon-suitcase { background-position: -112px -96px; } -.ui-icon-comment { background-position: -128px -96px; } -.ui-icon-person { background-position: -144px -96px; } -.ui-icon-print { background-position: -160px -96px; } -.ui-icon-trash { background-position: -176px -96px; } -.ui-icon-locked { background-position: -192px -96px; } -.ui-icon-unlocked { background-position: -208px -96px; } -.ui-icon-bookmark { background-position: -224px -96px; } -.ui-icon-tag { background-position: -240px -96px; } -.ui-icon-home { background-position: 0 -112px; } -.ui-icon-flag { background-position: -16px -112px; } -.ui-icon-calendar { background-position: -32px -112px; } -.ui-icon-cart { background-position: -48px -112px; } -.ui-icon-pencil { background-position: -64px -112px; } -.ui-icon-clock { background-position: -80px -112px; } -.ui-icon-disk { background-position: -96px -112px; } -.ui-icon-calculator { background-position: -112px -112px; } -.ui-icon-zoomin { background-position: -128px -112px; } -.ui-icon-zoomout { background-position: -144px -112px; } -.ui-icon-search { background-position: -160px -112px; } -.ui-icon-wrench { background-position: -176px -112px; } -.ui-icon-gear { background-position: -192px -112px; } -.ui-icon-heart { background-position: -208px -112px; } -.ui-icon-star { background-position: -224px -112px; } -.ui-icon-link { background-position: -240px -112px; } -.ui-icon-cancel { background-position: 0 -128px; } -.ui-icon-plus { background-position: -16px -128px; } -.ui-icon-plusthick { background-position: -32px -128px; } -.ui-icon-minus { background-position: -48px -128px; } -.ui-icon-minusthick { background-position: -64px -128px; } -.ui-icon-close { background-position: -80px -128px; } -.ui-icon-closethick { background-position: -96px -128px; } -.ui-icon-key { background-position: -112px -128px; } -.ui-icon-lightbulb { background-position: -128px -128px; } -.ui-icon-scissors { background-position: -144px -128px; } -.ui-icon-clipboard { background-position: -160px -128px; } -.ui-icon-copy { background-position: -176px -128px; } -.ui-icon-contact { background-position: -192px -128px; } -.ui-icon-image { background-position: -208px -128px; } -.ui-icon-video { background-position: -224px -128px; } -.ui-icon-script { background-position: -240px -128px; } -.ui-icon-alert { background-position: 0 -144px; } -.ui-icon-info { background-position: -16px -144px; } -.ui-icon-notice { background-position: -32px -144px; } -.ui-icon-help { background-position: -48px -144px; } -.ui-icon-check { background-position: -64px -144px; } -.ui-icon-bullet { background-position: -80px -144px; } -.ui-icon-radio-off { background-position: -96px -144px; } -.ui-icon-radio-on { background-position: -112px -144px; } -.ui-icon-pin-w { background-position: -128px -144px; } -.ui-icon-pin-s { background-position: -144px -144px; } -.ui-icon-play { background-position: 0 -160px; } -.ui-icon-pause { background-position: -16px -160px; } -.ui-icon-seek-next { background-position: -32px -160px; } -.ui-icon-seek-prev { background-position: -48px -160px; } -.ui-icon-seek-end { background-position: -64px -160px; } -.ui-icon-seek-start { background-position: -80px -160px; } -/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ -.ui-icon-seek-first { background-position: -80px -160px; } -.ui-icon-stop { background-position: -96px -160px; } -.ui-icon-eject { background-position: -112px -160px; } -.ui-icon-volume-off { background-position: -128px -160px; } -.ui-icon-volume-on { background-position: -144px -160px; } -.ui-icon-power { background-position: 0 -176px; } -.ui-icon-signal-diag { background-position: -16px -176px; } -.ui-icon-signal { background-position: -32px -176px; } -.ui-icon-battery-0 { background-position: -48px -176px; } -.ui-icon-battery-1 { background-position: -64px -176px; } -.ui-icon-battery-2 { background-position: -80px -176px; } -.ui-icon-battery-3 { background-position: -96px -176px; } -.ui-icon-circle-plus { background-position: 0 -192px; } -.ui-icon-circle-minus { background-position: -16px -192px; } -.ui-icon-circle-close { background-position: -32px -192px; } -.ui-icon-circle-triangle-e { background-position: -48px -192px; } -.ui-icon-circle-triangle-s { background-position: -64px -192px; } -.ui-icon-circle-triangle-w { background-position: -80px -192px; } -.ui-icon-circle-triangle-n { background-position: -96px -192px; } -.ui-icon-circle-arrow-e { background-position: -112px -192px; } -.ui-icon-circle-arrow-s { background-position: -128px -192px; } -.ui-icon-circle-arrow-w { background-position: -144px -192px; } -.ui-icon-circle-arrow-n { background-position: -160px -192px; } -.ui-icon-circle-zoomin { background-position: -176px -192px; } -.ui-icon-circle-zoomout { background-position: -192px -192px; } -.ui-icon-circle-check { background-position: -208px -192px; } -.ui-icon-circlesmall-plus { background-position: 0 -208px; } -.ui-icon-circlesmall-minus { background-position: -16px -208px; } -.ui-icon-circlesmall-close { background-position: -32px -208px; } -.ui-icon-squaresmall-plus { background-position: -48px -208px; } -.ui-icon-squaresmall-minus { background-position: -64px -208px; } -.ui-icon-squaresmall-close { background-position: -80px -208px; } -.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } -.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } -.ui-icon-grip-solid-vertical { background-position: -32px -224px; } -.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } -.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } -.ui-icon-grip-diagonal-se { background-position: -80px -224px; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } - -/* Overlays */ -.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } -.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* - * jQuery UI Resizable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; - /* http://bugs.jqueryui.com/ticket/7233 - - Resizable: resizable handles fail to work in IE if transparent and content overlaps - */ - background-image:url(data:); -} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; } -/* - * jQuery UI Autocomplete 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.12 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/AUTHORS.txt b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/AUTHORS.txt deleted file mode 100644 index b2168655ee..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/AUTHORS.txt +++ /dev/null @@ -1,30 +0,0 @@ -jQuery UI Authors (http://jqueryui.com/about) - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -and logs, available at http://github.com/jquery/jquery-ui - -Brandon Aaron -Paul Bakaus (paulbakaus.com) -David Bolter -Rich Caloggero -Chi Cheng (cloudream@gmail.com) -Colin Clark (http://colin.atrc.utoronto.ca/) -Michelle D'Souza -Aaron Eisenberger (aaronchi@gmail.com) -Ariel Flesler -Bohdan Ganicky -Scott González -Marc Grabanski (m@marcgrabanski.com) -Klaus Hartl (stilbuero.de) -Scott Jehl -Cody Lindley -Eduardo Lundgren (eduardolundgren@gmail.com) -Todd Parker -John Resig -Patty Toland -Ca-Phun Ung (yelotofu.com) -Keith Wood (kbwood@virginbroadband.com.au) -Maggie Costello Wachs -Richard D. Worth (rdworth.org) -Jörn Zaefferer (bassistance.de) diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/GPL-LICENSE.txt b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/GPL-LICENSE.txt deleted file mode 100644 index 11dddd00ef..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/GPL-LICENSE.txt +++ /dev/null @@ -1,278 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/MIT-LICENSE.txt b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/MIT-LICENSE.txt deleted file mode 100644 index be226805d3..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/MIT-LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2011 Paul Bakaus, http://jqueryui.com/ - -This software consists of voluntary contributions made by many -individuals (AUTHORS.txt, http://jqueryui.com/about) For exact -contribution history, see the revision history and logs, available -at http://jquery-ui.googlecode.com/svn/ - -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. diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/collapsible.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/collapsible.html deleted file mode 100644 index f77fdc05c8..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/collapsible.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - jQuery UI Accordion - Collapse content - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

      Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

      -
      -
      - -
      - - - -
      -

      By default, accordions always keep one section open. To allow for all sections to be be collapsible, set the collapsible option to true. Click on the currently open section to collapse its content pane.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/custom-icons.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/custom-icons.html deleted file mode 100644 index 390b5dd052..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/custom-icons.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - jQuery UI Accordion - Customize icons - - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

      Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

      -
      -
      - - - -
      - - - -
      -

      Customize the header icons with the icons option, which accepts classes for the header's default and selected (open) state. Use any class from the UI CSS framework, or create custom classes with background images.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/default.html deleted file mode 100644 index e24a586336..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/default.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - jQuery UI Accordion - Default functionality - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      - Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer - ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit - amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut - odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate. -

      -
      -

      Section 2

      -
      -

      - Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet - purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor - velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In - suscipit faucibus urna. -

      -
      -

      Section 3

      -
      -

      - Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. - Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero - ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis - lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. -

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      - Cras dictum. Pellentesque habitant morbi tristique senectus et netus - et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in - faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia - mauris vel est. -

      -

      - Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. - Class aptent taciti sociosqu ad litora torquent per conubia nostra, per - inceptos himenaeos. -

      -
      -
      - -
      - -
      -

      -Click headers to expand/collapse content that is broken into logical sections, much like tabs. -Optionally, toggle sections open/closed on mouseover. -

      -

      -The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is -usable without JavaScript. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/fillspace.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/fillspace.html deleted file mode 100644 index ffbf8299e3..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/fillspace.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - jQuery UI Accordion - Fill space - - - - - - - - - - - - -
      - -

      Resize the outer container:

      - -
      - -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

      Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

      -
      -
      - - -
      - -
      I'm another panel
      - -
      - - - -
      -

      Because the accordion is comprised of block-level elements, by default its width fills the available horizontal space. To fill the vertical space allocated by its container, set the boolean fillSpace option to true, and the script will automatically set the dimensions of the accordion to the height of its parent container. The accordion will also resize with its container if the container is resizable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/hoverintent.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/hoverintent.html deleted file mode 100644 index 570be752d3..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/hoverintent.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - jQuery UI Accordion - Open on hoverintent - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      - Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer - ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit - amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut - odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate. -

      -
      -

      Section 2

      -
      -

      - Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet - purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor - velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In - suscipit faucibus urna. -

      -
      -

      Section 3

      -
      -

      - Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. - Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero - ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis - lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. -

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      - Cras dictum. Pellentesque habitant morbi tristique senectus et netus - et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in - faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia - mauris vel est. -

      -

      - Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. - Class aptent taciti sociosqu ad litora torquent per conubia nostra, per - inceptos himenaeos. -

      -
      -
      - -
      - -
      -

      -Click headers to expand/collapse content that is broken into logical sections, much like tabs. -Optionally, toggle sections open/closed on mouseover. -

      -

      -The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is -usable without JavaScript. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/index.html deleted file mode 100644 index d107dd881d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - jQuery UI Accordion Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/mouseover.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/mouseover.html deleted file mode 100644 index d2cc7dbc0f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/mouseover.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - jQuery UI Accordion - Open on mouseover - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -

      Section 4

      -
      -

      Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

      Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

      -
      -
      - -
      - - - -
      -

      Toggle sections open/closed on mouseover with the event option. The default value for event is "click."

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/no-auto-height.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/no-auto-height.html deleted file mode 100644 index 204869253b..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/no-auto-height.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - jQuery UI Accordion - No auto height - - - - - - - - - - -
      - -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item
      • -
      • List item
      • -
      • List item
      • -
      • List item
      • -
      • List item
      • -
      • List item
      • -
      • List item
      • -
      - Link to other content -
      -
      - -
      - - - -
      -

      Setting autoHeight: false allows to accordion panels to keep their native height.

      -

      In addition, the navigation option is enabled, opening the panel based on the current location, eg. no-auto-height.html#panel2 would open the second panel on page load. It also finds anchors within the content, so #othercontent will open the third section, as it contains a link with that href.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/sortable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/sortable.html deleted file mode 100644 index 1bfce6fe19..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/accordion/sortable.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - jQuery UI Accordion - Sortable - - - - - - - - - - - - -
      - -
      -
      -

      Section 1

      -
      -

      Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

      -
      -
      -
      -

      Section 2

      -
      -

      Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

      -
      -
      -
      -

      Section 3

      -
      -

      Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      -
        -
      • List item one
      • -
      • List item two
      • -
      • List item three
      • -
      -
      -
      -
      -

      Section 4

      -
      -

      Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

      Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

      -
      -
      -
      - -
      - - - -
      -

      Drag the header to re-order panels.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/default.html deleted file mode 100644 index 73502d6fb5..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/default.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - jQuery UI Effects - addClass demo - - - - - - - - - -
      - -
      -
      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. -
      -
      - -Run Effect - -
      - - - -
      -

      This demo adds a class which animates: text-indent, letter-spacing, width, height, padding, margin, and font-size.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/addClass/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/default.html deleted file mode 100644 index 284f0fe4f1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/default.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - jQuery UI Effects - Animate demo - - - - - - - - - -
      - -
      -
      -

      Animate

      -

      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. -

      -
      -
      - -Toggle Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/animate/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/categories.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/categories.html deleted file mode 100644 index 28f3ef18f1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/categories.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - jQuery UI Autocomplete - Categories - - - - - - - - - - - - - -
      - - -
      - - - -
      -

      A categorized search result. Try typing "a" or "n".

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/combobox.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/combobox.html deleted file mode 100644 index 5bef5b1afa..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/combobox.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - jQuery UI Autocomplete - Combobox - - - - - - - - - - - - - -
      - -
      - - -
      - - -
      - - - -
      -

      A custom widget built by composition of Autocomplete and Button. You can either type something into the field to get filtered suggestions based on your input, or use the button to get the full list of selections.

      -

      The input is read from an existing select-element for progressive enhancement, passed to Autocomplete with a customized source-option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/custom-data.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/custom-data.html deleted file mode 100644 index d619a4f81d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/custom-data.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - jQuery UI Autocomplete - Custom data and display - - - - - - - - - - - - -
      -
      Select a project (type "j" for a start):
      - - - -

      -
      - - - -
      -

      You can use your own custom data formats and displays by simply overriding the default focus and select actions.

      -

      Try typing "j" to get a list of projects or just press the down arrow.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/default.html deleted file mode 100644 index 16ec893d4c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/default.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - jQuery UI Autocomplete - Default functionality - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.

      -

      The datasource is a simple JavaScript array, provided to the widget using the source-option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/folding.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/folding.html deleted file mode 100644 index 688db3356d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/folding.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - jQuery UI Autocomplete - Accent folding - - - - - - - - - - - -
      - -
      -
      - - -
      -
      - -
      - - - -
      -

      The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented.

      -

      Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jquery_32x32.png b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jquery_32x32.png deleted file mode 100644 index 9312f02d5d..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jquery_32x32.png and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jqueryui_32x32.png b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jqueryui_32x32.png deleted file mode 100644 index e003d16c14..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/jqueryui_32x32.png and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/sizzlejs_32x32.png b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/sizzlejs_32x32.png deleted file mode 100644 index 4ce0704d18..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/sizzlejs_32x32.png and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/transparent_1x1.png b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/transparent_1x1.png deleted file mode 100644 index c2da5b889d..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/transparent_1x1.png and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/ui-anim_basic_16x16.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/ui-anim_basic_16x16.gif deleted file mode 100644 index 084ecb879b..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/images/ui-anim_basic_16x16.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/index.html deleted file mode 100644 index 77f801996d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - jQuery UI Autocomplete Demos - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/london.xml b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/london.xml deleted file mode 100644 index 2628549981..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/london.xml +++ /dev/null @@ -1,114 +0,0 @@ - - -6987 - -London -51.5084152563931 --0.125532746315002 -2643743 -GB -United Kingdom - -P -PPLC - - -London -42.983389283 --81.233042387 -6058560 -CA -Canada - -P -PPL - - -East London --33.0152850934643 -27.9116249084473 -1006984 -ZA -South Africa - -P -PPL - - -City -51.5133363996235 --0.0890064239501953 -2643744 -GB -United Kingdom - -A -ADM2 - - -London -37.1289771 --84.0832646 -4298960 -US -United States - -P -PPL - - -The Tower of London -51.5082349601834 --0.0763034820556641 -6286786 -GB -United Kingdom - -S -CSTL - - -London Reefs -8.85 -112.5333333 -1879967 - - - -U -RFSU - - -Greater London -51.5 --0.1666667 -2648110 -GB -United Kingdom - -A -ADM2 - - -London -46.1666667 -6.0166667 -2661811 -CH -Switzerland - -H -STM - - -London Borough of Islington -51.5333333 --0.1333333 -3333156 -GB -United Kingdom - -A -ADM2 - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/maxheight.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/maxheight.html deleted file mode 100644 index fc0b4840c6..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/maxheight.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - jQuery UI Autocomplete - Scrollable results - - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple-remote.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple-remote.html deleted file mode 100644 index c82188a94a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple-remote.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - jQuery UI Autocomplete - Multiple, remote - - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      Usage: Enter at least two characters to get bird name suggestions. Select a value to continue adding more names.

      -

      This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple.html deleted file mode 100644 index 954016d75a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/multiple.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - jQuery UI Autocomplete - Multiple values - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      Usage: Type something, eg. "j" to see suggestions for tagging with programming languages. Select a value, then continue typing to add more.

      -

      This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-jsonp.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-jsonp.html deleted file mode 100644 index 04b44fd5c1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-jsonp.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - jQuery UI Autocomplete - Remote JSONP datasource - - - - - - - - - - - - -
      - -
      - - - Powered by geonames.org -
      - -
      - Result: -
      -
      - -
      - - - -
      -

      The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are cities, displayed when at least two characters are entered into the field.

      -

      In this case, the datasource is the geonames.org webservice. While only the city name itself ends up in the input after selecting an element, more info is displayed in the suggestions to help find the right entry. That data is also available in callbacks, as illustrated by the Result area below the input.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-with-cache.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-with-cache.html deleted file mode 100644 index b1b7c8b372..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote-with-cache.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - jQuery UI Autocomplete - Remote with caching - - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.

      -

      Similar to the remote datasource demo, though this adds some local caching to improve performance. The cache here saves just one query, and could be extended to cache multiple values, one for each term.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote.html deleted file mode 100644 index 992a5867d7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/remote.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - jQuery UI Autocomplete - Remote datasource - - - - - - - - - - - - -
      - -
      - - -
      - -
      - Result: -
      -
      - -
      - - - -
      -

      The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.

      -

      The datasource is a server-side script which returns JSON data, specified via a simple URL for the source-option. In addition, the minLength-option is set to 2 to avoid queries that would return too many results and the select-event is used to display some feedback.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/search.php b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/search.php deleted file mode 100644 index f2b889d2d6..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/search.php +++ /dev/null @@ -1,640 +0,0 @@ -"Botaurus stellaris", -"Little Grebe"=>"Tachybaptus ruficollis", -"Black-necked Grebe"=>"Podiceps nigricollis", -"Little Bittern"=>"Ixobrychus minutus", -"Black-crowned Night Heron"=>"Nycticorax nycticorax", -"Purple Heron"=>"Ardea purpurea", -"White Stork"=>"Ciconia ciconia", -"Spoonbill"=>"Platalea leucorodia", -"Red-crested Pochard"=>"Netta rufina", -"Common Eider"=>"Somateria mollissima", -"Red Kite"=>"Milvus milvus", -"Hen Harrier"=>"Circus cyaneus", -"Montagu`s Harrier"=>"Circus pygargus", -"Black Grouse"=>"Tetrao tetrix", -"Grey Partridge"=>"Perdix perdix", -"Spotted Crake"=>"Porzana porzana", -"Corncrake"=>"Crex crex", -"Common Crane"=>"Grus grus", -"Avocet"=>"Recurvirostra avosetta", -"Stone Curlew"=>"Burhinus oedicnemus", -"Common Ringed Plover"=>"Charadrius hiaticula", -"Kentish Plover"=>"Charadrius alexandrinus", -"Ruff"=>"Philomachus pugnax", -"Common Snipe"=>"Gallinago gallinago", -"Black-tailed Godwit"=>"Limosa limosa", -"Common Redshank"=>"Tringa totanus", -"Sandwich Tern"=>"Sterna sandvicensis", -"Common Tern"=>"Sterna hirundo", -"Arctic Tern"=>"Sterna paradisaea", -"Little Tern"=>"Sternula albifrons", -"Black Tern"=>"Chlidonias niger", -"Barn Owl"=>"Tyto alba", -"Little Owl"=>"Athene noctua", -"Short-eared Owl"=>"Asio flammeus", -"European Nightjar"=>"Caprimulgus europaeus", -"Common Kingfisher"=>"Alcedo atthis", -"Eurasian Hoopoe"=>"Upupa epops", -"Eurasian Wryneck"=>"Jynx torquilla", -"European Green Woodpecker"=>"Picus viridis", -"Crested Lark"=>"Galerida cristata", -"White-headed Duck"=>"Oxyura leucocephala", -"Pale-bellied Brent Goose"=>"Branta hrota", -"Tawny Pipit"=>"Anthus campestris", -"Whinchat"=>"Saxicola rubetra", -"European Stonechat"=>"Saxicola rubicola", -"Northern Wheatear"=>"Oenanthe oenanthe", -"Savi`s Warbler"=>"Locustella luscinioides", -"Sedge Warbler"=>"Acrocephalus schoenobaenus", -"Great Reed Warbler"=>"Acrocephalus arundinaceus", -"Bearded Reedling"=>"Panurus biarmicus", -"Red-backed Shrike"=>"Lanius collurio", -"Great Grey Shrike"=>"Lanius excubitor", -"Woodchat Shrike"=>"Lanius senator", -"Common Raven"=>"Corvus corax", -"Yellowhammer"=>"Emberiza citrinella", -"Ortolan Bunting"=>"Emberiza hortulana", -"Corn Bunting"=>"Emberiza calandra", -"Great Cormorant"=>"Phalacrocorax carbo", -"Hawfinch"=>"Coccothraustes coccothraustes", -"Common Shelduck"=>"Tadorna tadorna", -"Bluethroat"=>"Luscinia svecica", -"Grey Heron"=>"Ardea cinerea", -"Barn Swallow"=>"Hirundo rustica", -"Hooded Crow"=>"Corvus cornix", -"Dunlin"=>"Calidris alpina", -"Eurasian Pied Flycatcher"=>"Ficedula hypoleuca", -"Eurasian Nuthatch"=>"Sitta europaea", -"Short-toed Tree Creeper"=>"Certhia brachydactyla", -"Wood Lark"=>"Lullula arborea", -"Tree Pipit"=>"Anthus trivialis", -"Eurasian Hobby"=>"Falco subbuteo", -"Marsh Warbler"=>"Acrocephalus palustris", -"Wood Sandpiper"=>"Tringa glareola", -"Tawny Owl"=>"Strix aluco", -"Lesser Whitethroat"=>"Sylvia curruca", -"Barnacle Goose"=>"Branta leucopsis", -"Common Goldeneye"=>"Bucephala clangula", -"Western Marsh Harrier"=>"Circus aeruginosus", -"Common Buzzard"=>"Buteo buteo", -"Sanderling"=>"Calidris alba", -"Little Gull"=>"Larus minutus", -"Eurasian Magpie"=>"Pica pica", -"Willow Warbler"=>"Phylloscopus trochilus", -"Wood Warbler"=>"Phylloscopus sibilatrix", -"Great Crested Grebe"=>"Podiceps cristatus", -"Eurasian Jay"=>"Garrulus glandarius", -"Common Redstart"=>"Phoenicurus phoenicurus", -"Blue-headed Wagtail"=>"Motacilla flava", -"Common Swift"=>"Apus apus", -"Marsh Tit"=>"Poecile palustris", -"Goldcrest"=>"Regulus regulus", -"European Golden Plover"=>"Pluvialis apricaria", -"Eurasian Bullfinch"=>"Pyrrhula pyrrhula", -"Common Whitethroat"=>"Sylvia communis", -"Meadow Pipit"=>"Anthus pratensis", -"Greylag Goose"=>"Anser anser", -"Spotted Flycatcher"=>"Muscicapa striata", -"European Greenfinch"=>"Carduelis chloris", -"Common Greenshank"=>"Tringa nebularia", -"Great Spotted Woodpecker"=>"Dendrocopos major", -"Greater Canada Goose"=>"Branta canadensis", -"Mistle Thrush"=>"Turdus viscivorus", -"Great Black-backed Gull"=>"Larus marinus", -"Goosander"=>"Mergus merganser", -"Great Egret"=>"Casmerodius albus", -"Northern Goshawk"=>"Accipiter gentilis", -"Dunnock"=>"Prunella modularis", -"Stock Dove"=>"Columba oenas", -"Common Wood Pigeon"=>"Columba palumbus", -"Eurasian Woodcock"=>"Scolopax rusticola", -"House Sparrow"=>"Passer domesticus", -"Common House Martin"=>"Delichon urbicum", -"Red Knot"=>"Calidris canutus", -"Western Jackdaw"=>"Corvus monedula", -"Brambling"=>"Fringilla montifringilla", -"Northern Lapwing"=>"Vanellus vanellus", -"European Reed Warbler"=>"Acrocephalus scirpaceus", -"Lesser Black-backed Gull"=>"Larus fuscus", -"Little Egret"=>"Egretta garzetta", -"Little Stint"=>"Calidris minuta", -"Common Linnet"=>"Carduelis cannabina", -"Mute Swan"=>"Cygnus olor", -"Common Cuckoo"=>"Cuculus canorus", -"Black-headed Gull"=>"Larus ridibundus", -"Greater White-fronted Goose"=>"Anser albifrons", -"Great Tit"=>"Parus major", -"Redwing"=>"Turdus iliacus", -"Gadwall"=>"Anas strepera", -"Fieldfare"=>"Turdus pilaris", -"Tufted Duck"=>"Aythya fuligula", -"Crested Tit"=>"Lophophanes cristatus", -"Willow Tit"=>"Poecile montanus", -"Eurasian Coot"=>"Fulica atra", -"Common Blackbird"=>"Turdus merula", -"Smew"=>"Mergus albellus", -"Common Sandpiper"=>"Actitis hypoleucos", -"Sand Martin"=>"Riparia riparia", -"Purple Sandpiper"=>"Calidris maritima", -"Northern Pintail"=>"Anas acuta", -"Blue Tit"=>"Cyanistes caeruleus", -"European Goldfinch"=>"Carduelis carduelis", -"Eurasian Whimbrel"=>"Numenius phaeopus", -"Common Reed Bunting"=>"Emberiza schoeniclus", -"Eurasian Tree Sparrow"=>"Passer montanus", -"Rook"=>"Corvus frugilegus", -"European Robin"=>"Erithacus rubecula", -"Bar-tailed Godwit"=>"Limosa lapponica", -"Dark-bellied Brent Goose"=>"Branta bernicla", -"Eurasian Oystercatcher"=>"Haematopus ostralegus", -"Eurasian Siskin"=>"Carduelis spinus", -"Northern Shoveler"=>"Anas clypeata", -"Eurasian Wigeon"=>"Anas penelope", -"Eurasian Sparrow Hawk"=>"Accipiter nisus", -"Icterine Warbler"=>"Hippolais icterina", -"Common Starling"=>"Sturnus vulgaris", -"Long-tailed Tit"=>"Aegithalos caudatus", -"Ruddy Turnstone"=>"Arenaria interpres", -"Mew Gull"=>"Larus canus", -"Common Pochard"=>"Aythya ferina", -"Common Chiffchaff"=>"Phylloscopus collybita", -"Greater Scaup"=>"Aythya marila", -"Common Kestrel"=>"Falco tinnunculus", -"Garden Warbler"=>"Sylvia borin", -"Eurasian Collared Dove"=>"Streptopelia decaocto", -"Eurasian Skylark"=>"Alauda arvensis", -"Common Chaffinch"=>"Fringilla coelebs", -"Common Moorhen"=>"Gallinula chloropus", -"Water Pipit"=>"Anthus spinoletta", -"Mallard"=>"Anas platyrhynchos", -"Winter Wren"=>"Troglodytes troglodytes", -"Common Teal"=>"Anas crecca", -"Green Sandpiper"=>"Tringa ochropus", -"White Wagtail"=>"Motacilla alba", -"Eurasian Curlew"=>"Numenius arquata", -"Song Thrush"=>"Turdus philomelos", -"European Herring Gull"=>"Larus argentatus", -"Grey Plover"=>"Pluvialis squatarola", -"Carrion Crow"=>"Corvus corone", -"Coal Tit"=>"Periparus ater", -"Spotted Redshank"=>"Tringa erythropus", -"Blackcap"=>"Sylvia atricapilla", -"Egyptian Vulture"=>"Neophron percnopterus", -"Razorbill"=>"Alca torda", -"Alpine Swift"=>"Apus melba", -"Long-legged Buzzard"=>"Buteo rufinus", -"Audouin`s Gull"=>"Larus audouinii", -"Balearic Shearwater"=>"Puffinus mauretanicus", -"Upland Sandpiper"=>"Bartramia longicauda", -"Greater Spotted Eagle"=>"Aquila clanga", -"Ring Ouzel"=>"Turdus torquatus", -"Yellow-browed Warbler"=>"Phylloscopus inornatus", -"Blue Rock Thrush"=>"Monticola solitarius", -"Buff-breasted Sandpiper"=>"Tryngites subruficollis", -"Jack Snipe"=>"Lymnocryptes minimus", -"White-rumped Sandpiper"=>"Calidris fuscicollis", -"Ruddy Shelduck"=>"Tadorna ferruginea", -"Cetti's Warbler"=>"Cettia cetti", -"Citrine Wagtail"=>"Motacilla citreola", -"Roseate Tern"=>"Sterna dougallii", -"Black-legged Kittiwake"=>"Rissa tridactyla", -"Pygmy Cormorant"=>"Phalacrocorax pygmeus", -"Booted Eagle"=>"Aquila pennata", -"Lesser White-fronted Goose"=>"Anser erythropus", -"Little Bunting"=>"Emberiza pusilla", -"Eleonora's Falcon"=>"Falco eleonorae", -"European Serin"=>"Serinus serinus", -"Twite"=>"Carduelis flavirostris", -"Yellow-legged Gull"=>"Larus michahellis", -"Gyr Falcon"=>"Falco rusticolus", -"Greenish Warbler"=>"Phylloscopus trochiloides", -"Red-necked Phalarope"=>"Phalaropus lobatus", -"Mealy Redpoll"=>"Carduelis flammea", -"Glaucous Gull"=>"Larus hyperboreus", -"Great Skua"=>"Stercorarius skua", -"Great Bustard"=>"Otis tarda", -"Velvet Scoter"=>"Melanitta fusca", -"Pine Grosbeak"=>"Pinicola enucleator", -"House Crow"=>"Corvus splendens", -"Hume`s Leaf Warbler"=>"Phylloscopus humei", -"Great Northern Loon"=>"Gavia immer", -"Long-tailed Duck"=>"Clangula hyemalis", -"Lapland Longspur"=>"Calcarius lapponicus", -"Northern Gannet"=>"Morus bassanus", -"Eastern Imperial Eagle"=>"Aquila heliaca", -"Little Auk"=>"Alle alle", -"Lesser Spotted Woodpecker"=>"Dendrocopos minor", -"Iceland Gull"=>"Larus glaucoides", -"Parasitic Jaeger"=>"Stercorarius parasiticus", -"Bewick`s Swan"=>"Cygnus bewickii", -"Little Bustard"=>"Tetrax tetrax", -"Little Crake"=>"Porzana parva", -"Baillon`s Crake"=>"Porzana pusilla", -"Long-tailed Jaeger"=>"Stercorarius longicaudus", -"King Eider"=>"Somateria spectabilis", -"Greater Short-toed Lark"=>"Calandrella brachydactyla", -"Houbara Bustard"=>"Chlamydotis undulata", -"Curlew Sandpiper"=>"Calidris ferruginea", -"Common Crossbill"=>"Loxia curvirostra", -"European Shag"=>"Phalacrocorax aristotelis", -"Horned Grebe"=>"Podiceps auritus", -"Common Quail"=>"Coturnix coturnix", -"Bearded Vulture"=>"Gypaetus barbatus", -"Lanner Falcon"=>"Falco biarmicus", -"Middle Spotted Woodpecker"=>"Dendrocopos medius", -"Pomarine Jaeger"=>"Stercorarius pomarinus", -"Red-breasted Merganser"=>"Mergus serrator", -"Eurasian Black Vulture"=>"Aegypius monachus", -"Eurasian Dotterel"=>"Charadrius morinellus", -"Common Nightingale"=>"Luscinia megarhynchos", -"Northern willow warbler"=>"Phylloscopus trochilus acredula", -"Manx Shearwater"=>"Puffinus puffinus", -"Northern Fulmar"=>"Fulmarus glacialis", -"Eurasian Eagle Owl"=>"Bubo bubo", -"Orphean Warbler"=>"Sylvia hortensis", -"Melodious Warbler"=>"Hippolais polyglotta", -"Pallas's Leaf Warbler"=>"Phylloscopus proregulus", -"Atlantic Puffin"=>"Fratercula arctica", -"Black-throated Loon"=>"Gavia arctica", -"Bohemian Waxwing"=>"Bombycilla garrulus", -"Marsh Sandpiper"=>"Tringa stagnatilis", -"Great Snipe"=>"Gallinago media", -"Squacco Heron"=>"Ardeola ralloides", -"Long-eared Owl"=>"Asio otus", -"Caspian Tern"=>"Hydroprogne caspia", -"Red-breasted Goose"=>"Branta ruficollis", -"Red-throated Loon"=>"Gavia stellata", -"Common Rosefinch"=>"Carpodacus erythrinus", -"Red-footed Falcon"=>"Falco vespertinus", -"Ross's Goose"=>"Anser rossii", -"Red Phalarope"=>"Phalaropus fulicarius", -"Pied Wagtail"=>"Motacilla yarrellii", -"Rose-coloured Starling"=>"Sturnus roseus", -"Rough-legged Buzzard"=>"Buteo lagopus", -"Saker Falcon"=>"Falco cherrug", -"European Roller"=>"Coracias garrulus", -"Short-toed Eagle"=>"Circaetus gallicus", -"Peregrine Falcon"=>"Falco peregrinus", -"Merlin"=>"Falco columbarius", -"Snow Goose"=>"Anser caerulescens", -"Snowy Owl"=>"Bubo scandiacus", -"Snow Bunting"=>"Plectrophenax nivalis", -"Common Grasshopper Warbler"=>"Locustella naevia", -"Golden Eagle"=>"Aquila chrysaetos", -"Black-winged Stilt"=>"Himantopus himantopus", -"Steppe Eagle"=>"Aquila nipalensis", -"Pallid Harrier"=>"Circus macrourus", -"European Storm-petrel"=>"Hydrobates pelagicus", -"Horned Lark"=>"Eremophila alpestris", -"Eurasian Treecreeper"=>"Certhia familiaris", -"Taiga Bean Goose"=>"Anser fabalis", -"Temminck`s Stint"=>"Calidris temminckii", -"Terek Sandpiper"=>"Xenus cinereus", -"Tundra Bean Goose"=>"Anser serrirostris", -"European Turtle Dove"=>"Streptopelia turtur", -"Leach`s Storm-petrel"=>"Oceanodroma leucorhoa", -"Eurasian Griffon Vulture"=>"Gyps fulvus", -"Paddyfield Warbler"=>"Acrocephalus agricola", -"Osprey"=>"Pandion haliaetus", -"Firecrest"=>"Regulus ignicapilla", -"Water Rail"=>"Rallus aquaticus", -"European Honey Buzzard"=>"Pernis apivorus", -"Eurasian Golden Oriole"=>"Oriolus oriolus", -"Whooper Swan"=>"Cygnus cygnus", -"Two-barred Crossbill"=>"Loxia leucoptera", -"White-tailed Eagle"=>"Haliaeetus albicilla", -"Atlantic Murre"=>"Uria aalge", -"Garganey"=>"Anas querquedula", -"Black Redstart"=>"Phoenicurus ochruros", -"Common Scoter"=>"Melanitta nigra", -"Rock Pipit"=>"Anthus petrosus", -"Lesser Spotted Eagle"=>"Aquila pomarina", -"Cattle Egret"=>"Bubulcus ibis", -"White-winged Black Tern"=>"Chlidonias leucopterus", -"Black Stork"=>"Ciconia nigra", -"Mediterranean Gull"=>"Larus melanocephalus", -"Black Kite"=>"Milvus migrans", -"Yellow Wagtail"=>"Motacilla flavissima", -"Red-necked Grebe"=>"Podiceps grisegena", -"Gull-billed Tern"=>"Gelochelidon nilotica", -"Pectoral Sandpiper"=>"Calidris melanotos", -"Barred Warbler"=>"Sylvia nisoria", -"Red-throated Pipit"=>"Anthus cervinus", -"Grey Wagtail"=>"Motacilla cinerea", -"Richard`s Pipit"=>"Anthus richardi", -"Black Woodpecker"=>"Dryocopus martius", -"Little Ringed Plover"=>"Charadrius dubius", -"Whiskered Tern"=>"Chlidonias hybrida", -"Lesser Redpoll"=>"Carduelis cabaret", -"Pallas' Bunting"=>"Emberiza pallasi", -"Ferruginous Duck"=>"Aythya nyroca", -"Whistling Swan"=>"Cygnus columbianus", -"Black Brant"=>"Branta nigricans", -"Marbled Teal"=>"Marmaronetta angustirostris", -"Canvasback"=>"Aythya valisineria", -"Redhead"=>"Aythya americana", -"Lesser Scaup"=>"Aythya affinis", -"Steller`s Eider"=>"Polysticta stelleri", -"Spectacled Eider"=>"Somateria fischeri", -"Harlequin Duck"=>"Histronicus histrionicus", -"Black Scoter"=>"Melanitta americana", -"Surf Scoter"=>"Melanitta perspicillata", -"Barrow`s Goldeneye"=>"Bucephala islandica", -"Falcated Duck"=>"Anas falcata", -"American Wigeon"=>"Anas americana", -"Blue-winged Teal"=>"Anas discors", -"American Black Duck"=>"Anas rubripes", -"Baikal Teal"=>"Anas formosa", -"Green-Winged Teal"=>"Anas carolinensis", -"Hazel Grouse"=>"Bonasa bonasia", -"Rock Partridge"=>"Alectoris graeca", -"Red-legged Partridge"=>"Alectoris rufa", -"Yellow-billed Loon"=>"Gavia adamsii", -"Cory`s Shearwater"=>"Calonectris borealis", -"Madeiran Storm-Petrel"=>"Oceanodroma castro", -"Great White Pelican"=>"Pelecanus onocrotalus", -"Dalmatian Pelican"=>"Pelecanus crispus", -"American Bittern"=>"Botaurus lentiginosus", -"Glossy Ibis"=>"Plegadis falcinellus", -"Spanish Imperial Eagle"=>"Aquila adalberti", -"Lesser Kestrel"=>"Falco naumanni", -"Houbara Bustard"=>"Chlamydotis undulata", -"Crab-Plover"=>"Dromas ardeola", -"Cream-coloured Courser"=>"Cursorius cursor", -"Collared Pratincole"=>"Glareola pratincola", -"Black-winged Pratincole"=>"Glareola nordmanni", -"Killdeer"=>"Charadrius vociferus", -"Lesser Sand Plover"=>"Charadrius mongolus", -"Greater Sand Plover"=>"Charadrius leschenaultii", -"Caspian Plover"=>"Charadrius asiaticus", -"American Golden Plover"=>"Pluvialis dominica", -"Pacific Golden Plover"=>"Pluvialis fulva", -"Sharp-tailed Sandpiper"=>"Calidris acuminata", -"Broad-billed Sandpiper"=>"Limicola falcinellus", -"Spoon-Billed Sandpiper"=>"Eurynorhynchus pygmaeus", -"Short-Billed Dowitcher"=>"Limnodromus griseus", -"Long-billed Dowitcher"=>"Limnodromus scolopaceus", -"Hudsonian Godwit"=>"Limosa haemastica", -"Little Curlew"=>"Numenius minutus", -"Lesser Yellowlegs"=>"Tringa flavipes", -"Wilson`s Phalarope"=>"Phalaropus tricolor", -"Pallas`s Gull"=>"Larus ichthyaetus", -"Laughing Gull"=>"Larus atricilla", -"Franklin`s Gull"=>"Larus pipixcan", -"Bonaparte`s Gull"=>"Larus philadelphia", -"Ring-billed Gull"=>"Larus delawarensis", -"American Herring Gull"=>"Larus smithsonianus", -"Caspian Gull"=>"Larus cachinnans", -"Ivory Gull"=>"Pagophila eburnea", -"Royal Tern"=>"Sterna maxima", -"Brünnich`s Murre"=>"Uria lomvia", -"Crested Auklet"=>"Aethia cristatella", -"Parakeet Auklet"=>"Cyclorrhynchus psittacula", -"Tufted Puffin"=>"Lunda cirrhata", -"Laughing Dove"=>"Streptopelia senegalensis", -"Great Spotted Cuckoo"=>"Clamator glandarius", -"Great Grey Owl"=>"Strix nebulosa", -"Tengmalm`s Owl"=>"Aegolius funereus", -"Red-Necked Nightjar"=>"Caprimulgus ruficollis", -"Chimney Swift"=>"Chaetura pelagica", -"Green Bea-Eater"=>"Merops orientalis", -"Grey-headed Woodpecker"=>"Picus canus", -"Lesser Short-Toed Lark"=>"Calandrella rufescens", -"Eurasian Crag Martin"=>"Hirundo rupestris", -"Red-rumped Swallow"=>"Cecropis daurica", -"Blyth`s Pipit"=>"Anthus godlewskii", -"Pechora Pipit"=>"Anthus gustavi", -"Grey-headed Wagtail"=>"Motacilla thunbergi", -"Yellow-Headed Wagtail"=>"Motacilla lutea", -"White-throated Dipper"=>"Cinclus cinclus", -"Rufous-Tailed Scrub Robin"=>"Cercotrichas galactotes", -"Thrush Nightingale"=>"Luscinia luscinia", -"White-throated Robin"=>"Irania gutturalis", -"Caspian Stonechat"=>"Saxicola maura variegata", -"Western Black-eared Wheatear"=>"Oenanthe hispanica", -"Rufous-tailed Rock Thrush"=>"Monticola saxatilis", -"Red-throated Thrush/Black-throated"=>"Turdus ruficollis", -"American Robin"=>"Turdus migratorius", -"Zitting Cisticola"=>"Cisticola juncidis", -"Lanceolated Warbler"=>"Locustella lanceolata", -"River Warbler"=>"Locustella fluviatilis", -"Blyth`s Reed Warbler"=>"Acrocephalus dumetorum", -"Caspian Reed Warbler"=>"Acrocephalus fuscus", -"Aquatic Warbler"=>"Acrocephalus paludicola", -"Booted Warbler"=>"Acrocephalus caligatus", -"Marmora's Warbler"=>"Sylvia sarda", -"Dartford Warbler"=>"Sylvia undata", -"Subalpine Warbler"=>"Sylvia cantillans", -"Ménétries's Warbler"=>"Sylvia mystacea", -"Rüppel's Warbler"=>"Sylvia rueppelli", -"Asian Desert Warbler"=>"Sylvia nana", -"Western Orphean Warbler"=>"Sylvia hortensis hortensis", -"Arctic Warbler"=>"Phylloscopus borealis", -"Radde`s Warbler"=>"Phylloscopus schwarzi", -"Western Bonelli`s Warbler"=>"Phylloscopus bonelli", -"Red-breasted Flycatcher"=>"Ficedula parva", -"Eurasian Penduline Tit"=>"Remiz pendulinus", -"Daurian Shrike"=>"Lanius isabellinus", -"Long-Tailed Shrike"=>"Lanius schach", -"Lesser Grey Shrike"=>"Lanius minor", -"Southern Grey Shrike"=>"Lanius meridionalis", -"Masked Shrike"=>"Lanius nubicus", -"Spotted Nutcracker"=>"Nucifraga caryocatactes", -"Daurian Jackdaw"=>"Corvus dauuricus", -"Purple-Backed Starling"=>"Sturnus sturninus", -"Red-Fronted Serin"=>"Serinus pusillus", -"Arctic Redpoll"=>"Carduelis hornemanni", -"Scottish Crossbill"=>"Loxia scotica", -"Parrot Crossbill"=>"Loxia pytyopsittacus", -"Black-faced Bunting"=>"Emberiza spodocephala", -"Pink-footed Goose"=>"Anser brachyrhynchus", -"Black-winged Kite"=>"Elanus caeruleus", -"European Bee-eater"=>"Merops apiaster", -"Sabine`s Gull"=>"Larus sabini", -"Sooty Shearwater"=>"Puffinus griseus", -"Lesser Canada Goose"=>"Branta hutchinsii", -"Ring-necked Duck"=>"Aythya collaris", -"Greater Flamingo"=>"Phoenicopterus roseus", -"Iberian Chiffchaff"=>"Phylloscopus ibericus", -"Ashy-headed Wagtail"=>"Motacilla cinereocapilla", -"Stilt Sandpiper"=>"Calidris himantopus", -"Siberian Stonechat"=>"Saxicola maurus", -"Greater Yellowlegs"=>"Tringa melanoleuca", -"Forster`s Tern"=>"Sterna forsteri", -"Dusky Warbler"=>"Phylloscopus fuscatus", -"Cirl Bunting"=>"Emberiza cirlus", -"Olive-backed Pipit"=>"Anthus hodgsoni", -"Sociable Lapwing"=>"Vanellus gregarius", -"Spotted Sandpiper"=>"Actitis macularius", -"Baird`s Sandpiper"=>"Calidris bairdii", -"Rustic Bunting"=>"Emberiza rustica", -"Yellow-browed Bunting"=>"Emberiza chrysophrys", -"Great Shearwater"=>"Puffinus gravis", -"Bonelli`s Eagle"=>"Aquila fasciata", -"Calandra Lark"=>"Melanocorypha calandra", -"Sardinian Warbler"=>"Sylvia melanocephala", -"Ross's Gull"=>"Larus roseus", -"Yellow-Breasted Bunting"=>"Emberiza aureola", -"Pine Bunting"=>"Emberiza leucocephalos", -"Black Guillemot"=>"Cepphus grylle", -"Pied-billed Grebe"=>"Podilymbus podiceps", -"Soft-plumaged Petrel"=>"Pterodroma mollis", -"Bulwer's Petrel"=>"Bulweria bulwerii", -"White-Faced Storm-Petrel"=>"Pelagodroma marina", -"Pallas’s Fish Eagle"=>"Haliaeetus leucoryphus", -"Sandhill Crane"=>"Grus canadensis", -"Macqueen’s Bustard"=>"Chlamydotis macqueenii", -"White-tailed Lapwing"=>"Vanellus leucurus", -"Great Knot"=>"Calidris tenuirostris", -"Semipalmated Sandpiper"=>"Calidris pusilla", -"Red-necked Stint"=>"Calidris ruficollis", -"Slender-billed Curlew"=>"Numenius tenuirostris", -"Bridled Tern"=>"Onychoprion anaethetus", -"Pallas’s Sandgrouse"=>"Syrrhaptes paradoxus", -"European Scops Owl"=>"Otus scops", -"Northern Hawk Owl"=>"Surnia ulula", -"White-Throated Needletail"=>"Hirundapus caudacutus", -"Belted Kingfisher"=>"Ceryle alcyon", -"Blue-cheeked Bee-eater"=>"Merops persicus", -"Black-headed Wagtail"=>"Motacilla feldegg", -"Northern Mockingbird"=>"Mimus polyglottos", -"Alpine Accentor"=>"Prunella collaris", -"Red-flanked Bluetail"=>"Tarsiger cyanurus", -"Isabelline Wheatear"=>"Oenanthe isabellina", -"Pied Wheatear"=>"Oenanthe pleschanka", -"Eastern Black-eared Wheatear"=>"Oenanthe melanoleuca", -"Desert Wheatear"=>"Oenanthe deserti", -"White`s Thrush"=>"Zoothera aurea", -"Siberian Thrush"=>"Zoothera sibirica", -"Eyebrowed Thrush"=>"Turdus obscurus", -"Dusky Thrush"=>"Turdus eunomus", -"Black-throated Thrush"=>"Turdus atrogularis", -"Pallas`s Grasshopper Warbler"=>"Locustella certhiola", -"Spectacled Warbler"=>"Sylvia conspicillata", -"Two-barred Warbler"=>"Phylloscopus plumbeitarsus", -"Eastern Bonelli’s Warbler"=>"Phylloscopus orientalis", -"Collared Flycatcher"=>"Ficedula albicollis", -"Wallcreeper"=>"Tichodroma muraria", -"Turkestan Shrike"=>"Lanius phoenicuroides", -"Steppe Grey Shrike"=>"Lanius pallidirostris", -"Spanish Sparrow"=>"Passer hispaniolensis", -"Red-eyed Vireo"=>"Vireo olivaceus", -"Myrtle Warbler"=>"Dendroica coronata", -"White-crowned Sparrow"=>"Zonotrichia leucophrys", -"White-throated Sparrow"=>"Zonotrichia albicollis", -"Cretzschmar`s Bunting"=>"Emberiza caesia", -"Chestnut Bunting"=>"Emberiza rutila", -"Red-headed Bunting"=>"Emberiza bruniceps", -"Black-headed Bunting"=>"Emberiza melanocephala", -"Indigo Bunting"=>"Passerina cyanea", -"Balearic Woodchat Shrike"=>"Lanius senator badius", -"Demoiselle Crane"=>"Grus virgo", -"Chough"=>"Pyrrhocorax pyrrhocorax", -"Red-Billed Chough"=>"Pyrrhocorax graculus", -"Elegant Tern"=>"Sterna elegans", -"Chukar"=>"Alectoris chukar", -"Yellow-Billed Cuckoo"=>"Coccyzus americanus", -"American Sandwich Tern"=>"Sterna sandvicensis acuflavida", -"Olive-Tree Warbler"=>"Hippolais olivetorum", -"Eastern Olivaceous Warbler"=>"Acrocephalus pallidus", -"Indian Cormorant"=>"Phalacrocorax fuscicollis", -"Spur-Winged Lapwing"=>"Vanellus spinosus", -"Yelkouan Shearwater"=>"Puffinus yelkouan", -"Trumpeter Finch"=>"Bucanetes githagineus", -"Red Grouse"=>"Lagopus scoticus", -"Rock Ptarmigan"=>"Lagopus mutus", -"Long-Tailed Cormorant"=>"Phalacrocorax africanus", -"Double-crested Cormorant"=>"Phalacrocorax auritus", -"Magnificent Frigatebird"=>"Fregata magnificens", -"Naumann's Thrush"=>"Turdus naumanni", -"Oriental Pratincole"=>"Glareola maldivarum", -"Bufflehead"=>"Bucephala albeola", -"Snowfinch"=>"Montifrigilla nivalis", -"Ural owl"=>"Strix uralensis", -"Spanish Wagtail"=>"Motacilla iberiae", -"Song Sparrow"=>"Melospiza melodia", -"Rock Bunting"=>"Emberiza cia", -"Siberian Rubythroat"=>"Luscinia calliope", -"Pallid Swift"=>"Apus pallidus", -"Eurasian Pygmy Owl"=>"Glaucidium passerinum", -"Madeira Little Shearwater"=>"Puffinus baroli", -"House Finch"=>"Carpodacus mexicanus", -"Green Heron"=>"Butorides virescens", -"Solitary Sandpiper"=>"Tringa solitaria", -"Heuglin's Gull"=>"Larus heuglini" -); - -function array_to_json( $array ){ - - if( !is_array( $array ) ){ - return false; - } - - $associative = count( array_diff( array_keys($array), array_keys( array_keys( $array )) )); - if( $associative ){ - - $construct = array(); - foreach( $array as $key => $value ){ - - // We first copy each key/value pair into a staging array, - // formatting each key and value properly as we go. - - // Format the key: - if( is_numeric($key) ){ - $key = "key_$key"; - } - $key = "\"".addslashes($key)."\""; - - // Format the value: - if( is_array( $value )){ - $value = array_to_json( $value ); - } else if( !is_numeric( $value ) || is_string( $value ) ){ - $value = "\"".addslashes($value)."\""; - } - - // Add to staging array: - $construct[] = "$key: $value"; - } - - // Then we collapse the staging array into the JSON form: - $result = "{ " . implode( ", ", $construct ) . " }"; - - } else { // If the array is a vector (not associative): - - $construct = array(); - foreach( $array as $value ){ - - // Format the value: - if( is_array( $value )){ - $value = array_to_json( $value ); - } else if( !is_numeric( $value ) || is_string( $value ) ){ - $value = "'".addslashes($value)."'"; - } - - // Add to staging array: - $construct[] = $value; - } - - // Then we collapse the staging array into the JSON form: - $result = "[ " . implode( ", ", $construct ) . " ]"; - } - - return $result; -} - -$result = array(); -foreach ($items as $key=>$value) { - if (strpos(strtolower($key), $q) !== false) { - array_push($result, array("id"=>$value, "label"=>$key, "value" => strip_tags($key))); - } - if (count($result) > 11) - break; -} -echo array_to_json($result); - -?> diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/xml.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/xml.html deleted file mode 100644 index 751059455d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/autocomplete/xml.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - jQuery UI Autocomplete - XML data parsed once - - - - - - - - - - - - -
      - -
      - - -
      - -
      - Result: -
      -
      - -
      - - - -
      -

      This demo shows how to retrieve some XML data, parse it using jQuery's methods, then provide it to the autocomplete as the datasource.

      -

      This should also serve as a reference on how to parse a remote XML datasource - the parsing would just happen for each request within the source-callback.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/checkbox.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/checkbox.html deleted file mode 100644 index 0caf958c36..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/checkbox.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - jQuery UI Button - Checkboxes - - - - - - - - - - - -
      - - - -
      - - - -
      - -
      - - - -
      -

      A checkbox is styled as a toggle button with the button widget. The label element associated with the checkbox is used for the button text.

      -

      This demo also demonstrates three checkboxes styled as a button set by calling .buttonset() on a common container.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/default.html deleted file mode 100644 index 1ea3fa7965..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/default.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - jQuery UI Button - Default functionality - - - - - - - - - - -
      - - - - - -An anchor - -
      - - - -
      -

      Examples of the markup that can be used for buttons: A button element, an input of type submit and an anchor.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/icons.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/icons.html deleted file mode 100644 index 1badb3f5d0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/icons.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - jQuery UI Button - Icons - - - - - - - - - - -
      - - - - - - -
      - - - -
      -

      Some buttons with various combinations of text and icons, here specified via metadata.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/index.html deleted file mode 100644 index 23977c8207..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - jQuery UI Button Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/radio.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/radio.html deleted file mode 100644 index 5f725ca8d6..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/radio.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - jQuery UI Button - Radios - - - - - - - - - - -
      - -
      -
      - - - -
      -
      - -
      - - - -
      -

      A set of three radio buttons transformed into a button set.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/splitbutton.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/splitbutton.html deleted file mode 100644 index c4e6377a13..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/splitbutton.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - jQuery UI Button - Split button - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      An example of a split button built with two buttons: A plan button with just text, one with only a primary icon and no text. Both are grouped together in a set.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/toolbar.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/toolbar.html deleted file mode 100644 index d68b2d9ca6..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/button/toolbar.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - jQuery UI Button - Toolbar - - - - - - - - - - - -
      - - - - - - - - - - - - - - - - - - -
      - - - -
      -

      - A mediaplayer toolbar. Take a look at the underlying markup: A few button elements, - an input of type checkbox for the Shuffle button, and three inputs of type radio for the Repeat options. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/alt-field.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/alt-field.html deleted file mode 100644 index c60b21af78..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/alt-field.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - jQuery UI Datepicker - Populate alternate field - - - - - - - - - - -
      - -

      Date:  

      - -
      - - - -
      -

      Populate an alternate field with its own date format whenever a date is selected using the altField and altFormat options. This feature could be used to present a human-friendly date for user selection, while passing a more computer-friendly date through for further processing.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/animation.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/animation.html deleted file mode 100644 index 9814b98f88..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/animation.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - jQuery UI Datepicker - Animations - - - - - - - - - - - - - - - - - -
      - -

      Date:

      - -

      Animations:
      - -

      - -
      - - - -
      -

      Use different animations when opening or closing the datepicker. Choose an animation from the dropdown, then click on the input to see its effect. You can use one of the three standard animations or any of the UI Effects.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/buttonbar.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/buttonbar.html deleted file mode 100644 index 3b3be3bb33..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/buttonbar.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - jQuery UI Datepicker - Display button bar - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      Display a button for selecting Today's date and a Done button for closing the calendar with the boolean showButtonPanel option. Each button is enabled by default when the bar is displayed, but can be turned off with additional options. Button text is customizable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-formats.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-formats.html deleted file mode 100644 index e1ac6737bc..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-formats.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - jQuery UI Datepicker - Format date - - - - - - - - - - -
      - -

      Date:

      - -

      Format options:
      - -

      - -
      - - - -
      -

      Display date feedback in a variety of ways. Choose a date format from the dropdown, then click on the input and select a date to see it in that format.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-range.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-range.html deleted file mode 100644 index bf9b9a3e5c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/date-range.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - jQuery UI Datepicker - Select a Date Range - - - - - - - - - - -
      - - - - - - -
      - - - -
      -

      Select the date range to search for.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/default.html deleted file mode 100644 index d50ac0de7a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/default.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - jQuery UI Datepicker - Default functionality - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/dropdown-month-year.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/dropdown-month-year.html deleted file mode 100644 index 8392a1593b..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/dropdown-month-year.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - jQuery UI Datepicker - Display month & year menus - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      Show month and year dropdowns in place of the static month/year header to facilitate navigation through large timeframes. Add the boolean changeMonth and changeYear options.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/icon-trigger.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/icon-trigger.html deleted file mode 100644 index 5f4edc7f31..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/icon-trigger.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - jQuery UI Datepicker - Icon trigger - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      Click the icon next to the input field to show the datepicker. Set the datepicker to open on focus (default behavior), on icon click, or both.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/images/calendar.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/images/calendar.gif deleted file mode 100644 index d0abaa7c0b..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/images/calendar.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/index.html deleted file mode 100644 index ed2477402d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - jQuery UI Datepicker Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/inline.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/inline.html deleted file mode 100644 index 19c4b04208..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/inline.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - jQuery UI Datepicker - Display inline - - - - - - - - - - -
      - -Date:
      - -
      - - - -
      -

      Display the datepicker embedded in the page instead of in an overlay. Simply call .datepicker() on a div instead of an input.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/localization.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/localization.html deleted file mode 100644 index 91036111f8..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/localization.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - jQuery UI Datepicker - Localize calendar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -

      Date:   -

      - -
      - - - -
      -

      Localize the datepicker calendar language and format (English / Western formatting is the default). The datepicker includes built-in support for languages that read right-to-left, such as Arabic and Hebrew.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/min-max.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/min-max.html deleted file mode 100644 index e27339e10f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/min-max.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - jQuery UI Datepicker - Restrict date range - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      Restrict the range of selectable dates with the minDate and maxDate options. Set the beginning and end dates as actual dates (new Date(2009, 1 - 1, 26)), as a numeric offset from today (-20), or as a string of periods and units ('+1M +10D'). For the last, use 'D' for days, 'W' for weeks, 'M' for months, or 'Y' for years.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/multiple-calendars.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/multiple-calendars.html deleted file mode 100644 index 0c762f7297..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/multiple-calendars.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - jQuery UI Datepicker - Display multiple months - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      Set the numberOfMonths option to an integer of 2 or more to show multiple months in a single datepicker.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/other-months.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/other-months.html deleted file mode 100644 index 78a04f2c3f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/other-months.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - jQuery UI Datepicker - Dates in other months - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      The datepicker can show dates that come from other than the main month - being displayed. These other dates can also be made selectable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/show-week.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/show-week.html deleted file mode 100644 index 1cdb349bd7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/datepicker/show-week.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - jQuery UI Datepicker - Show week of the year - - - - - - - - - - -
      - -

      Date:

      - -
      - - - -
      -

      The datepicker can show the week of the year. The default calculation follows - the ISO 8601 definition: the week starts on Monday, the first week of the year - contains the first Thursday of the year. This means that some days from one - year may be placed into weeks 'belonging' to another year.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/demos.css b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/demos.css deleted file mode 100644 index 2d2ce1fc82..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/demos.css +++ /dev/null @@ -1,334 +0,0 @@ -body { - font-size: 62.5%; -} - -table { - font-size: 1em; -} - -/* Site - -------------------------------- */ - -body { - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; -} - -/* Layout - -------------------------------- */ - -.layout-grid { - width: 960px; -} - -.layout-grid td { - vertical-align: top; -} - -.layout-grid td.left-nav { - width: 140px; -} - -.layout-grid td.normal { - border-left: 1px solid #eee; - padding: 20px 24px; - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; -} - -.layout-grid td.demos { - background: url('/images/demos_bg.jpg') no-repeat; - height: 337px; - overflow: hidden; -} - -/* Normal - -------------------------------- */ - -.normal h3, -.normal h4 { - margin: 0; - font-weight: normal; -} - -.normal h3 { - padding: 0 0 9px; - font-size: 1.8em; -} - -.normal h4 { - padding-bottom: 21px; - border-bottom: 1px dashed #999; - font-size: 1.2em; - font-weight: bold; -} - -.normal p { - font-size: 1.2em; -} - -/* Demos */ - -.demos-nav, .demos-nav dt, .demos-nav dd, .demos-nav ul, .demos-nav li { - margin: 0; - padding: 0 -} - -.demos-nav { - float: left; - width: 170px; - font-size: 1.3em; -} - -.demos-nav dt, -.demos-nav h4 { - margin: 0; - padding: 0; - font: normal 1.1em "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; - color: #e87b10; -} - -.demos-nav dt, -.demos-nav h4 { - margin-top: 1.5em; - margin-bottom: 0; - padding-left: 8px; - padding-bottom:5px; - line-height: 1.2em; - border-bottom: 1px solid #F4F4F4; -} - -.demos-nav dd a, -.demos-nav li a { - border-bottom: 1px solid #F4F4F4; - display:block; - padding: 4px 3px 4px 8px; - font-size: 90%; - text-decoration: none; - color: #555 ; - margin:2px 0; - height:13px; -} - -.demos-nav dd a:hover, -.demos-nav dd a:focus, -.demos-nav dd a:hover, -.demos-nav dd a:focus { - background: #f3f3f3; - color:#000; - -moz-border-radius: 5px; -webkit-border-radius: 5px; -} - .demos-nav dd a.selected { - background: #555; - color:#ffffff; - -moz-border-radius: 5px; -webkit-border-radius: 5px; -} - - -/* new styles for demo pages, added by Filament 12.29.08 -eventually we should convert the font sizes to ems -- using px for now to minimize style conflicts -*/ - -.normal h3.demo-header { font-size:32px; padding:0 0 5px; border-bottom:1px solid #eee; text-transform: capitalize; } -.normal h4.demo-subheader { font-size:10px; text-transform: uppercase; color:#999; padding:8px 0 3px; border:0; margin:0; } -.normal a:link, -.normal a:visited { color:#1b75bb; text-decoration:none; } -.normal a:hover, -.normal a:active { color:#0b559b; } - -#demo-config { padding:20px 0 0; } - -#demo-frame { float:left; width:540px; height:380px; border:1px solid #ddd; overflow: auto; position: relative; } -#demo-frame h3, #demo-frame h4 { padding: 0; font-weight: bold; font-size: 1em; } - -#demo-config-menu { float:right; width:180px; } -#demo-config-menu h4 { font-size:13px; color:#666; font-weight:normal; border:0; padding-left:18px; } - -#demo-config-menu ul { list-style: none; padding: 0; margin: 0; } - -#demo-config-menu li { font-size:12px; padding:0 0 0 10px; margin:3px 0; zoom: 1; } - -#demo-config-menu li a:link, -#demo-config-menu li a:visited { display:block; padding:1px 8px 4px; border-bottom:1px dotted #b3b3b3; } -* html #demo-config-menu li a:link, -* html #demo-config-menu li a:visited { padding:1px 8px 2px; } -#demo-config-menu li a:hover, -#demo-config-menu li a:active { background-color:#f6f6f6; } - -#demo-config-menu li.demo-config-on { background: url(images/demo-config-on-tile.gif) repeat-x left center; } - -#demo-config-menu li.demo-config-on a:link, -#demo-config-menu li.demo-config-on a:visited, -#demo-config-menu li.demo-config-on a:hover, -#demo-config-menu li.demo-config-on a:active { background: url(images/demo-config-on.gif) no-repeat left; padding-left:18px; color:#fff; border:0; margin-left:-10px; margin-top: 0px; margin-bottom: 0px; } - -#demo-source, #demo-notes { - clear: both; - padding: 20px 0 0; - font-size: 1.3em; -} - -#demo-notes { width:520px; color:#333; font-size: 1em; } -#demo-notes p code, .demo-description p code { padding: 0; font-weight: bold; } -#demo-source pre, #demo-source code { padding: 0; } -code, pre { padding:8px 0 8px 20px ; font-size: 1.2em; line-height:130%; } - -#demo-source a:link, -#demo-source a:visited, -#demo-source a:hover, -#demo-source a:active { font-size:12px; padding-left:13px; background-position: left center; background-repeat: no-repeat; } - -#demo-source a.source-open:link, -#demo-source a.source-open:visited, -#demo-source a.source-open:hover, -#demo-source a.source-open:active { background-image: url(images/demo-spindown-open.gif); } - -#demo-source a.source-closed:link, -#demo-source a.source-closed:visited, -#demo-source a.source-closed:hover, -#demo-source a.source-closed:active { background-image: url(images/demo-spindown-closed.gif); } - -div.demo { - padding:12px; - font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif"; -} - -div.demo h3.docs { clear:left; font-size:12px; font-weight:normal; padding:0 0 1em; margin:0; } - -div.demo-description { - clear:both; - padding:12px; - font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif"; - font-size: 1.3em; - line-height: 1.4em; -} - -.ui-draggable, .ui-droppable { - background-position: top left; -} - -.left-nav .demos-nav { - padding-right: 10px; -} - -#demo-link { font-size:11px; padding-top: 6px; clear: both; overflow: hidden; } -#demo-link a span.ui-icon { float:left; margin-right:3px; } - -/* Component containers -----------------------------------*/ -#widget-docs .ui-widget { font-family: Trebuchet MS,Verdana,Arial,sans-serif; font-size: 1em; } -#widget-docs .ui-widget input, #widget-docs .ui-widget select, #widget-docs .ui-widget textarea, #widget-docs .ui-widget button { font-family: Trebuchet MS,Verdana,Arial,sans-serif; font-size: 1em; } -#widget-docs .ui-widget-header { border: 1px solid #ffffff; background: #464646 url(images/464646_40x100_textures_01_flat_100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } -#widget-docs .ui-widget-header a { color: #ffffff; } -#widget-docs .ui-widget-content { border: 1px solid #ffffff; background: #ffffff url(images/ffffff_40x100_textures_01_flat_75.png) 50% 50% repeat-x; color: #222222; } -#widget-docs .ui-widget-content a { color: #222222; } - -/* Interaction states -----------------------------------*/ -#widget-docs .ui-state-default, #widget-docs .ui-widget-content #widget-docs .ui-state-default { border: 1px solid #666666; background: #555555 url(images/555555_40x100_textures_03_highlight_soft_75.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; outline: none; } -#widget-docs .ui-state-default a { color: #ffffff; text-decoration: none; outline: none; } -#widget-docs .ui-state-hover, #widget-docs .ui-widget-content #widget-docs .ui-state-hover, #widget-docs .ui-state-focus, #widget-docs .ui-widget-content #widget-docs .ui-state-focus { border: 1px solid #666666; background: #444444 url(images/444444_40x100_textures_03_highlight_soft_60.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; outline: none; } -#widget-docs .ui-state-hover a { color: #ffffff; text-decoration: none; outline: none; } -#widget-docs .ui-state-active, #widget-docs .ui-widget-content #widget-docs .ui-state-active { border: 1px solid #666666; background: #ffffff url(images/ffffff_40x100_textures_01_flat_65.png) 50% 50% repeat-x; font-weight: normal; color: #F6921E; outline: none; } -#widget-docs .ui-state-active a { color: #F6921E; outline: none; text-decoration: none; } - -/* Interaction Cues -----------------------------------*/ -#widget-docs .ui-state-highlight, #widget-docs .ui-widget-content #widget-docs .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/fbf9ee_40x100_textures_02_glass_55.png) 50% 50% repeat-x; color: #363636; } -#widget-docs .ui-state-error, #widget-docs .ui-widget-content #widget-docs .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/fef1ec_40x100_textures_05_inset_soft_95.png) 50% bottom repeat-x; color: #cd0a0a; } -#widget-docs .ui-state-error-text, #widget-docs .ui-widget-content #widget-docs .ui-state-error-text { color: #cd0a0a; } -#widget-docs .ui-state-disabled, #widget-docs .ui-widget-content #widget-docs .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } -#widget-docs .ui-priority-primary, #widget-docs .ui-widget-content #widget-docs .ui-priority-primary { font-weight: bold; } -#widget-docs .ui-priority-secondary, #widget-docs .ui-widget-content #widget-docs .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } - -/* Icons -----------------------------------*/ - -/* states and images */ -#demo-frame-wrapper .ui-icon, #widget-docs .ui-icon { width: 16px; height: 16px; background-image: url(images/222222_256x240_icons_icons.png); } -#widget-docs .ui-widget-content .ui-icon {background-image: url(images/222222_256x240_icons_icons.png); } -#widget-docs .ui-widget-header .ui-icon {background-image: url(images/222222_256x240_icons_icons.png); } -#widget-docs .ui-state-default .ui-icon { background-image: url(images/888888_256x240_icons_icons.png); } -#widget-docs .ui-state-hover .ui-icon, #widget-docs .ui-state-focus .ui-icon {background-image: url(images/454545_256x240_icons_icons.png); } -#widget-docs .ui-state-active .ui-icon {background-image: url(images/454545_256x240_icons_icons.png); } -#widget-docs .ui-state-highlight .ui-icon {background-image: url(images/2e83ff_256x240_icons_icons.png); } -#widget-docs .ui-state-error .ui-icon, #widget-docs .ui-state-error-text .ui-icon {background-image: url(images/cd0a0a_256x240_icons_icons.png); } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -#widget-docs .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; } -#widget-docs .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } -#widget-docs .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } -#widget-docs .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } -#widget-docs .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } -#widget-docs .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } -#widget-docs .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } -#widget-docs .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } -#widget-docs .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; } - -/* Overlays */ -#widget-docs .ui-widget-overlay { background: #aaaaaa url(images/aaaaaa_40x100_textures_01_flat_0.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } -#widget-docs .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/aaaaaa_40x100_textures_01_flat_0.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; } - -/* -----------------------------------*/ - -#widget-docs { margin:20px 0 0; border: none; } - -#widget-docs h2, #widget-docs h3, #widget-docs h4, #widget-docs p, #widget-docs ul, #widget-docs code { margin:0; padding:0; } -#widget-docs code { display:block; color:#444; font-size:.9em; margin:0 0 1em; } -#widget-docs code strong { color:#000; } -#widget-docs p { margin:0 3em 1.2em 0; } -#widget-docs p.intro { font-size:13px; color:#666; line-height:1.3; } -#widget-docs ul { list-style-type: none; } - -#widget-docs h2 { font-size:16px; margin:1.2em 0 .5em; } -#widget-docs h3 { font-size:14px; color:#e6820E; margin:1.5em 0 .5em; } -.normal #widget-docs h4 { font-size:12px; color:#000; border:0; margin:0 0 .5em; } - -#docs-overview-main { width:400px; } -#docs-overview-sidebar { float:right; width:200px; } -#docs-overview-sidebar a span { color:#666; } -#widget-docs #docs-overview-main p { margin-right:0; } -#widget-docs #docs-overview-sidebar h4 { padding-left:0; } - -.docs-list-header { float:left; width:100%; margin:10px 0 0; border-bottom:1px solid #eee; } -#widget-docs .docs-list-header h2 { float:left; margin:0; } -#widget-docs .docs-list-header p { float:right; margin:5px 0; font-size:11px; } - -.docs-list { float:left; width:100%; padding:0 0 10px; } -.docs-list .param-header { float:left; clear:left; width:100%; padding:8px 0; border-top:1px solid #eee; } -#widget-docs .param-header h3, #widget-docs .param-header p { margin:0; float:left; } -#widget-docs .param-header h3 { width:50%; } -#widget-docs .param-header h3 span { background: url(images/demo-spindown-closed.gif) no-repeat left; padding-left:13px; } -#widget-docs .param-open .param-header h3 span { background: url(images/demo-spindown-open.gif) no-repeat left; } -#widget-docs .param-header p { width:24%; } -#widget-docs .param-header p.param-type span { background: url(images/icon-docs-info.gif) no-repeat left; cursor:pointer; border-bottom:1px dashed #ccc; padding-left:15px; } - -.param-details { padding-left:13px; } -.param-args { margin:0 0 1.5em; border-top:1px dotted #ccc;} -.param-args td { padding:3px 30px 3px 5px; border-bottom:1px dotted #ccc; } - - -/* overrides for ui-tab styles */ -#widget-docs ul.ui-tabs-nav { padding:0 0 0 8px; } -#widget-docs .ui-tabs-nav li { margin:5px 5px 0 0; } - -#widget-docs .ui-tabs-nav li a:link, -#widget-docs .ui-tabs-nav li a:visited, -#widget-docs .ui-tabs-nav li a:hover, -#widget-docs .ui-tabs-nav li a:active { font-size:14px; padding:4px 1.2em 3px; color:#fff; } - -#widget-docs .ui-tabs-nav li.ui-tabs-selected a:link, -#widget-docs .ui-tabs-nav li.ui-tabs-selected a:visited, -#widget-docs .ui-tabs-nav li.ui-tabs-selected a:hover, -#widget-docs .ui-tabs-nav li.ui-tabs-selected a:active { color:#e6820E; } - -#widget-docs .ui-tabs-panel { padding:20px 9px; font-size:12px; line-height:1.4; color:#000; } - -#widget-docs .ui-widget-content a:link, -#widget-docs .ui-widget-content a:visited { color:#1b75bb; text-decoration:none; } -#widget-docs .ui-widget-content a:hover, -#widget-docs .ui-widget-content a:active { color:#0b559b; } - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/animated.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/animated.html deleted file mode 100644 index 200db3fe01..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/animated.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - jQuery UI Dialog - Animation - - - - - - - - - - - - - - - - - - -
      - -
      -

      This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.

      -
      - - - -
      - - - -
      -

      Dialogs may be animated by specifying an effect for the show and/or hide properties. You must include the individual effects file for any effects you would like to use.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/default.html deleted file mode 100644 index 083f7aa540..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/default.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - jQuery UI Dialog - Default functionality - - - - - - - - - - - - - - - -
      - -
      -

      This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.

      -
      - - -
      -

      Sed vel diam id libero rutrum convallis. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.

      -
      -
      - checkbox
      - radio
      -

      -
      -
      -
      - -
      - - - -
      -

      The basic dialog window is an overlay positioned within the viewport and is protected from page content (like select elements) shining through with an iframe. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/index.html deleted file mode 100644 index 460e4fb361..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - jQuery UI Dialog Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-confirmation.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-confirmation.html deleted file mode 100644 index e316a97bf3..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-confirmation.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - jQuery UI Dialog - Modal confirmation - - - - - - - - - - - - - - - -
      - -
      -

      These items will be permanently deleted and cannot be recovered. Are you sure?

      -
      - - -
      -

      Sed vel diam id libero rutrum convallis. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.

      -
      -
      - checkbox
      - radio
      -

      -
      -
      -
      - -
      - - - -
      -

      Confirm an action that may be destructive or important. Set the modal option to true, and specify primary and secondary user actions with the buttons option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-form.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-form.html deleted file mode 100644 index 5793b32eeb..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-form.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - jQuery UI Dialog - Modal form - - - - - - - - - - - - - - - - - - -
      - -
      -

      All form fields are required.

      - -
      -
      - - - - - - -
      -
      -
      - - -
      -

      Existing Users:

      - - - - - - - - - - - - - - - -
      NameEmailPassword
      John Doejohn.doe@example.comjohndoe1
      -
      - - -
      - - - -
      -

      Use a modal dialog to require that the user enter data during a multi-step process. Embed form markup in the content area, set the modal option to true, and specify primary and secondary user actions with the buttons option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-message.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-message.html deleted file mode 100644 index 90a88c33e7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal-message.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - jQuery UI Dialog - Modal message - - - - - - - - - - - - - - - - -
      - -
      -

      - - Your files have downloaded successfully into the My Downloads folder. -

      -

      - Currently using 36% of your storage space. -

      -
      - - -
      -

      Sed vel diam id libero rutrum convallis. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.

      -
      -
      - checkbox
      - radio
      -

      -
      -
      -
      - -
      - - - -
      -

      Use a modal dialog to explicitly acknowledge information or an action before continuing their work. Set the modal option to true, and specify a primary action (Ok) with the buttons option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal.html deleted file mode 100644 index ce56c30edd..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/dialog/modal.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - jQuery UI Dialog - Basic modal - - - - - - - - - - - - - - - -
      - -
      -

      Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.

      -
      - - -
      -

      Sed vel diam id libero rutrum convallis. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.

      -
      -
      - checkbox
      - radio
      -

      -
      -
      -
      - -
      - - - -
      -

      A modal dialog prevents the user from interacting with the rest of the page until it is closed.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/constrain-movement.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/constrain-movement.html deleted file mode 100644 index 9610fc48db..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/constrain-movement.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - jQuery UI Draggable - Constrain movement - - - - - - - - - - - - -
      - -

      Constrain movement along an axis:

      - -
      -

      I can be dragged only vertically

      -
      - -
      -

      I can be dragged only horizontally

      -
      - -

      Or to within another DOM element:

      -
      -
      -

      I'm contained within the box

      -
      - -
      -

      I'm contained within the box's parent

      -
      - -
      -

      I'm contained within my parent

      -
      -
      - -
      - - - -
      -

      Constrain the movement of each draggable by defining the boundaries of the draggable area. Set the axis option to limit the draggable's path to the x- or y-axis, or use the containment option to specify a parent DOM element or a jQuery selector, like 'document.'

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/cursor-style.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/cursor-style.html deleted file mode 100644 index 6ef5426ed1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/cursor-style.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - jQuery UI Draggable - Cursor style - - - - - - - - - - - - -
      - -
      -

      I will always stick to the center (relative to the mouse)

      -
      - -
      -

      My cursor is at left -5 and top -5

      -
      - -
      -

      My cursor position is only controlled for the 'bottom' value

      -
      - -
      - - - -
      -

      Position the cursor while dragging the object. By default the cursor appears in the center of the dragged object; use the cursorAt option to specify another location relative to the draggable (specify a pixel value from the top, right, bottom, and/or left). Customize the cursor's appearance by supplying the cursor option with a valid CSS cursor value: default, move, pointer, crosshair, etc.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/default.html deleted file mode 100644 index d8085b0b85..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/default.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - jQuery UI Draggable - Default functionality - - - - - - - - - - - - -
      - -
      -

      Drag me around

      -
      - -
      - - - -
      -

      Enable draggable functionality on any DOM element. Move the draggable object by clicking on it with the mouse and dragging it anywhere within the viewport.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/delay-start.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/delay-start.html deleted file mode 100644 index 45e3edae27..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/delay-start.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - jQuery UI Draggable - Delay start - - - - - - - - - - - - -
      - -
      -

      Only if you drag me by 20 pixels, the dragging will start

      -
      - -
      -

      Regardless of the distance, you have to drag and wait for 1000ms before dragging starts

      -
      - -
      - - - -
      -

      Delay the start of dragging for a number of milliseconds with the delay option; prevent dragging until the cursor is held down and dragged a specifed number of pixels with the distance option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/events.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/events.html deleted file mode 100644 index ed067d1207..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/events.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - jQuery UI Draggable - Events - - - - - - - - - - - - -
      - -
      - -

      Drag me to trigger the chain of events.

      - -
        -
      • "start" invoked 0x
      • -
      • "drag" invoked 0x
      • -
      • "stop" invoked 0x
      • -
      -
      - -
      - - - -
      -

      Layer functionality onto the draggable using the start, drag, and stop events. Start is fired at the start of the drag; drag during the drag; and stop when dragging stops.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/handle.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/handle.html deleted file mode 100644 index dc6d7b9e63..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/handle.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - jQuery UI Draggable - Handles - - - - - - - - - - - - -
      - -
      -

      I can be dragged only by this handle

      -
      - -
      -

      You can drag me around…

      -

      …but you can't drag me by this handle.

      -
      - - - -
      - - - -
      -

      Allow dragging only when the cursor is over a specific part of the draggable. Use the handle option to specify the jQuery selector of an element (or group of elements) used to drag the object.

      -

      Or prevent dragging when the cursor is over a specific element (or group of elements) within the draggable. Use the cancel option to specify a jQuery selector over which to "cancel" draggable functionality.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/index.html deleted file mode 100644 index 0beda8e729..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - jQuery UI Draggable Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/revert.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/revert.html deleted file mode 100644 index 11f3abdfac..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/revert.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - jQuery UI Draggable - Revert position - - - - - - - - - - - - -
      - -
      -

      Revert the original

      -
      - -
      -

      Revert the helper

      -
      - -
      - - - -
      -

      Return the draggable (or it's helper) to its original location when dragging stops with the boolean revert option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/scroll.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/scroll.html deleted file mode 100644 index a650ed5d96..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/scroll.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - jQuery UI Draggable - Auto-scroll - - - - - - - - - - - - -
      - -
      -

      Scroll set to true, default settings

      -
      - -
      -

      scrollSensitivity set to 100

      -
      - -
      -

      scrollSpeed set to 100

      -
      - -
      - -
      - - - -
      -

      Automatically scroll the document when the draggable is moved beyond the viewport. Set the scroll option to true to enable auto-scrolling, and fine-tune when scrolling is triggered and its speed with the scrollSensitivity and scrollSpeed options.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/snap-to.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/snap-to.html deleted file mode 100644 index 14e254e478..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/snap-to.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - jQuery UI Draggable - Snap to element or grid - - - - - - - - - - - - -
      - -
      -

      I'm a snap target

      -
      - -
      - -
      -

      Default (snap: true), snaps to all other draggable elements

      -
      - -
      -

      I only snap to the big box

      -
      - -
      -

      I only snap to the outer edges of the big box

      -
      - -
      -

      I snap to a 20 x 20 grid

      -
      - -
      -

      I snap to a 80 x 80 grid

      -
      - -
      - - - -
      -

      Snap the draggable to the inner or outer boundaries of a DOM element. Use the snap, snapMode (inner, outer, both), and snapTolerance (distance in pixels the draggable must be from the element when snapping is invoked) options.

      -

      Or snap the draggable to a grid. Set the dimensions of grid cells (height and width in pixels) with the grid option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/sortable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/sortable.html deleted file mode 100644 index 4bc32986df..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/sortable.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - jQuery UI Draggable + Sortable - - - - - - - - - - - - - -
      - -
        -
      • Drag me down
      • -
      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      - -
      - - - -
      -

      Draggables are built to interact seamlessly with sortables.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/visual-feedback.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/visual-feedback.html deleted file mode 100644 index 5d0ff2668f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/draggable/visual-feedback.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - jQuery UI Draggable - Visual feedback - - - - - - - - - - - - -
      - -

      With helpers:

      - -
      -

      Original

      -
      - -
      -

      Semi-transparent clone

      -
      - -
      -

      Custom helper (in combination with cursorAt)

      -
      - -

      Stacked:

      -
      -
      -

      We are draggables..

      -
      - -
      -

      ..whose z-indexes are controlled automatically..

      -
      - -
      -

      ..with the stack option.

      -
      -
      - -
      - - - -
      -

      Provide feedback to users as they drag an object in the form of a helper. The helper option accepts the values 'original' (the draggable object moves with the cursor), 'clone' (a duplicate of the draggable moves with the cursor), or a function that returns a DOM element (that element is shown near the cursor during drag). Control the helper's transparency with the opacity option.

      -

      To clarify which draggable is in play, bring the draggable in motion to front. Use the zIndex option to set a higher z-index for the helper, if in play, or use the stack option to ensure that the last item dragged will appear on top of others in the same group on drag stop.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/accepted-elements.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/accepted-elements.html deleted file mode 100644 index a2e3b3321c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/accepted-elements.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - jQuery UI Droppable - Accept - - - - - - - - - - - - - -
      - -
      -

      I'm draggable but can't be dropped

      -
      - -
      -

      Drag me to my target

      -
      - -
      -

      accept: '#draggable'

      -
      - -
      - - - -
      -

      Specify using the accept option which element (or group of elements) is accepted by the target droppable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/default.html deleted file mode 100644 index 4de66d70a2..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/default.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - jQuery UI Droppable - Default functionality - - - - - - - - - - - - - -
      - -
      -

      Drag me to my target

      -
      - -
      -

      Drop here

      -
      - -
      - - - -
      -

      Enable any DOM element to be droppable, a target for draggable elements.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras.jpg deleted file mode 100644 index 5723680df5..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2.jpg deleted file mode 100644 index 1acad3afb0..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2_min.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2_min.jpg deleted file mode 100644 index 493e0824ae..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras2_min.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3.jpg deleted file mode 100644 index e158b1ae06..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3_min.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3_min.jpg deleted file mode 100644 index 4aa96b01ef..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras3_min.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4.jpg deleted file mode 100644 index da4124d88f..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4_min.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4_min.jpg deleted file mode 100644 index 794dbdf78a..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras4_min.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras_min.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras_min.jpg deleted file mode 100644 index 51e0cdedff..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/images/high_tatras_min.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/index.html deleted file mode 100644 index 13ae9855e4..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - jQuery UI Droppable Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/photo-manager.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/photo-manager.html deleted file mode 100644 index 2b16eb7b2f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/photo-manager.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - jQuery UI Droppable - Simple photo manager - - - - - - - - - - - - - - - - -
      - - - -
      -

      Trash Trash

      -
      - -
      - - -
      -

      You can delete an image either by dragging it to the Trash or by clicking the trash icon.

      -

      You can "recycle" an image by dragging it back to the gallery or by clicking the recycle icon.

      -

      You can view larger image by clicking the zoom icon. jQuery UI dialog widget is used for the modal window.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/propagation.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/propagation.html deleted file mode 100644 index 3275dd2a6e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/propagation.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - jQuery UI Droppable - Prevent propagation - - - - - - - - - - - - - -
      - -
      -

      Drag me to my target

      -
      - -
      -

      Outer droppable

      -
      -

      Inner droppable (not greedy)

      -
      -
      - -
      -

      Outer droppable

      -
      -

      Inner droppable (greedy)

      -
      -
      - -
      - - - -
      -

      When working with nested droppables — for example, you may have an editable directory structure displayed as a tree, with folder and document nodes — the greedy option set to true prevents event propagation when a draggable is dropped on a child node (droppable).

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/revert.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/revert.html deleted file mode 100644 index 24da889b13..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/revert.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - jQuery UI Droppable - Revert draggable position - - - - - - - - - - - - - -
      - -
      -

      I revert when I'm dropped

      -
      - -
      -

      I revert when I'm not dropped

      -
      - -
      -

      Drop me here

      -
      - -
      - - - -
      -

      Return the draggable (or it's helper) to its original location when dragging stops with the boolean revert option set on the draggable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/shopping-cart.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/shopping-cart.html deleted file mode 100644 index 4fb9a87bab..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/shopping-cart.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - jQuery UI Droppable - Shopping Cart Demo - - - - - - - - - - - - - - - -
      - -
      -

      Products

      -
      -

      T-Shirts

      -
      -
        -
      • Lolcat Shirt
      • -
      • Cheezeburger Shirt
      • -
      • Buckit Shirt
      • -
      -
      -

      Bags

      -
      -
        -
      • Zebra Striped
      • -
      • Black Leather
      • -
      • Alligator Leather
      • -
      -
      -

      Gadgets

      -
      -
        -
      • iPhone
      • -
      • iPod
      • -
      • iPad
      • -
      -
      -
      -
      - -
      -

      Shopping Cart

      -
      -
        -
      1. Add your items here
      2. -
      -
      -
      - -
      - - - -
      -

      Demonstrate how to use an accordion to structure products into a catalog and make use drag and drop for adding them to a shopping cart, where they are sortable.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/visual-feedback.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/visual-feedback.html deleted file mode 100644 index ff2ddc6ca7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/droppable/visual-feedback.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - jQuery UI Droppable - Visual feedback - - - - - - - - - - - - - -
      - -

      Feedback on hover:

      - -
      -

      Drag me to my target

      -
      - -
      -

      Drop here

      -
      - -

      Feedback on activating draggable:

      - -
      -

      Drag me to my target

      -
      - -
      -

      Drop here

      -
      - -
      - - - -
      -

      Change the droppable's appearance on hover, or when the droppable is active (an acceptable draggable is dropped on it). Use the hoverClass or activeClass options to specify respective classes.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/default.html deleted file mode 100644 index 6be20f38d0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/default.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - jQuery UI Effects - Effect demo - - - - - - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Effect

      -

      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. -

      -
      -
      - - - -Run Effect - -
      - - - -
      -

      Click the button above to show the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/easing.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/easing.html deleted file mode 100644 index 0b6ba0885a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/easing.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - jQuery UI Effects - Easing demo - - - - - - - - - -
      - -
      - -
      - - - -
      -

      All easings provided by jQuery UI are drawn above, using a HTML canvas element. Click a diagram to see the easing in action.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/index.html deleted file mode 100644 index 65aa3993ae..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/effect/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/default.html deleted file mode 100644 index 1409024cb0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/default.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - jQuery UI Effects - Hide Demo - - - - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Hide

      -

      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. -

      -
      -
      - - - -Run Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/hide/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/calendar.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/calendar.gif deleted file mode 100644 index d0abaa7c0b..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/calendar.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on-tile.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on-tile.gif deleted file mode 100644 index a96b5bf33a..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on-tile.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on.gif deleted file mode 100644 index e3b6d7c0f7..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-config-on.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-closed.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-closed.gif deleted file mode 100644 index ad4bd3781b..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-closed.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-open.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-open.gif deleted file mode 100644 index e1c60aa558..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/demo-spindown-open.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/icon-docs-info.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/icon-docs-info.gif deleted file mode 100644 index ea6d2bece7..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/icon-docs-info.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/pbar-ani.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/pbar-ani.gif deleted file mode 100644 index cb59a04f90..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/images/pbar-ani.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/index.html deleted file mode 100644 index 0bdee3d686..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/index.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - jQuery UI Demos - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -
      -
      Interactions
      -
      Draggable
      -
      Droppable
      -
      Resizable
      -
      Selectable
      -
      Sortable
      -
      Widgets
      -
      Accordion
      -
      Autocomplete
      -
      Button
      -
      Datepicker
      -
      Dialog
      -
      Progressbar
      -
      Slider
      -
      Tabs
      -
      Effects
      -
      Color Animation
      -
      Toggle Class
      -
      Add Class
      -
      Remove Class
      -
      Switch Class
      -
      Effect
      -
      Toggle
      -
      Hide
      -
      Show
      -
      Utilities
      -
      Position
      -
      About jQuery UI
      -
      Getting Started
      -
      Upgrade Guide
      -
      Changelog
      -
      Roadmap
      -
      Subversion Access
      -
      UI Developer Guidelines
      -
      Theming
      -
      Theming jQuery UI
      -
      jQuery UI CSS Framework
      -
      ThemeRoller application
      -
      Theme Switcher Widget
      - -
      -
      - -
      - -

      Instructions

      -

      - These demos showcase some common uses of each jQuery UI plugin. Simply copy and paste code from the demos to get started. Have fun playing with them. -

      - -
      - -
      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/cycler.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/cycler.html deleted file mode 100644 index b52e227246..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/cycler.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - jQuery UI Position - Default functionality - - - - - - - - - - - -
      - - - - - - - - -
      - - - -
      -

      A prototype for the Photoviewer using Position to place images at the center, left and right and cycle them. -
      Use the links at the top to cycle, or click on the images on the left and right. -
      Note how the images are repositioned when resizing the window. -
      Warning: Doesn't currently work inside the demo viewer; open in a new window instead!

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/default.html deleted file mode 100644 index 87fc8e38a1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/default.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - jQuery UI Position - Default functionality - - - - - - - - - - - - - -
      - -
      -

      - This is the position parent element. -

      -
      - -
      -

      - to position -

      -
      - -
      -

      - to position 2 -

      -
      - -
      - position... -
      - my: - - -
      -
      - at: - - -
      -
      - offset: - -
      -
      - collision: - - -
      -
      - -
      - - - -
      -

      Use the form controls to configure the positioning, or drag the positioned element to modify its offset. -
      Drag around the parent element to see collision detection in action.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/earth.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/earth.jpg deleted file mode 100644 index e5477f7546..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/earth.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/flight.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/flight.jpg deleted file mode 100644 index 362bd1a223..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/flight.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/rocket.jpg b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/rocket.jpg deleted file mode 100644 index 9c0495c61d..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/images/rocket.jpg and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/index.html deleted file mode 100644 index 498c09b2bf..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/position/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - jQuery UI Position Demo - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/animated.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/animated.html deleted file mode 100644 index 73f5477268..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/animated.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - jQuery UI Progressbar - Animated - - - - - - - - - - - -
      - -
      - -
      - - - -
      -

      -This progressbar has an animated fill by setting the -background-image -on the -.ui-progressbar-value -element, using css. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/default.html deleted file mode 100644 index 5c6ca43db7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/default.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - jQuery UI Progressbar - Default functionality - - - - - - - - - - -
      - -
      - -
      - - - -
      -

      Default determinate progress bar.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/images/pbar-ani.gif b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/images/pbar-ani.gif deleted file mode 100644 index cb59a04f90..0000000000 Binary files a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/images/pbar-ani.gif and /dev/null differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/index.html deleted file mode 100644 index 9836f59aa8..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - jQuery UI Progressbar Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/resize.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/resize.html deleted file mode 100644 index adc1fbbfb1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/progressbar/resize.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - jQuery UI Progressbar - Resizable - - - - - - - - - - - - -
      - -
      -
      -
      - -
      - - - -
      -

      The progress bar's widths are specified in percentages for flexible sizing so it will resize to fit its container. Try resizing the height and width of this bar to see how it maintains the correct proportions. (This is not necessarily a real-world example, but it's a good illustration of how flexibly all the plugins are coded.)

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/default.html deleted file mode 100644 index 3bd52e6408..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/default.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - jQuery UI Effects - removeClass Demo - - - - - - - - - -
      - -
      -
      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. -
      -
      - -Run Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/removeClass/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/animate.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/animate.html deleted file mode 100644 index c288d62bc2..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/animate.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - jQuery UI Resizable - Animate - - - - - - - - - - - - -
      - -
      -

      Animate

      -
      - -
      - - - -
      -

      Animate the resize action using the animate option (boolean). When this option is set to true, drag the outline to the desired location; the element animates to that size on drag stop.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/aspect-ratio.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/aspect-ratio.html deleted file mode 100644 index 421f2e4aae..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/aspect-ratio.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - jQuery UI Resizable - Preserve aspect ratio - - - - - - - - - - - - -
      - -
      -

      Preserve aspect ratio

      -
      - -
      - - - -
      -

      Maintain the existing aspect ratio or set a new one to constrain the proportions on resize. Set the aspectRatio option to true, and optionally pass in a new ratio (i.e., 4/3)

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/constrain-area.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/constrain-area.html deleted file mode 100644 index a7003352c0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/constrain-area.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - jQuery UI Resizable - Constrain resize area - - - - - - - - - #container { width: 300px; height: 300px; } - #container h3 { text-align: center; margin: 0; margin-bottom: 10px; } - #resizable { background-position: top left; width: 150px; height: 150px; } - #resizable, #container { padding: 0.5em; } - - - - - -
      - -
      -

      Containment

      -
      -

      Resizable

      -
      -
      - -
      - - - -
      -

      Define the boundaries of the resizable area. Use the containment option to specify a parent DOM element or a jQuery selector, like 'document.'

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/default.html deleted file mode 100644 index ded33329fb..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/default.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - jQuery UI Resizable - Default functionality - - - - - - - - - - - - -
      - -
      -

      Resizable

      -
      - -
      - - - -
      -

      Enable any DOM element to be resizable. With the cursor grab the right or bottom border and drag to the desired width or height.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/delay-start.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/delay-start.html deleted file mode 100644 index 6fc2cc2d61..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/delay-start.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - jQuery UI Resizable - Delay start - - - - - - - - - - - - -
      - -

      Time delay (ms):

      -
      -

      Time

      -
      - -

      Distance delay (px):

      -
      -

      Distance

      -
      - -
      - - - -
      -

      Delay the start of resizng for a number of milliseconds with the delay option; prevent resizing until the cursor is held down and dragged a specifed number of pixels with the distance option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/helper.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/helper.html deleted file mode 100644 index a363856176..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/helper.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - jQuery UI Resizable - Helper - - - - - - - - - - - - -
      - -
      -

      Helper

      -
      - -
      - - - -
      -

      Display only an outline of the element while resizing by setting the helper option to a CSS class.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/index.html deleted file mode 100644 index 45f400621d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - jQuery UI Resizable Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/max-min.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/max-min.html deleted file mode 100644 index 81be5dd5db..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/max-min.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - jQuery UI Resizable - Maximum / minimum size - - - - - - - - - - - - -
      - -
      -

      Resize larger / smaller

      -
      - -
      - - - -
      -

      Limit the resizable element to a maximum or minimum height or width using the maxHeight, maxWidth, minHeight, and minWidth options.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/snap-to-grid.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/snap-to-grid.html deleted file mode 100644 index 568c1c743e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/snap-to-grid.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - jQuery UI Resizable - Snap to grid - - - - - - - - - - - - -
      - -
      -

      Grid

      -
      - -
      - - - -
      -

      Snap the resizable element to a grid. Set the dimensions of grid cells (height and width in pixels) with the grid option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/synchronous-resize.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/synchronous-resize.html deleted file mode 100644 index 74e54da479..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/synchronous-resize.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - jQuery UI Resizable - Synchronous resize - - - - - - - - - - - - -
      - -
      -

      Resize

      -
      - -
      -

      will also resize

      -
      - -
      - - - -
      -

      Resize multiple elements simultaneously by clicking and dragging the sides of one. Pass a shared selector into the alsoResize option.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/textarea.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/textarea.html deleted file mode 100644 index 2d00e0ded4..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/textarea.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - jQuery UI Resizable - Textarea - - - - - - - - - - - - -
      - - - -
      - - - -
      -

      Display only an outline of the element while resizing by setting the helper option to a CSS class.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/visual-feedback.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/visual-feedback.html deleted file mode 100644 index fc61a6bcba..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/resizable/visual-feedback.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - jQuery UI Resizable - Visual feedback - - - - - - - - - - - - -
      - -
      -

      Ghost

      -
      - -
      - - - -
      -

      Instead of showing the actual element during resize, set the ghost option to true to show a semi-transparent part of the element.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/default.html deleted file mode 100644 index 983a04b3f2..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/default.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - jQuery UI Selectable - Default functionality - - - - - - - - - - - - - -
      - -
        -
      1. Item 1
      2. -
      3. Item 2
      4. -
      5. Item 3
      6. -
      7. Item 4
      8. -
      9. Item 5
      10. -
      11. Item 6
      12. -
      13. Item 7
      14. -
      - -
      - - - -
      -

      Enable a DOM element (or group of elements) to be selectable. Draw a box with your cursor to select items. Hold down the Ctrl key to make multiple non-adjacent selections.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/display-grid.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/display-grid.html deleted file mode 100644 index b045eb99c1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/display-grid.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - jQuery UI Selectable - Display as grid - - - - - - - - - - - - - -
      - -
        -
      1. 1
      2. -
      3. 2
      4. -
      5. 3
      6. -
      7. 4
      8. -
      9. 5
      10. -
      11. 6
      12. -
      13. 7
      14. -
      15. 8
      16. -
      17. 9
      18. -
      19. 10
      20. -
      21. 11
      22. -
      23. 12
      24. -
      - -
      - - - -
      -

      To arrange selectable items as a grid, give them identical dimensions and float them using CSS.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/index.html deleted file mode 100644 index 21fa4d5a7e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - jQuery UI Selectable Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/serialize.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/serialize.html deleted file mode 100644 index 18e35dae2c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/selectable/serialize.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - jQuery UI Selectable - Serialize - - - - - - - - - - - - - -
      - -

      -You've selected: none. -

      - -
        -
      1. Item 1
      2. -
      3. Item 2
      4. -
      5. Item 3
      6. -
      7. Item 4
      8. -
      9. Item 5
      10. -
      11. Item 6
      12. -
      - -
      - - - -
      -

      Write a function that fires on the stop event to collect the index values of selected items. Present values as feedback, or pass as a data string.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/default.html deleted file mode 100644 index 49ca85675b..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/default.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - jQuery UI Effects - Show Demo - - - - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Show

      -

      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. -

      -
      -
      - - - -Run Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/show/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/colorpicker.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/colorpicker.html deleted file mode 100644 index 8192e08a75..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/colorpicker.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - jQuery UI Slider - Colorpicker - - - - - - - - - - - - -
      - -

      - - Simple Colorpicker -

      - -
      -
      -
      - -
      - -
      - - - -
      -

      Combine three sliders to create a simple RGB colorpicker.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/default.html deleted file mode 100644 index fdcd4cff95..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/default.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - jQuery UI Slider - Default functionality - - - - - - - - - - - - -
      - -
      - -
      - - - -
      -

      The basic slider is horizontal and has a single handle that can be moved with the mouse or by using the arrow keys.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/hotelrooms.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/hotelrooms.html deleted file mode 100644 index 2ba4b9970f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/hotelrooms.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - jQuery UI Slider - Range with fixed minimum - - - - - - - - - - - - -
      - -
      - - -
      - -
      - - - -
      -

      How to bind a slider to an existing select element. The select stays visible to display the change. When the select is changed, the slider is updated, too.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/index.html deleted file mode 100644 index caf68fe978..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - jQuery UI Slider Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/multiple-vertical.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/multiple-vertical.html deleted file mode 100644 index 372ad2d93c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/multiple-vertical.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - jQuery UI Slider - Multiple sliders - - - - - - - - - - - - -
      - -

      - - Master volume -

      - -
      - -

      - - Graphic EQ -

      - -
      - 88 - 77 - 55 - 33 - 40 - 45 - 70 -
      - -
      - - - -
      -

      Combine horizontal and vertical sliders, each with their own options, to create the UI for a music player.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range-vertical.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range-vertical.html deleted file mode 100644 index 2a1a8b4e95..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range-vertical.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - jQuery UI Slider - Vertical range slider - - - - - - - - - - - - -
      - -

      - - -

      - -
      - -
      - - - -
      -

      Change the orientation of the range slider to vertical. Assign a height value via .height() or by setting the height through CSS, and set the orientation option to "vertical."

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range.html deleted file mode 100644 index 3fd156dc33..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/range.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - jQuery UI Slider - Range slider - - - - - - - - - - - - -
      - -

      - - -

      - -
      - -
      - - - -
      -

      Set the range option to true to capture a range of values with two drag handles. The space between the handles is filled with a different background color to indicate those values are selected.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemax.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemax.html deleted file mode 100644 index 899efb28aa..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemax.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - jQuery UI Slider - Range with fixed maximum - - - - - - - - - - - - -
      - -

      - - -

      -
      - -
      - - - -
      -

      Fix the maximum value of the range slider so that the user can only select a minimum. Set the range option to "max."

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemin.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemin.html deleted file mode 100644 index 3e077d9091..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/rangemin.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - jQuery UI Slider - Range with fixed minimum - - - - - - - - - - - - -
      - -

      - - -

      - -
      - -
      - - - -
      -

      Fix the minimum value of the range slider so that the user can only select a maximum. Set the range option to "min."

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/side-scroll.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/side-scroll.html deleted file mode 100644 index 666d480a02..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/side-scroll.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - jQuery UI Slider - Slider scrollbar - - - - - - - - - - - - -
      - -
      -
      -
      1
      -
      2
      -
      3
      -
      4
      -
      5
      -
      6
      -
      7
      -
      8
      -
      9
      -
      10
      -
      11
      -
      12
      -
      13
      -
      14
      -
      15
      -
      16
      -
      17
      -
      18
      -
      19
      -
      20
      -
      -
      -
      -
      -
      - -
      - - - -
      -

      Use a slider to manipulate the positioning of content on the page. In this case, it acts as a scrollbar with the potential to capture values if needed.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/slider-vertical.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/slider-vertical.html deleted file mode 100644 index 479e778ff9..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/slider-vertical.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - jQuery UI Slider - Vertical slider - - - - - - - - - - - - -
      - -

      - - -

      - -
      - -
      - - - -
      -

      Change the orientation of the slider to vertical. Assign a height value via .height() or by setting the height through CSS, and set the orientation option to "vertical."

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/steps.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/steps.html deleted file mode 100644 index c49e26fb38..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/steps.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - jQuery UI Slider - Snap to increments - - - - - - - - - - - - -
      - -

      - - -

      - -
      - -
      - - - -
      -

      Increment slider values with the step option set to an integer, commonly a dividend of the slider's maximum value. The default increment is 1.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/tabs.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/tabs.html deleted file mode 100644 index 440ac587d2..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/slider/tabs.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - jQuery UI Slider - Snap to increments - - - - - - - - - - - - - -
      - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Control tabs with a slider.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists-through-tabs.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists-through-tabs.html deleted file mode 100644 index d466da80c8..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists-through-tabs.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - jQuery UI Sortable - Connect lists with Tabs - - - - - - - - - - - - - -
      - -
      - -
      -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      -
      -
      -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      -
      -
      - -
      - - - -
      -

      Sort items from one list into another and vice versa, by dropping the list item on the appropriate tab above.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists.html deleted file mode 100644 index d0b2c5ce1d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/connect-lists.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - jQuery UI Sortable - Connect lists - - - - - - - - - - - -
      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      - -
      - - - -
      -

      - Sort items from one list into another and vice versa, by passing a selector into - the connectWith option. The simplest way to do this is to - group all related lists with a CSS class, and then pass that class into the - sortable function (i.e., connectWith: '.myclass'). -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/default.html deleted file mode 100644 index d0ef0df69d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/default.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - jQuery UI Sortable - Default functionality - - - - - - - - - - - -
      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      • Item 6
      • -
      • Item 7
      • -
      - -
      - - - -
      -

      - Enable a group of DOM elements to be sortable. Click on and drag an - element to a new spot within the list, and the other items will adjust to - fit. By default, sortable items share draggable properties. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/delay-start.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/delay-start.html deleted file mode 100644 index 48a9c1f639..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/delay-start.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - jQuery UI Sortable - Delay start - - - - - - - - - - - -
      - -

      Time delay of 300ms:

      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      - -

      Distance delay of 15px:

      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      - -
      - - - -
      -

      - Prevent accidental sorting either by delay (time) or distance. Set a number of - milliseconds the element needs to be dragged before sorting starts - with the delay option. Set a distance in pixels the element - needs to be dragged before sorting starts with the distance - option. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/display-grid.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/display-grid.html deleted file mode 100644 index c32e309f30..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/display-grid.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - jQuery UI Sortable - Display as grid - - - - - - - - - - - -
      - -
        -
      • 1
      • -
      • 2
      • -
      • 3
      • -
      • 4
      • -
      • 5
      • -
      • 6
      • -
      • 7
      • -
      • 8
      • -
      • 9
      • -
      • 10
      • -
      • 11
      • -
      • 12
      • -
      - -
      - - - -
      -

      - To arrange sortable items as a grid, give them identical dimensions and - float them using CSS. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/empty-lists.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/empty-lists.html deleted file mode 100644 index d1c968096d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/empty-lists.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - jQuery UI Sortable - Handle empty lists - - - - - - - - - - - -
      - -
        -
      • Can be dropped..
      • -
      • ..on an empty list
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      - -
        -
      • Cannot be dropped..
      • -
      • ..on an empty list
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      - -
        -
      - -
      - -
      - - - -
      -

      - Prevent all items in a list from being dropped into a separate, empty list - using the dropOnEmpty option set to false. By default, - sortable items can be dropped on empty lists. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/index.html deleted file mode 100644 index b307ef777f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - jQuery UI Sortable Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/items.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/items.html deleted file mode 100644 index 334cdeb346..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/items.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - jQuery UI Sortable - Include / exclude items - - - - - - - - - - - -
      - -

      Specify which items are sortable:

      - -
        -
      • Item 1
      • -
      • (I'm not sortable or a drop target)
      • -
      • (I'm not sortable or a drop target)
      • -
      • Item 4
      • -
      - -

      Cancel sorting (but keep as drop targets):

      - -
        -
      • Item 1
      • -
      • (I'm not sortable)
      • -
      • (I'm not sortable)
      • -
      • Item 4
      • -
      - -
      - - - -
      -

      - Specify which items are eligible to sort by passing a jQuery selector into - the items option. Items excluded from this option are not - sortable, nor are they valid targets for sortable items. -

      -

      - To only prevent sorting on certain items, pass a jQuery selector into the - cancel option. Cancelled items remain valid sort targets for - others. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/placeholder.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/placeholder.html deleted file mode 100644 index 90198f3d1a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/placeholder.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - jQuery UI Sortable - Drop placeholder - - - - - - - - - - - -
      - -
        -
      • Item 1
      • -
      • Item 2
      • -
      • Item 3
      • -
      • Item 4
      • -
      • Item 5
      • -
      • Item 6
      • -
      • Item 7
      • -
      - -
      - - - -
      -

      - When dragging a sortable item to a new location, other items will make room - for the that item by shifting to allow white space between them. Pass a - class into the placeholder option to style that space to - be visible. Use the boolean forcePlaceholderSize option - to set dimensions on the placeholder. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/portlets.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/portlets.html deleted file mode 100644 index 1e5e956d8a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/sortable/portlets.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - jQuery UI Sortable - Portlets - - - - - - - - - - - -
      - -
      - -
      -
      Feeds
      -
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit
      -
      - -
      -
      News
      -
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit
      -
      - -
      - -
      - -
      -
      Shopping
      -
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit
      -
      - -
      - -
      - -
      -
      Links
      -
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit
      -
      - -
      -
      Images
      -
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit
      -
      - -
      - -
      - - - -
      -

      - Enable portlets (styled divs) as sortables and use the connectWith - option to allow sorting between columns. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/default.html deleted file mode 100644 index c0bcd6b315..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/default.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - jQuery UI Effects - switchClass Demo - - - - - - - - - -
      - -
      -
      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. -
      -
      -Run Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/switchClass/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax.html deleted file mode 100644 index c626257915..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - jQuery UI Tabs - Content via Ajax - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      - -
      - - - -
      -

      Fetch external content via Ajax for the tabs by setting an href value in the tab links. While the Ajax request is waiting for a response, the tab label changes to say "Loading...", then returns to the normal label once loaded.

      -

      Tabs 3 and 4 demonstrate slow-loading and broken AJAX tabs, and how to handle serverside errors in those cases. Note: These two require a webserver to interpret PHP. They won't work from the filesystem.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content1.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content1.html deleted file mode 100644 index 472bdfb366..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content1.html +++ /dev/null @@ -1,4 +0,0 @@ -

      This content was loaded via ajax.

      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -

      Mauris vitae ante. Curabitur augue. Nulla purus nibh, lobortis ut, feugiat at, aliquam id, purus. Sed venenatis, lorem venenatis volutpat commodo, purus quam lacinia justo, mattis interdum pede pede a odio. Fusce nibh. Morbi nisl mauris, dapibus in, tristique eget, accumsan et, pede. Donec mauris risus, pulvinar ut, faucibus eu, mollis in, nunc. In augue massa, commodo a, cursus vehicula, varius eu, dui. Suspendisse sodales suscipit lorem. Morbi malesuada, eros quis condimentum dignissim, lectus nibh tristique urna, non bibendum diam massa vel risus. Morbi suscipit. Proin egestas, eros at scelerisque scelerisque, dolor lacus fringilla lacus, ut ullamcorper mi magna at quam. Aliquam sed elit. Aliquam turpis purus, congue quis, iaculis id, ullamcorper sit amet, justo. Maecenas sed mauris. Proin magna justo, interdum in, tincidunt eu, viverra eu, turpis. Suspendisse mollis. In magna. Phasellus pellentesque, urna pellentesque convallis pellentesque, augue sem blandit pede, at rhoncus libero nisl a odio.

      -

      Sed vitae nibh non magna semper tempor. Duis dolor. Nam congue laoreet arcu. Fusce lobortis enim quis ligula. Maecenas commodo odio id mi. Maecenas scelerisque tellus eu odio. Etiam dolor purus, lacinia a, imperdiet in, aliquam et, eros. In pellentesque. Nullam ac massa. Integer et turpis. Ut quam augue, congue non, imperdiet id, eleifend ac, nisi. Etiam ac arcu. Cras iaculis accumsan erat. Nullam vulputate sapien nec nisi pretium rhoncus. Aliquam a nibh. Vivamus est ante, fermentum a, tincidunt ut, imperdiet nec, velit. Aenean non tortor. Sed nec mauris eget tellus condimentum rutrum.

      \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content2.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content2.html deleted file mode 100644 index 18b03e40ba..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content2.html +++ /dev/null @@ -1,4 +0,0 @@ -

      This other content was loaded via ajax.

      -

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec turpis justo, et facilisis ligula. In congue interdum odio, a scelerisque eros posuere ac. Aenean massa tellus, dictum sit amet laoreet ut, aliquam in orci. Duis eu aliquam ligula. Nullam vel placerat ligula. Fusce venenatis viverra dictum. Phasellus dui dolor, imperdiet in sodales at, mattis sed libero. Morbi ac ipsum ligula. Quisque suscipit dui vel diam pretium nec cursus lacus malesuada. Donec sollicitudin, eros eget dignissim mollis, risus leo feugiat tellus, vel posuere nisl ipsum eu erat. Quisque posuere lacinia imperdiet. Quisque nunc leo, elementum quis ultricies et, vehicula sit amet turpis. Nullam sed nunc nec nibh condimentum mattis. Quisque sed ligula sit amet nisi ultricies bibendum eget id nisi.

      -

      Proin ut erat vel nunc tincidunt commodo. Curabitur feugiat, nisi et vehicula viverra, nisl orci eleifend arcu, sed blandit lectus nisl quis nisi. In hac habitasse platea dictumst. In hac habitasse platea dictumst. Aenean rutrum gravida velit ac imperdiet. Integer vitae arcu risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin tincidunt orci at leo egestas porta. Vivamus ac augue et enim bibendum hendrerit ut id urna. Donec sollicitudin pulvinar turpis vitae scelerisque. Etiam tempor porttitor est sed blandit. Phasellus varius consequat leo eget tincidunt. Aliquam ac dui lectus. In et consectetur orci. Duis posuere nulla ac turpis faucibus vestibulum. Sed ut velit et dolor rhoncus dapibus. Sed sit amet pellentesque est.

      -

      Nam in volutpat orci. Morbi sit amet orci in erat egestas dignissim. Etiam mi sapien, tempus sed iaculis a, adipiscing quis tellus. Suspendisse potenti. Nam malesuada tristique vestibulum. In tempor tellus dignissim neque consectetur eu vestibulum nisl pellentesque. Phasellus ultrices cursus velit, id aliquam nisl fringilla quis. Cras varius elit sed urna ultrices congue. Sed ornare odio sed velit pellentesque id varius nisl sodales. Sed auctor ligula egestas mi pharetra ut consectetur erat pharetra.

      \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content3-slow.php b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content3-slow.php deleted file mode 100644 index bf4b80f5cc..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content3-slow.php +++ /dev/null @@ -1,7 +0,0 @@ - -

      This content was loaded via ajax, though it took a second.

      -

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec turpis justo, et facilisis ligula. In congue interdum odio, a scelerisque eros posuere ac. Aenean massa tellus, dictum sit amet laoreet ut, aliquam in orci. Duis eu aliquam ligula. Nullam vel placerat ligula. Fusce venenatis viverra dictum. Phasellus dui dolor, imperdiet in sodales at, mattis sed libero. Morbi ac ipsum ligula. Quisque suscipit dui vel diam pretium nec cursus lacus malesuada. Donec sollicitudin, eros eget dignissim mollis, risus leo feugiat tellus, vel posuere nisl ipsum eu erat. Quisque posuere lacinia imperdiet. Quisque nunc leo, elementum quis ultricies et, vehicula sit amet turpis. Nullam sed nunc nec nibh condimentum mattis. Quisque sed ligula sit amet nisi ultricies bibendum eget id nisi.

      -

      Proin ut erat vel nunc tincidunt commodo. Curabitur feugiat, nisi et vehicula viverra, nisl orci eleifend arcu, sed blandit lectus nisl quis nisi. In hac habitasse platea dictumst. In hac habitasse platea dictumst. Aenean rutrum gravida velit ac imperdiet. Integer vitae arcu risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin tincidunt orci at leo egestas porta. Vivamus ac augue et enim bibendum hendrerit ut id urna. Donec sollicitudin pulvinar turpis vitae scelerisque. Etiam tempor porttitor est sed blandit. Phasellus varius consequat leo eget tincidunt. Aliquam ac dui lectus. In et consectetur orci. Duis posuere nulla ac turpis faucibus vestibulum. Sed ut velit et dolor rhoncus dapibus. Sed sit amet pellentesque est.

      -

      Nam in volutpat orci. Morbi sit amet orci in erat egestas dignissim. Etiam mi sapien, tempus sed iaculis a, adipiscing quis tellus. Suspendisse potenti. Nam malesuada tristique vestibulum. In tempor tellus dignissim neque consectetur eu vestibulum nisl pellentesque. Phasellus ultrices cursus velit, id aliquam nisl fringilla quis. Cras varius elit sed urna ultrices congue. Sed ornare odio sed velit pellentesque id varius nisl sodales. Sed auctor ligula egestas mi pharetra ut consectetur erat pharetra.

      diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content4-broken.php b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content4-broken.php deleted file mode 100644 index bd9992112a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/ajax/content4-broken.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/bottom.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/bottom.html deleted file mode 100644 index 4f0e3c2a44..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/bottom.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - jQuery UI Tabs - Tabs at bottom - - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      With some additional CSS (for positioning) and JS (to put the right classes on elements) the tabs can be placed below their content.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/collapsible.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/collapsible.html deleted file mode 100644 index 1fba71041b..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/collapsible.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - jQuery UI Tabs - Collapse content - - - - - - - - - - -
      - -
      - -
      -

      Click this tab again to close the content pane.

      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Click this tab again to close the content pane.

      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Click this tab again to close the content pane.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Click the selected tab to toggle its content closed/open. To enable this functionality, set the collapsible option to true.

      -
      collapsible: true
      -
      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/cookie.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/cookie.html deleted file mode 100644 index 35972436db..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/cookie.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - jQuery UI Tabs - Default functionality - - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Looks the same as the default demo, but uses cookie to store the selected tab, and restore it when the page (re)loads. -The cookie is stored for a day, so tabs will be restored even after closing the browser. Use cookie: {} for using cookies with default options.

      -

      The cookie option requires the cookie plugin, which can be found in the development-bundle > external folder from the download builder.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/default.html deleted file mode 100644 index a892509ce7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/default.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - jQuery UI Tabs - Default functionality - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Click tabs to swap between content that is broken into logical sections.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/index.html deleted file mode 100644 index c0d6684351..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - jQuery UI Tabs Demos - - - - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/manipulation.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/manipulation.html deleted file mode 100644 index 8b8ddf4e6e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/manipulation.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - jQuery UI Tabs - Simple manipulation - - - - - - - - - - - - - - -
      - -
      -
      -
      - - - - -
      -
      -
      - - - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      - -
      - - - -
      -

      Simple tabs adding and removing.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/mouseover.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/mouseover.html deleted file mode 100644 index b19b2af09d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/mouseover.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - jQuery UI Tabs - Open on mouseover - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Toggle sections open/closed on mouseover with the event option. The default value for event is "click."

      -
      event: 'mouseover'
      -
      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/sortable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/sortable.html deleted file mode 100644 index ba8196d717..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/sortable.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - jQuery UI Tabs - Sortable - - - - - - - - - - - - -
      - -
      - -
      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Drag the tabs above to re-order them.

      -

      -Making tabs sortable is as simple as calling -.sortable() -on the -.ui-tabs-nav -element. -

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/vertical.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/vertical.html deleted file mode 100644 index 4ddb5c9c99..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/tabs/vertical.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - jQuery UI Tabs - Vertical Tabs functionality - - - - - - - - - - - -
      - -
      - -
      -

      Content heading 1

      -

      Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.

      -
      -
      -

      Content heading 2

      -

      Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.

      -
      -
      -

      Content heading 3

      -

      Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

      -

      Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.

      -
      -
      - -
      - - - -
      -

      Click tabs to swap between content that is broken into logical sections.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/default.html deleted file mode 100644 index 475109e114..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/default.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - jQuery UI Effects - Toggle Demo - - - - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Toggle

      -

      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. -

      -
      -
      - - - -Run Effect -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggle/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/default.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/default.html deleted file mode 100644 index ed3eb5179b..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/default.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - jQuery UI Effects - toggleClass Demo - - - - - - - - - -
      - -
      -
      - Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. -
      -
      - -Run Effect - -
      - - - -
      -

      Click the button above to preview the effect.

      -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/index.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/index.html deleted file mode 100644 index f5bd6a0e42..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/demos/toggleClass/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - jQuery UI Effects Demos - - - - -
      -

      Examples

      - -
      - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/accordion.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/accordion.html deleted file mode 100644 index ed0f2eb55c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/accordion.html +++ /dev/null @@ -1,1017 +0,0 @@ - - -
      -

      jQuery UI Accordion

      -
      -

      Overview

      -
      -

      Make the selected elements Accordion widgets. Semantic requirements:

      -

      The markup of your accordion container needs pairs of headers and content panels:

      -
      <div id="accordion">
      -    <h3><a href="#">First header</a></h3>
      -    <div>First content</div>
      -    <h3><a href="#">Second header</a></h3>
      -    <div>Second content</div>
      -</div>
      -

      If you use a different element for the header, specify the header-option with an appropriate selector, eg. header: 'a.header'. The content element must be always next to its header.

      -

      If you have links inside the accordion content and use a-elements as headers, add a class to them and use that as the header, eg. header: 'a.header'.

      -

      Use activate(Number) to change the active content programmatically.

      -

      NOTE: If you want multiple sections open at once, don't use an accordion

      -

      An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:

      -
      jQuery(document).ready(function(){
      -	$('.accordion .head').click(function() {
      -		$(this).next().toggle();
      -		return false;
      -	}).next().hide();
      -});
      -

      Or animated:

      -
      jQuery(document).ready(function(){
      -	$('.accordion .head').click(function() {
      -		$(this).next().toggle('slow');
      -		return false;
      -	}).next().hide();
      -});
      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Effects Core (Optional - only for non-default animations)
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Accordion.
      -

      -
      $("#accordion").accordion();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#accordion").accordion();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="accordion">
      -	<h3><a href="#">Section 1</a></h3>
      -	<div>
      -		<p>
      -		Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
      -		ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
      -		amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
      -		odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
      -		</p>
      -	</div>
      -	<h3><a href="#">Section 2</a></h3>
      -	<div>
      -		<p>
      -		Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
      -		purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
      -		velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
      -		suscipit faucibus urna.
      -		</p>
      -	</div>
      -	<h3><a href="#">Section 3</a></h3>
      -	<div>
      -		<p>
      -		Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
      -		Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
      -		ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
      -		lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
      -		</p>
      -		<ul>
      -			<li>List item one</li>
      -			<li>List item two</li>
      -			<li>List item three</li>
      -		</ul>
      -	</div>
      -	<h3><a href="#">Section 4</a></h3>
      -	<div>
      -		<p>
      -		Cras dictum. Pellentesque habitant morbi tristique senectus et netus
      -		et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
      -		faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
      -		mauris vel est.
      -		</p>
      -		<p>
      -		Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
      -		Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
      -		inceptos himenaeos.
      -		</p>
      -	</div>
      -</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the accordion. Can be set when initialising (first creating) the accordion.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the disabled option specified. -
        -
        -
        $( ".selector" ).accordion({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).accordion( "option", "disabled" );
        -//setter
        -$( ".selector" ).accordion( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        active

        -
        -
        Type:
        -
        Selector, Element, jQuery, Boolean, Number
        - -
        Default:
        -
        first child
        - -
        -
        -
        -

        Selector for the active element. Set to false to display none at start. Needs collapsible: true.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the active option specified. -
        -
        -
        $( ".selector" ).accordion({ active: 2 });
        -
        - - -
        - Get or set the active option, after init. -
        -
        -
        //getter
        -var active = $( ".selector" ).accordion( "option", "active" );
        -//setter
        -$( ".selector" ).accordion( "option", "active", 2 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        animated

        -
        -
        Type:
        -
        Boolean, String
        - -
        Default:
        -
        'slide'
        - -
        -
        -
        -

        Choose your favorite animation, or disable them (set to false). In addition to the default, 'bounceslide' and all defined easing methods are supported ('bounceslide' requires UI Effects Core).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the animated option specified. -
        -
        -
        $( ".selector" ).accordion({ animated: 'bounceslide' });
        -
        - - -
        - Get or set the animated option, after init. -
        -
        -
        //getter
        -var animated = $( ".selector" ).accordion( "option", "animated" );
        -//setter
        -$( ".selector" ).accordion( "option", "animated", 'bounceslide' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoHeight

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set, the highest content part is used as height reference for all other parts. Provides more consistent animations.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the autoHeight option specified. -
        -
        -
        $( ".selector" ).accordion({ autoHeight: false });
        -
        - - -
        - Get or set the autoHeight option, after init. -
        -
        -
        //getter
        -var autoHeight = $( ".selector" ).accordion( "option", "autoHeight" );
        -//setter
        -$( ".selector" ).accordion( "option", "autoHeight", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        clearStyle

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the clearStyle option specified. -
        -
        -
        $( ".selector" ).accordion({ clearStyle: true });
        -
        - - -
        - Get or set the clearStyle option, after init. -
        -
        -
        //getter
        -var clearStyle = $( ".selector" ).accordion( "option", "clearStyle" );
        -//setter
        -$( ".selector" ).accordion( "option", "clearStyle", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        collapsible

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event (click is the default).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the collapsible option specified. -
        -
        -
        $( ".selector" ).accordion({ collapsible: true });
        -
        - - -
        - Get or set the collapsible option, after init. -
        -
        -
        //getter
        -var collapsible = $( ".selector" ).accordion( "option", "collapsible" );
        -//setter
        -$( ".selector" ).accordion( "option", "collapsible", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        event

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'click'
        - -
        -
        -
        -

        The event on which to trigger the accordion.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the event option specified. -
        -
        -
        $( ".selector" ).accordion({ event: 'mouseover' });
        -
        - - -
        - Get or set the event option, after init. -
        -
        -
        //getter
        -var event = $( ".selector" ).accordion( "option", "event" );
        -//setter
        -$( ".selector" ).accordion( "option", "event", 'mouseover' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        fillSpace

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set, the accordion completely fills the height of the parent element. Overrides autoheight.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the fillSpace option specified. -
        -
        -
        $( ".selector" ).accordion({ fillSpace: true });
        -
        - - -
        - Get or set the fillSpace option, after init. -
        -
        -
        //getter
        -var fillSpace = $( ".selector" ).accordion( "option", "fillSpace" );
        -//setter
        -$( ".selector" ).accordion( "option", "fillSpace", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        header

        -
        -
        Type:
        -
        Selector, jQuery
        - -
        Default:
        -
        '> li > :first-child,> :not(li):even'
        - -
        -
        -
        -

        Selector for the header element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the header option specified. -
        -
        -
        $( ".selector" ).accordion({ header: 'h3' });
        -
        - - -
        - Get or set the header option, after init. -
        -
        -
        //getter
        -var header = $( ".selector" ).accordion( "option", "header" );
        -//setter
        -$( ".selector" ).accordion( "option", "header", 'h3' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        icons

        -
        -
        Type:
        -
        Object
        - -
        Default:
        -
        { 'header': 'ui-icon-triangle-1-e', 'headerSelected': 'ui-icon-triangle-1-s' }
        - -
        -
        -
        -

        Icons to use for headers. Icons may be specified for 'header' and 'headerSelected', and we recommend using the icons native to the jQuery UI CSS Framework manipulated by jQuery UI ThemeRoller

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the icons option specified. -
        -
        -
        $( ".selector" ).accordion({ icons: { 'header': 'ui-icon-plus', 'headerSelected': 'ui-icon-minus' } });
        -
        - - -
        - Get or set the icons option, after init. -
        -
        -
        //getter
        -var icons = $( ".selector" ).accordion( "option", "icons" );
        -//setter
        -$( ".selector" ).accordion( "option", "icons", { 'header': 'ui-icon-plus', 'headerSelected': 'ui-icon-minus' } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        navigation

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set, looks for the anchor that matches location.href and activates it. Great for href-based state-saving. Use navigationFilter to implement your own matcher.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the navigation option specified. -
        -
        -
        $( ".selector" ).accordion({ navigation: true });
        -
        - - -
        - Get or set the navigation option, after init. -
        -
        -
        //getter
        -var navigation = $( ".selector" ).accordion( "option", "navigation" );
        -//setter
        -$( ".selector" ).accordion( "option", "navigation", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        navigationFilter

        -
        -
        Type:
        -
        Function
        - -
        Default:
        -
        - -
        -
        -
        -

        Overwrite the default location.href-matching with your own matcher.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a accordion with the navigationFilter option specified. -
        -
        -
        $( ".selector" ).accordion({ navigationFilter: function(){ ... } });
        -
        - - -
        - Get or set the navigationFilter option, after init. -
        -
        -
        //getter
        -var navigationFilter = $( ".selector" ).accordion( "option", "navigationFilter" );
        -//setter
        -$( ".selector" ).accordion( "option", "navigationFilter", function(){ ... } );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        accordioncreate
        -
        -
        -
        -

        This event is triggered when accordion is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).accordion({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: accordioncreate. -
        -
        -
        $( ".selector" ).bind( "accordioncreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        change

        -
        -
        Type:
        -
        accordionchange
        -
        -
        -
        -

        This event is triggered every time the accordion changes. If the accordion is animated, the event will be triggered upon completion of the animation; otherwise, it is triggered immediately. -

        -
        $('.ui-accordion').bind('accordionchange', function(event, ui) {
        -  ui.newHeader // jQuery object, activated header
        -  ui.oldHeader // jQuery object, previous header
        -  ui.newContent // jQuery object, activated content
        -  ui.oldContent // jQuery object, previous content
        -});

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the change event as an init option. -
        -
        -
        $( ".selector" ).accordion({
        -   change: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the change event by type: accordionchange. -
        -
        -
        $( ".selector" ).bind( "accordionchange", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -

        -

      • -
        -

        changestart

        -
        -
        Type:
        -
        accordionchangestart
        -
        -
        -
        -

        This event is triggered every time the accordion starts to change. -

        -
        $('.ui-accordion').bind('accordionchangestart', function(event, ui) {
        -  ui.newHeader // jQuery object, activated header
        -  ui.oldHeader // jQuery object, previous header
        -  ui.newContent // jQuery object, activated content
        -  ui.oldContent // jQuery object, previous content
        -});

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the changestart event as an init option. -
        -
        -
        $( ".selector" ).accordion({
        -   changestart: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the changestart event by type: accordionchangestart. -
        -
        -
        $( ".selector" ).bind( "accordionchangestart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .accordion( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the accordion functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - -

        -

      • -
        -

        disable

        -
        -
        Signature:
        -
        .accordion( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the accordion.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .accordion( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the accordion.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .accordion( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any accordion option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .accordion( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple accordion options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .accordion( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-accordion element.

        -
        -
      • - - -
      • -
        -

        activate

        -
        -
        Signature:
        -
        .accordion( "activate" - -, index - - - - - -)
        -
        -
        -
        -

        Activate a content part of the Accordion programmatically. The index can be a zero-indexed number to match the position of the header to close or a Selector matching an element. Pass false to close all (only possible with collapsible:true).

        -
        -
      • - - -
      • -
        -

        resize

        -
        -
        Signature:
        -
        .accordion( "resize" - - - - - - - -)
        -
        -
        -
        -

        Recompute heights of the accordion contents when using the fillSpace option and the container height changed. For example, when the container is a resizable, this method should be called by its resize-event.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Accordion plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.accordion.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-accordion ui-widget ui-helper-reset">
      -  <h3 class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
      -    <span class="ui-icon ui-icon-triangle-1-s"/>
      -    <a href="#">Section 1</a>
      -  </h3>
      -  <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active">
      -    Section 1 content
      -  </div>
      -  <h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
      -    <span class="ui-icon ui-icon-triangle-1-e"/>
      -    <a href="#">Section 2</a>
      -  </h3>
      -  <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">
      -    Section 2 content
      -  </div>
      -  <h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
      -    <span class="ui-icon ui-icon-triangle-1-e"/>
      -    <a href="#">Section 3</a>
      -  </h3>
      -  <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">
      -    Section 3 content
      -  </div>
      -</div>
      -

      - - Note: This is a sample of markup generated by the accordion plugin, not markup you should use to create a accordion. The only markup needed for that is
      <div>
      -   <h3><a href="#">Section 1</a></h3>
      -   <div>
      -      Section 1 content
      -   </div>
      -   <h3><a href="#">Section 2</a></h3>
      -   <div>
      -      Section 2 content
      -   </div>
      -   <h3><a href="#">Section 3</a></h3>
      -   <div>
      -      Section 3 content
      -   </div>
      -</div>. -
      -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/addClass.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/addClass.html deleted file mode 100644 index 71ef919137..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/addClass.html +++ /dev/null @@ -1,109 +0,0 @@ - - -
      -

      jQuery UI addClass

      -
      -

      Overview

      -
      -

      addClass( class, [duration] )

      -

      Adds the specified class to each of the set of matched elements with an optional transition between the states.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Adds the class 'selected' to the matched elements with a one second transition.
      -

      -
      $("p").click(function () {
      -      $(this).addClass("selected", 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<style type="text/css">
      -  p { cursor: pointer; font-size: 1.2em; }
      -  .selected { color:red; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $(this).addClass("selected", 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  <p>Click me to add a 'selected' class.</p>
      -<p>Click me to add a 'selected' class.</p>
      -<p>Click me to add a 'selected' class.</p>
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        class

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        One CSS class to add to the elements.

        -
        -
      • - - -
      • -
        -

        duration

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/animate.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/animate.html deleted file mode 100644 index 834f011fdf..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/animate.html +++ /dev/null @@ -1,78 +0,0 @@ -

      The jQuery UI effects core extends the animate function to be able to animate colors as well. It's heavily used by the class transition feature and it's able to color animate the following properties: -

      -
      • backgroundColor -
      • borderBottomColor -
      • borderLeftColor -
      • borderRightColor -
      • borderTopColor -
      • color -
      • outlineColor -
      -

      with one of the following combinations: -

      -
      • hex (#FF0000) -
      • rgb (rgb(255,255,255)) -
      • names ("black") -
      -


      -

      -
      NameType
      Example: -
      - -
      -A simple color animation.
      -

      -
      $(".block").toggle(function() {
      -    $(this).animate({ backgroundColor: "black" }, 1000);
      -},function() {
      -    $(this).animate({ backgroundColor: "#68BFEF" }, 500);
      -});
      -
      -
      -

      -

      -
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
      -                    "http://www.w3.org/TR/html4/loose.dtd">
      -<html>
      -<head>
      -  <script src="http://code.jquery.com/jquery-latest.js"></script>
      -  
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -
      -  <script>
      -  $(document).ready(function(){
      -    $(".block").toggle(function() {
      -    $(this).animate({ backgroundColor: "black" }, 1000);
      -},function() {
      -    $(this).animate({ backgroundColor: "#68BFEF" }, 500);
      -});
      -
      -  });
      -  </script>
      -  <style>
      -  .block { 
      -    color: white;
      -    background-color: #68BFEF;
      -    width: 150px; 
      -    height: 70px;
      -    margin: 10px; 
      -  }
      -  </style>
      -</head>
      -<body>
      -  <div class="block"> Click me</div>
      -</body>
      -</html>
      -
      -

      -

      -

      NameType
      -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/autocomplete.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/autocomplete.html deleted file mode 100644 index 3e02d8c859..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/autocomplete.html +++ /dev/null @@ -1,875 +0,0 @@ - - -
      -

      jQuery UI Autocomplete

      -
      -

      Overview

      -
      -

      Autocomplete, when added to an input field, enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering.

      -

      By giving an Autocomplete field focus or entering something into it, the plugin starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches.

      -

      This can be used to enter previous selected values, for example you could use Autocomplete for entering tags, to complete an address, you could enter a city name and get the zip code, or maybe enter email addresses from an address book.

      -

      You can pull data in from a local and/or a remote source: Local is good for small data sets (like an address book with 50 entries), remote is necessary for big data sets, like a database with hundreds or millions of entries to select from.

      -

      Autocomplete can be customized to work with various data sources, by just specifying the source option. A data source can be:

      -
        -
      • an Array with local data
      • -
      • a String, specifying a URL
      • -
      • a Callback
      • -
      -

      The local data can be a simple Array of Strings, or it contains Objects for each item in the array, with either a label or value property or both. The label property is displayed in the suggestion menu. The value will be inserted into the input element after the user selected something from the menu. If just one property is specified, it will be used for both, eg. if you provide only value-properties, the value will also be used as the label.

      -

      When a String is used, the Autocomplete plugin expects that string to point to a URL resource that will return JSON data. It can be on the same host or on a different one (must provide JSONP). The request parameter "term" gets added to that URL. The data itself can be in the same format as the local data described above.

      -

      The third variation, the callback, provides the most flexibility, and can be used to connect any data source to Autocomplete. The callback gets two arguments:

      -
        -
      • A request object, with a single property called "term", which refers to the value currently in the text input. For example, when the user entered "new yo" in a city field, the Autocomplete term will equal "new yo".
      • -
      • A response callback, which expects a single argument to contain the data to suggest to the user. This data should be filtered based on the provided term, and can be in any of the formats described above for simple local data (String-Array or Object-Array with label/value/both properties). It's important when providing a custom source callback to handle errors during the request. You must always call the response callback even if you encounter an error. This ensures that the widget always has the correct state.
      • -
      -

      The label is always treated as text, if you want the label to be treated as html you can use Scott González' html extension. The demos all focus on different variations of the source-option - look for the one that matches your use case, and take a look at the code.

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Position
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Autocomplete.
      -

      -
      $("input#autocomplete").autocomplete({
      -    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
      -});
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("input#autocomplete").autocomplete({
      -    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
      -});
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<input id="autocomplete" />
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the autocomplete. Can be set when initialising (first creating) the autocomplete.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the disabled option specified. -
        -
        -
        $( ".selector" ).autocomplete({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).autocomplete( "option", "disabled" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        appendTo

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        "body"
        - -
        -
        -
        -

        Which element the menu should be appended to.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the appendTo option specified. -
        -
        -
        $( ".selector" ).autocomplete({ appendTo: "#someElem" });
        -
        - - -
        - Get or set the appendTo option, after init. -
        -
        -
        //getter
        -var appendTo = $( ".selector" ).autocomplete( "option", "appendTo" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "appendTo", "#someElem" );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoFocus

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true the first item will be automatically focused.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the autoFocus option specified. -
        -
        -
        $( ".selector" ).autocomplete({ autoFocus: true });
        -
        - - -
        - Get or set the autoFocus option, after init. -
        -
        -
        //getter
        -var autoFocus = $( ".selector" ).autocomplete( "option", "autoFocus" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "autoFocus", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        delay

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        300
        - -
        -
        -
        -

        The delay in milliseconds the Autocomplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the delay option specified. -
        -
        -
        $( ".selector" ).autocomplete({ delay: 0 });
        -
        - - -
        - Get or set the delay option, after init. -
        -
        -
        //getter
        -var delay = $( ".selector" ).autocomplete( "option", "delay" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "delay", 0 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minLength

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        The minimum number of characters a user has to type before the Autocomplete activates. Zero is useful for local data with just a few items. Should be increased when there are a lot of items, where a single character would match a few thousand items.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the minLength option specified. -
        -
        -
        $( ".selector" ).autocomplete({ minLength: 0 });
        -
        - - -
        - Get or set the minLength option, after init. -
        -
        -
        //getter
        -var minLength = $( ".selector" ).autocomplete( "option", "minLength" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "minLength", 0 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        position

        -
        -
        Type:
        -
        Object
        - -
        Default:
        -
        { my: "left top", at: "left bottom", collision: "none" }
        - -
        -
        -
        -

        Identifies the position of the Autocomplete widget in relation to the associated input element. The "of" option defaults to the input element, but you can specify another element to position against. You can refer to the jQuery UI Position utility for more details about the various options.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the position option specified. -
        -
        -
        $( ".selector" ).autocomplete({ position: { my : "right top", at: "right bottom" } });
        -
        - - -
        - Get or set the position option, after init. -
        -
        -
        //getter
        -var position = $( ".selector" ).autocomplete( "option", "position" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "position", { my : "right top", at: "right bottom" } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        source

        -
        -
        Type:
        -
        String, Array, Callback
        - -
        Default:
        -
        none, must be specified
        - -
        -
        -
        -

        Defines the data to use, must be specified. See Overview section for more details, and look at the various demos. -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a autocomplete with the source option specified. -
        -
        -
        $( ".selector" ).autocomplete({ source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] });
        -
        - - -
        - Get or set the source option, after init. -
        -
        -
        //getter
        -var source = $( ".selector" ).autocomplete( "option", "source" );
        -//setter
        -$( ".selector" ).autocomplete( "option", "source", ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        autocompletecreate
        -
        -
        -
        -

        This event is triggered when autocomplete is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: autocompletecreate. -
        -
        -
        $( ".selector" ).bind( "autocompletecreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - - - - -
      • -
        -

        open

        -
        -
        Type:
        -
        autocompleteopen
        -
        -
        -
        -

        Triggered when the suggestion menu is opened.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the open event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   open: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the open event by type: autocompleteopen. -
        -
        -
        $( ".selector" ).bind( "autocompleteopen", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        focus

        -
        -
        Type:
        -
        autocompletefocus
        -
        -
        -
        -

        Before focus is moved to an item (not selecting), ui.item refers to the focused item. The default action of focus is to replace the text field's value with the value of the focused item, though only if the focus event was triggered by a keyboard interaction. Canceling this event prevents the value from being updated, but does not prevent the menu item from being focused.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the focus event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   focus: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the focus event by type: autocompletefocus. -
        -
        -
        $( ".selector" ).bind( "autocompletefocus", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        select

        -
        -
        Type:
        -
        autocompleteselect
        -
        -
        -
        -

        Triggered when an item is selected from the menu; ui.item refers to the selected item. The default action of select is to replace the text field's value with the value of the selected item. Canceling this event prevents the value from being updated, but does not prevent the menu from closing.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the select event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   select: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the select event by type: autocompleteselect. -
        -
        -
        $( ".selector" ).bind( "autocompleteselect", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        close

        -
        -
        Type:
        -
        autocompleteclose
        -
        -
        -
        -

        When the list is hidden - doesn't have to occur together with a change.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the close event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   close: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the close event by type: autocompleteclose. -
        -
        -
        $( ".selector" ).bind( "autocompleteclose", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        change

        -
        -
        Type:
        -
        autocompletechange
        -
        -
        -
        -

        After an item was selected; ui.item refers to the selected item. Always triggered after the close event.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the change event as an init option. -
        -
        -
        $( ".selector" ).autocomplete({
        -   change: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the change event by type: autocompletechange. -
        -
        -
        $( ".selector" ).bind( "autocompletechange", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .autocomplete( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the autocomplete functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .autocomplete( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the autocomplete.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .autocomplete( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the autocomplete.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .autocomplete( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any autocomplete option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .autocomplete( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple autocomplete options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .autocomplete( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-autocomplete element.

        -
        -
      • - - - - - -
      • -
        -

        close

        -
        -
        Signature:
        -
        .autocomplete( "close" - - - - - - - -)
        -
        -
        -
        -

        Close the Autocomplete menu. Useful in combination with the search method, to close the open menu.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Autocomplete plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.autocomplete.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <input class="ui-autocomplete-input"/>
      -<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all">
      -  <li class="ui-menu-item">
      -    <a class="ui-corner-all">item 1</a>
      -  </li>
      -  <li class="ui-menu-item">
      -    <a class="ui-corner-all">item 2</a>
      -  </li>
      -  <li class="ui-menu-item">
      -    <a class="ui-corner-all">item 3</a>
      -  </li>
      -</ul> -

      - - Note: This is a sample of markup generated by the autocomplete plugin, not markup you should use to create a autocomplete. The only markup needed for that is <input/>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/button.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/button.html deleted file mode 100644 index 116dcc120e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/button.html +++ /dev/null @@ -1,500 +0,0 @@ - - -
      -

      jQuery UI Button

      -
      -

      Overview

      -
      -

      Button enhances standard form elements like button, input of type submit or reset or anchors to themable buttons with appropiate mouseover and active styles.

      -

      In addition to basic push buttons, radio buttons and checkboxes (inputs of type radio and checkbox) can be converted to buttons: Their associated label is styled to appear as the button, while the underlying input is updated on click.

      -

      In order to group radio buttons, Button also provides an additional widget-method, called Buttonset. Its used by selecting a container element (which contains the radio buttons) and calling buttonset(). Buttonset will also provide visual grouping, and therefore should be used whenever you have a group of buttons. It works by selecting all descendents and applying button() to them. You can enable and disable a buttonset, which will enable and disable all contained buttons. Destroying a buttonset also calls the button's destroy method.

      -

      When using an input of type button, submit or reset, support is limited to plain text labels with no icons.

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Button.
      -

      -
      $("button").button();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("button").button();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<button>Button label</button>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      - -
      -A simple jQuery UI Button.
      -

      -
      $("#radio").buttonset();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#radio").buttonset();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="radio">
      -	<input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
      -	<input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
      -	<input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
      -</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the button. Can be set when initialising (first creating) the button.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a button with the disabled option specified. -
        -
        -
        $( ".selector" ).button({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).button( "option", "disabled" );
        -//setter
        -$( ".selector" ).button( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        text

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a button with the text option specified. -
        -
        -
        $( ".selector" ).button({ text: false });
        -
        - - -
        - Get or set the text option, after init. -
        -
        -
        //getter
        -var text = $( ".selector" ).button( "option", "text" );
        -//setter
        -$( ".selector" ).button( "option", "text", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        icons

        -
        -
        Type:
        -
        Options
        - -
        Default:
        -
        { primary: null, secondary: null }
        - -
        -
        -
        -

        Icons to display, with or without text (see text option). The primary icon is displayed by default on the left of the label text, the secondary by default is on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only one icon: icons: {primary:'ui-icon-locked'}. For using two icons: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a button with the icons option specified. -
        -
        -
        $( ".selector" ).button({ icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} });
        -
        - - -
        - Get or set the icons option, after init. -
        -
        -
        //getter
        -var icons = $( ".selector" ).button( "option", "icons" );
        -//setter
        -$( ".selector" ).button( "option", "icons", {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} );
        -
        - -
        -
        -
      • - - -
      • -
        -

        label

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        HTML content of the button, or value attribute
        - -
        -
        -
        -

        Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a button with the label option specified. -
        -
        -
        $( ".selector" ).button({ label: "custom label" });
        -
        - - -
        - Get or set the label option, after init. -
        -
        -
        //getter
        -var label = $( ".selector" ).button( "option", "label" );
        -//setter
        -$( ".selector" ).button( "option", "label", "custom label" );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        buttoncreate
        -
        -
        -
        -

        This event is triggered when button is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).button({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: buttoncreate. -
        -
        -
        $( ".selector" ).bind( "buttoncreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -

        -

        There are no events for this plugin.

        -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .button( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the button functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - -

        -

      • -
        -

        disable

        -
        -
        Signature:
        -
        .button( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the button.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .button( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the button.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .button( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any button option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .button( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple button options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .button( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-button element.

        -
        -
      • - - -
      • -
        -

        refresh

        -
        -
        Signature:
        -
        .button( "refresh" - - - - - - - -)
        -
        -
        -
        -

        Refreshes the visual state of the button. Useful for updating button state after the native element's checked or disabled state is changed programatically.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Button plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.button.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all">
      -   <span class="ui-button-text">Button Label</span>
      </button> -

      - - Note: This is a sample of markup generated by the button plugin, not markup you should use to create a button. The only markup needed for that is <button>Button Label</button>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/datepicker.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/datepicker.html deleted file mode 100644 index c461f41e8a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/datepicker.html +++ /dev/null @@ -1,2570 +0,0 @@ - - -
      -

      jQuery UI Datepicker

      -
      -

      Overview

      -
      -

      The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and language, restrict the selectable date ranges and add in buttons and other navigation options easily.

      -

      By default, the datepicker calendar opens in a small overlay onFocus and closes automatically onBlur or when a date is selected. For an inline calendar, simply attach the datepicker to a div or span. -

      You can use keyboard shortcuts to drive the datepicker: -

      -
        -
      • page up/down - previous/next month
      • -
      • ctrl+page up/down - previous/next year
      • -
      • ctrl+home - current month or open when closed
      • -
      • ctrl+left/right - previous/next day
      • -
      • ctrl+up/down - previous/next week
      • -
      • enter - accept the selected date
      • -
      • ctrl+end - close and erase the date
      • -
      • escape - close the datepicker without selection
      • -
      -

      Utility functions

      - -

      Localization

      -

      Datepicker provides support for localizing its content to cater for different languages - and date formats. Each localization is contained within its own file with the - language code appended to the name, e.g. jquery.ui.datepicker-fr.js for French. - The desired localization file should be include after the main datepicker code. They add their settings to the set - of available localizations and automatically apply them as defaults for all instances.

      -

      The $.datepicker.regional attribute holds an array of localizations, - indexed by language code, with '' referring to the default (English). Each entry is - an object with the following attributes: closeText, prevText, - nextText, currentText, monthNames, - monthNamesShort, dayNames, dayNamesShort, - dayNamesMin, weekHeader, dateFormat, - firstDay, isRTL, showMonthAfterYear, - and yearSuffix.

      -

      You can restore the default localizations with:

      -

      $.datepicker.setDefaults($.datepicker.regional['']); -

      -

      And can then override an individual datepicker for a specific locale:

      -

      $(selector).datepicker($.datepicker.regional['fr']); -

      -The localization files are also available in the UI svn: http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/ -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Datepicker.
      -

      -
      $("#datepicker").datepicker();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#datepicker").datepicker();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div type="text" id="datepicker"></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the datepicker. Can be set when initialising (first creating) the datepicker.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the disabled option specified. -
        -
        -
        $( ".selector" ).datepicker({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).datepicker( "option", "disabled" );
        -//setter
        -$( ".selector" ).datepicker( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        altField

        -
        -
        Type:
        -
        Selector, jQuery, Element
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        The jQuery selector for another field that is to be updated with the selected date from the datepicker. Use the altFormat setting to change the format of the date within this field. Leave as blank for no alternate field.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the altField option specified. -
        -
        -
        $( ".selector" ).datepicker({ altField: '#actualDate' });
        -
        - - -
        - Get or set the altField option, after init. -
        -
        -
        //getter
        -var altField = $( ".selector" ).datepicker( "option", "altField" );
        -//setter
        -$( ".selector" ).datepicker( "option", "altField", '#actualDate' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        altFormat

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        The dateFormat to be used for the altField option. This allows one date format to be shown to the user for selection purposes, while a different format is actually sent behind the scenes. For a full list of the possible formats see the formatDate function

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the altFormat option specified. -
        -
        -
        $( ".selector" ).datepicker({ altFormat: 'yy-mm-dd' });
        -
        - - -
        - Get or set the altFormat option, after init. -
        -
        -
        //getter
        -var altFormat = $( ".selector" ).datepicker( "option", "altFormat" );
        -//setter
        -$( ".selector" ).datepicker( "option", "altFormat", 'yy-mm-dd' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        appendText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        The text to display after each date field, e.g. to show the required format.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the appendText option specified. -
        -
        -
        $( ".selector" ).datepicker({ appendText: '(yyyy-mm-dd)' });
        -
        - - -
        - Get or set the appendText option, after init. -
        -
        -
        //getter
        -var appendText = $( ".selector" ).datepicker( "option", "appendText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "appendText", '(yyyy-mm-dd)' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoSize

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Set to true to automatically resize the input field to accomodate dates in the current dateFormat.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the autoSize option specified. -
        -
        -
        $( ".selector" ).datepicker({ autoSize: true });
        -
        - - -
        - Get or set the autoSize option, after init. -
        -
        -
        //getter
        -var autoSize = $( ".selector" ).datepicker( "option", "autoSize" );
        -//setter
        -$( ".selector" ).datepicker( "option", "autoSize", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        buttonImage

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        The URL for the popup button image. If set, buttonText becomes the alt value and is not directly displayed.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the buttonImage option specified. -
        -
        -
        $( ".selector" ).datepicker({ buttonImage: '/images/datepicker.gif' });
        -
        - - -
        - Get or set the buttonImage option, after init. -
        -
        -
        //getter
        -var buttonImage = $( ".selector" ).datepicker( "option", "buttonImage" );
        -//setter
        -$( ".selector" ).datepicker( "option", "buttonImage", '/images/datepicker.gif' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        buttonImageOnly

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Set to true to place an image after the field to use as the trigger without it appearing on a button.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the buttonImageOnly option specified. -
        -
        -
        $( ".selector" ).datepicker({ buttonImageOnly: true });
        -
        - - -
        - Get or set the buttonImageOnly option, after init. -
        -
        -
        //getter
        -var buttonImageOnly = $( ".selector" ).datepicker( "option", "buttonImageOnly" );
        -//setter
        -$( ".selector" ).datepicker( "option", "buttonImageOnly", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        buttonText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        '...'
        - -
        -
        -
        -

        The text to display on the trigger button. Use in conjunction with showOn equal to 'button' or 'both'.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the buttonText option specified. -
        -
        -
        $( ".selector" ).datepicker({ buttonText: 'Choose' });
        -
        - - -
        - Get or set the buttonText option, after init. -
        -
        -
        //getter
        -var buttonText = $( ".selector" ).datepicker( "option", "buttonText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "buttonText", 'Choose' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        calculateWeek

        -
        -
        Type:
        -
        Function
        - -
        Default:
        -
        $.datepicker.iso8601Week
        - -
        -
        -
        -

        A function to calculate the week of the year for a given date. The default implementation uses the ISO 8601 definition: weeks start on a Monday; the first week of the year contains the first Thursday of the year.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the calculateWeek option specified. -
        -
        -
        $( ".selector" ).datepicker({ calculateWeek: myWeekCalc });
        -
        - - -
        - Get or set the calculateWeek option, after init. -
        -
        -
        //getter
        -var calculateWeek = $( ".selector" ).datepicker( "option", "calculateWeek" );
        -//setter
        -$( ".selector" ).datepicker( "option", "calculateWeek", myWeekCalc );
        -
        - -
        -
        -
      • - - -
      • -
        -

        changeMonth

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Allows you to change the month by selecting from a drop-down list. You can enable this feature by setting the attribute to true.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the changeMonth option specified. -
        -
        -
        $( ".selector" ).datepicker({ changeMonth: true });
        -
        - - -
        - Get or set the changeMonth option, after init. -
        -
        -
        //getter
        -var changeMonth = $( ".selector" ).datepicker( "option", "changeMonth" );
        -//setter
        -$( ".selector" ).datepicker( "option", "changeMonth", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        changeYear

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Allows you to change the year by selecting from a drop-down list. You can enable this feature by setting the attribute to true. Use the yearRange option to control which years are made available for selection.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the changeYear option specified. -
        -
        -
        $( ".selector" ).datepicker({ changeYear: true });
        -
        - - -
        - Get or set the changeYear option, after init. -
        -
        -
        //getter
        -var changeYear = $( ".selector" ).datepicker( "option", "changeYear" );
        -//setter
        -$( ".selector" ).datepicker( "option", "changeYear", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        closeText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'Done'
        - -
        -
        -
        -

        The text to display for the close link. This attribute is one of the regionalisation attributes. Use the showButtonPanel to display this button.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the closeText option specified. -
        -
        -
        $( ".selector" ).datepicker({ closeText: 'X' });
        -
        - - -
        - Get or set the closeText option, after init. -
        -
        -
        //getter
        -var closeText = $( ".selector" ).datepicker( "option", "closeText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "closeText", 'X' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        constrainInput

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        When true entry in the input field is constrained to those characters allowed by the current dateFormat.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the constrainInput option specified. -
        -
        -
        $( ".selector" ).datepicker({ constrainInput: false });
        -
        - - -
        - Get or set the constrainInput option, after init. -
        -
        -
        //getter
        -var constrainInput = $( ".selector" ).datepicker( "option", "constrainInput" );
        -//setter
        -$( ".selector" ).datepicker( "option", "constrainInput", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        currentText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'Today'
        - -
        -
        -
        -

        The text to display for the current day link. This attribute is one of the regionalisation attributes. Use the showButtonPanel to display this button.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the currentText option specified. -
        -
        -
        $( ".selector" ).datepicker({ currentText: 'Now' });
        -
        - - -
        - Get or set the currentText option, after init. -
        -
        -
        //getter
        -var currentText = $( ".selector" ).datepicker( "option", "currentText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "currentText", 'Now' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dateFormat

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'mm/dd/yy'
        - -
        -
        -
        -

        The format for parsed and displayed dates. This attribute is one of the regionalisation attributes. For a full list of the possible formats see the formatDate function.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the dateFormat option specified. -
        -
        -
        $( ".selector" ).datepicker({ dateFormat: 'yy-mm-dd' });
        -
        - - -
        - Get or set the dateFormat option, after init. -
        -
        -
        //getter
        -var dateFormat = $( ".selector" ).datepicker( "option", "dateFormat" );
        -//setter
        -$( ".selector" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dayNames

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
        - -
        -
        -
        -

        The list of long day names, starting from Sunday, for use as requested via the dateFormat setting. They also appear as popup hints when hovering over the corresponding column headings. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the dayNames option specified. -
        -
        -
        $( ".selector" ).datepicker({ dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'] });
        -
        - - -
        - Get or set the dayNames option, after init. -
        -
        -
        //getter
        -var dayNames = $( ".selector" ).datepicker( "option", "dayNames" );
        -//setter
        -$( ".selector" ).datepicker( "option", "dayNames", ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dayNamesMin

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
        - -
        -
        -
        -

        The list of minimised day names, starting from Sunday, for use as column headers within the datepicker. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the dayNamesMin option specified. -
        -
        -
        $( ".selector" ).datepicker({ dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'] });
        -
        - - -
        - Get or set the dayNamesMin option, after init. -
        -
        -
        //getter
        -var dayNamesMin = $( ".selector" ).datepicker( "option", "dayNamesMin" );
        -//setter
        -$( ".selector" ).datepicker( "option", "dayNamesMin", ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dayNamesShort

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
        - -
        -
        -
        -

        The list of abbreviated day names, starting from Sunday, for use as requested via the dateFormat setting. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the dayNamesShort option specified. -
        -
        -
        $( ".selector" ).datepicker({ dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'] });
        -
        - - -
        - Get or set the dayNamesShort option, after init. -
        -
        -
        //getter
        -var dayNamesShort = $( ".selector" ).datepicker( "option", "dayNamesShort" );
        -//setter
        -$( ".selector" ).datepicker( "option", "dayNamesShort", ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        defaultDate

        -
        -
        Type:
        -
        Date, Number, String
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        Set the date to highlight on first opening if the field is blank. Specify either an actual date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null for today.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the defaultDate option specified. -
        -
        -
        $( ".selector" ).datepicker({ defaultDate: +7 });
        -
        - - -
        - Get or set the defaultDate option, after init. -
        -
        -
        //getter
        -var defaultDate = $( ".selector" ).datepicker( "option", "defaultDate" );
        -//setter
        -$( ".selector" ).datepicker( "option", "defaultDate", +7 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        duration

        -
        -
        Type:
        -
        String, Number
        - -
        Default:
        -
        'normal'
        - -
        -
        -
        -

        Control the speed at which the datepicker appears, it may be a time in milliseconds or a string representing one of the three predefined speeds ("slow", "normal", "fast").

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the duration option specified. -
        -
        -
        $( ".selector" ).datepicker({ duration: 'slow' });
        -
        - - -
        - Get or set the duration option, after init. -
        -
        -
        //getter
        -var duration = $( ".selector" ).datepicker( "option", "duration" );
        -//setter
        -$( ".selector" ).datepicker( "option", "duration", 'slow' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        firstDay

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Set the first day of the week: Sunday is 0, Monday is 1, ... This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the firstDay option specified. -
        -
        -
        $( ".selector" ).datepicker({ firstDay: 1 });
        -
        - - -
        - Get or set the firstDay option, after init. -
        -
        -
        //getter
        -var firstDay = $( ".selector" ).datepicker( "option", "firstDay" );
        -//setter
        -$( ".selector" ).datepicker( "option", "firstDay", 1 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        gotoCurrent

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        When true the current day link moves to the currently selected date instead of today.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the gotoCurrent option specified. -
        -
        -
        $( ".selector" ).datepicker({ gotoCurrent: true });
        -
        - - -
        - Get or set the gotoCurrent option, after init. -
        -
        -
        //getter
        -var gotoCurrent = $( ".selector" ).datepicker( "option", "gotoCurrent" );
        -//setter
        -$( ".selector" ).datepicker( "option", "gotoCurrent", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        hideIfNoPrevNext

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Normally the previous and next links are disabled when not applicable (see minDate/maxDate). You can hide them altogether by setting this attribute to true.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the hideIfNoPrevNext option specified. -
        -
        -
        $( ".selector" ).datepicker({ hideIfNoPrevNext: true });
        -
        - - -
        - Get or set the hideIfNoPrevNext option, after init. -
        -
        -
        //getter
        -var hideIfNoPrevNext = $( ".selector" ).datepicker( "option", "hideIfNoPrevNext" );
        -//setter
        -$( ".selector" ).datepicker( "option", "hideIfNoPrevNext", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        isRTL

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        True if the current language is drawn from right to left. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the isRTL option specified. -
        -
        -
        $( ".selector" ).datepicker({ isRTL: true });
        -
        - - -
        - Get or set the isRTL option, after init. -
        -
        -
        //getter
        -var isRTL = $( ".selector" ).datepicker( "option", "isRTL" );
        -//setter
        -$( ".selector" ).datepicker( "option", "isRTL", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        maxDate

        -
        -
        Type:
        -
        Date, Number, String
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        Set a maximum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +1w'), or null for no limit.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the maxDate option specified. -
        -
        -
        $( ".selector" ).datepicker({ maxDate: '+1m +1w' });
        -
        - - -
        - Get or set the maxDate option, after init. -
        -
        -
        //getter
        -var maxDate = $( ".selector" ).datepicker( "option", "maxDate" );
        -//setter
        -$( ".selector" ).datepicker( "option", "maxDate", '+1m +1w' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minDate

        -
        -
        Type:
        -
        Date, Number, String
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        Set a minimum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '-1y -1m'), or null for no limit.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the minDate option specified. -
        -
        -
        $( ".selector" ).datepicker({ minDate: new Date(2007, 1 - 1, 1) });
        -
        - - -
        - Get or set the minDate option, after init. -
        -
        -
        //getter
        -var minDate = $( ".selector" ).datepicker( "option", "minDate" );
        -//setter
        -$( ".selector" ).datepicker( "option", "minDate", new Date(2007, 1 - 1, 1) );
        -
        - -
        -
        -
      • - - -
      • -
        -

        monthNames

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
        - -
        -
        -
        -

        The list of full month names, for use as requested via the dateFormat setting. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the monthNames option specified. -
        -
        -
        $( ".selector" ).datepicker({ monthNames: ['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'] });
        -
        - - -
        - Get or set the monthNames option, after init. -
        -
        -
        //getter
        -var monthNames = $( ".selector" ).datepicker( "option", "monthNames" );
        -//setter
        -$( ".selector" ).datepicker( "option", "monthNames", ['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        monthNamesShort

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        - -
        -
        -
        -

        The list of abbreviated month names, as used in the month header on each datepicker and as requested via the dateFormat setting. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the monthNamesShort option specified. -
        -
        -
        $( ".selector" ).datepicker({ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'] });
        -
        - - -
        - Get or set the monthNamesShort option, after init. -
        -
        -
        //getter
        -var monthNamesShort = $( ".selector" ).datepicker( "option", "monthNamesShort" );
        -//setter
        -$( ".selector" ).datepicker( "option", "monthNamesShort", ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        navigationAsDateFormat

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        When true the formatDate function is applied to the prevText, nextText, and currentText values before display, allowing them to display the target month names for example.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the navigationAsDateFormat option specified. -
        -
        -
        $( ".selector" ).datepicker({ navigationAsDateFormat: true });
        -
        - - -
        - Get or set the navigationAsDateFormat option, after init. -
        -
        -
        //getter
        -var navigationAsDateFormat = $( ".selector" ).datepicker( "option", "navigationAsDateFormat" );
        -//setter
        -$( ".selector" ).datepicker( "option", "navigationAsDateFormat", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        nextText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'Next'
        - -
        -
        -
        -

        The text to display for the next month link. This attribute is one of the regionalisation attributes. With the standard ThemeRoller styling, this value is replaced by an icon.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the nextText option specified. -
        -
        -
        $( ".selector" ).datepicker({ nextText: 'Later' });
        -
        - - -
        - Get or set the nextText option, after init. -
        -
        -
        //getter
        -var nextText = $( ".selector" ).datepicker( "option", "nextText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "nextText", 'Later' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        numberOfMonths

        -
        -
        Type:
        -
        Number, Array
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Set how many months to show at once. The value can be a straight integer, or can be a two-element array to define the number of rows and columns to display.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the numberOfMonths option specified. -
        -
        -
        $( ".selector" ).datepicker({ numberOfMonths: [2, 3] });
        -
        - - -
        - Get or set the numberOfMonths option, after init. -
        -
        -
        //getter
        -var numberOfMonths = $( ".selector" ).datepicker( "option", "numberOfMonths" );
        -//setter
        -$( ".selector" ).datepicker( "option", "numberOfMonths", [2, 3] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        prevText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'Prev'
        - -
        -
        -
        -

        The text to display for the previous month link. This attribute is one of the regionalisation attributes. With the standard ThemeRoller styling, this value is replaced by an icon.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the prevText option specified. -
        -
        -
        $( ".selector" ).datepicker({ prevText: 'Earlier' });
        -
        - - -
        - Get or set the prevText option, after init. -
        -
        -
        //getter
        -var prevText = $( ".selector" ).datepicker( "option", "prevText" );
        -//setter
        -$( ".selector" ).datepicker( "option", "prevText", 'Earlier' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        selectOtherMonths

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        When true days in other months shown before or after the current month are selectable. This only applies if showOtherMonths is also true.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the selectOtherMonths option specified. -
        -
        -
        $( ".selector" ).datepicker({ selectOtherMonths: true });
        -
        - - -
        - Get or set the selectOtherMonths option, after init. -
        -
        -
        //getter
        -var selectOtherMonths = $( ".selector" ).datepicker( "option", "selectOtherMonths" );
        -//setter
        -$( ".selector" ).datepicker( "option", "selectOtherMonths", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        shortYearCutoff

        -
        -
        Type:
        -
        String, Number
        - -
        Default:
        -
        '+10'
        - -
        -
        -
        -

        Set the cutoff year for determining the century for a date (used in conjunction with dateFormat 'y'). If a numeric value (0-99) is provided then this value is used directly. If a string value is provided then it is converted to a number and added to the current year. Once the cutoff year is calculated, any dates entered with a year value less than or equal to it are considered to be in the current century, while those greater than it are deemed to be in the previous century.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the shortYearCutoff option specified. -
        -
        -
        $( ".selector" ).datepicker({ shortYearCutoff: 50 });
        -
        - - -
        - Get or set the shortYearCutoff option, after init. -
        -
        -
        //getter
        -var shortYearCutoff = $( ".selector" ).datepicker( "option", "shortYearCutoff" );
        -//setter
        -$( ".selector" ).datepicker( "option", "shortYearCutoff", 50 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showAnim

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'show'
        - -
        -
        -
        -

        Set the name of the animation used to show/hide the datepicker. Use 'show' (the default), 'slideDown', 'fadeIn', any of the show/hide jQuery UI effects, or '' for no animation.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showAnim option specified. -
        -
        -
        $( ".selector" ).datepicker({ showAnim: 'fold' });
        -
        - - -
        - Get or set the showAnim option, after init. -
        -
        -
        //getter
        -var showAnim = $( ".selector" ).datepicker( "option", "showAnim" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showAnim", 'fold' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showButtonPanel

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Whether to show the button panel.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showButtonPanel option specified. -
        -
        -
        $( ".selector" ).datepicker({ showButtonPanel: true });
        -
        - - -
        - Get or set the showButtonPanel option, after init. -
        -
        -
        //getter
        -var showButtonPanel = $( ".selector" ).datepicker( "option", "showButtonPanel" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showButtonPanel", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showCurrentAtPos

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Specify where in a multi-month display the current month shows, starting from 0 at the top/left.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showCurrentAtPos option specified. -
        -
        -
        $( ".selector" ).datepicker({ showCurrentAtPos: 3 });
        -
        - - -
        - Get or set the showCurrentAtPos option, after init. -
        -
        -
        //getter
        -var showCurrentAtPos = $( ".selector" ).datepicker( "option", "showCurrentAtPos" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showCurrentAtPos", 3 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showMonthAfterYear

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Whether to show the month after the year in the header. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showMonthAfterYear option specified. -
        -
        -
        $( ".selector" ).datepicker({ showMonthAfterYear: true });
        -
        - - -
        - Get or set the showMonthAfterYear option, after init. -
        -
        -
        //getter
        -var showMonthAfterYear = $( ".selector" ).datepicker( "option", "showMonthAfterYear" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showMonthAfterYear", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showOn

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'focus'
        - -
        -
        -
        -

        Have the datepicker appear automatically when the field receives focus ('focus'), appear only when a button is clicked ('button'), or appear when either event takes place ('both').

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showOn option specified. -
        -
        -
        $( ".selector" ).datepicker({ showOn: 'both' });
        -
        - - -
        - Get or set the showOn option, after init. -
        -
        -
        //getter
        -var showOn = $( ".selector" ).datepicker( "option", "showOn" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showOn", 'both' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showOptions

        -
        -
        Type:
        -
        Options
        - -
        Default:
        -
        {}
        - -
        -
        -
        -

        If using one of the jQuery UI effects for showAnim, you can provide additional settings for that animation via this option.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showOptions option specified. -
        -
        -
        $( ".selector" ).datepicker({ showOptions: {direction: 'up' });
        -
        - - -
        - Get or set the showOptions option, after init. -
        -
        -
        //getter
        -var showOptions = $( ".selector" ).datepicker( "option", "showOptions" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showOptions", {direction: 'up' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showOtherMonths

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Display dates in other months (non-selectable) at the start or end of the current month. To make these days selectable use selectOtherMonths.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showOtherMonths option specified. -
        -
        -
        $( ".selector" ).datepicker({ showOtherMonths: true });
        -
        - - -
        - Get or set the showOtherMonths option, after init. -
        -
        -
        //getter
        -var showOtherMonths = $( ".selector" ).datepicker( "option", "showOtherMonths" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showOtherMonths", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        showWeek

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        When true a column is added to show the week of the year. The calculateWeek option determines how the week of the year is calculated. You may also want to change the firstDay option.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the showWeek option specified. -
        -
        -
        $( ".selector" ).datepicker({ showWeek: true });
        -
        - - -
        - Get or set the showWeek option, after init. -
        -
        -
        //getter
        -var showWeek = $( ".selector" ).datepicker( "option", "showWeek" );
        -//setter
        -$( ".selector" ).datepicker( "option", "showWeek", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        stepMonths

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Set how many months to move when clicking the Previous/Next links.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the stepMonths option specified. -
        -
        -
        $( ".selector" ).datepicker({ stepMonths: 3 });
        -
        - - -
        - Get or set the stepMonths option, after init. -
        -
        -
        //getter
        -var stepMonths = $( ".selector" ).datepicker( "option", "stepMonths" );
        -//setter
        -$( ".selector" ).datepicker( "option", "stepMonths", 3 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        weekHeader

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'Wk'
        - -
        -
        -
        -

        The text to display for the week of the year column heading. This attribute is one of the regionalisation attributes. Use showWeek to display this column.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the weekHeader option specified. -
        -
        -
        $( ".selector" ).datepicker({ weekHeader: 'W' });
        -
        - - -
        - Get or set the weekHeader option, after init. -
        -
        -
        //getter
        -var weekHeader = $( ".selector" ).datepicker( "option", "weekHeader" );
        -//setter
        -$( ".selector" ).datepicker( "option", "weekHeader", 'W' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        yearRange

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'c-10:c+10'
        - -
        -
        -
        -

        Control the range of years displayed in the year drop-down: either relative to today's year (-nn:+nn), relative to the currently selected year (c-nn:c+nn), absolute (nnnn:nnnn), or combinations of these formats (nnnn:-nn). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the yearRange option specified. -
        -
        -
        $( ".selector" ).datepicker({ yearRange: '2000:2010' });
        -
        - - -
        - Get or set the yearRange option, after init. -
        -
        -
        //getter
        -var yearRange = $( ".selector" ).datepicker( "option", "yearRange" );
        -//setter
        -$( ".selector" ).datepicker( "option", "yearRange", '2000:2010' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        yearSuffix

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        Additional text to display after the year in the month headers. This attribute is one of the regionalisation attributes.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a datepicker with the yearSuffix option specified. -
        -
        -
        $( ".selector" ).datepicker({ yearSuffix: 'CE' });
        -
        - - -
        - Get or set the yearSuffix option, after init. -
        -
        -
        //getter
        -var yearSuffix = $( ".selector" ).datepicker( "option", "yearSuffix" );
        -//setter
        -$( ".selector" ).datepicker( "option", "yearSuffix", 'CE' );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        datepickercreate
        -
        -
        -
        -

        This event is triggered when datepicker is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).datepicker({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: datepickercreate. -
        -
        -
        $( ".selector" ).bind( "datepickercreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        beforeShow

        -
        -
        -
        function(input, inst)
        -
        -
        -
        -

        Can be a function that takes an input field and current datepicker instance and returns an options object to update the datepicker with. It is called just before the datepicker is displayed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the beforeShow event as an init option. -
        -
        -
        $('.selector').datepicker({
        -   beforeShow: function(input, inst) { ... }
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        beforeShowDay

        -
        -
        -
        function(date)
        -
        -
        -
        -

        The function takes a date as a parameter and must return an array with [0] equal to true/false indicating whether or not this date is selectable, [1] equal to a CSS class name(s) or '' for the default presentation, and [2] an optional popup tooltip for this date. It is called for each day in the datepicker before it is displayed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the beforeShowDay event as an init option. -
        -
        -
        $('.selector').datepicker({
        -   beforeShowDay: function(date) { ... }
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        onChangeMonthYear

        -
        -
        -
        function(year, month, inst)
        -
        -
        -
        -

        Allows you to define your own event when the datepicker moves to a new month and/or year. The function receives the selected year, month (1-12), and the datepicker instance as parameters. this refers to the associated input field.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the onChangeMonthYear event as an init option. -
        -
        -
        $('.selector').datepicker({
        -   onChangeMonthYear: function(year, month, inst) { ... }
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        onClose

        -
        -
        -
        function(dateText, inst)
        -
        -
        -
        -

        Allows you to define your own event when the datepicker is closed, whether or not a date is selected. The function receives the selected date as text ('' if none) and the datepicker instance as parameters. this refers to the associated input field.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the onClose event as an init option. -
        -
        -
        $('.selector').datepicker({
        -   onClose: function(dateText, inst) { ... }
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        onSelect

        -
        -
        -
        function(dateText, inst)
        -
        -
        -
        -

        Allows you to define your own event when the datepicker is selected. The function receives the selected date as text and the datepicker instance as parameters. this refers to the associated input field.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the onSelect event as an init option. -
        -
        -
        $('.selector').datepicker({
        -   onSelect: function(dateText, inst) { ... }
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .datepicker( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the datepicker functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .datepicker( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the datepicker.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .datepicker( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the datepicker.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .datepicker( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any datepicker option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .datepicker( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple datepicker options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .datepicker( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-datepicker element.

        -
        -
      • - - -
      • -
        -

        dialog

        -
        -
        Signature:
        -
        .datepicker( "dialog" - -, date - -, [onSelect] - -, [settings] - -, [pos] )
        -
        -
        -
        -

        Open a datepicker in a "dialog" box. -

        dateText: the initial date for the date picker as either a Date or a string in the current date format. -

        onSelect: A callback function when a date is selected. The function receives the date text and date picker instance as parameters. -

        settings: The new settings for the date picker. -

        pos: The position of the top/left of the dialog as [x, y] or a MouseEvent that contains the coordinates. If not specified the dialog is centered on the screen.

        -
        -
      • - - -
      • -
        -

        isDisabled

        -
        -
        Signature:
        -
        .datepicker( "isDisabled" - - - - - - - -)
        -
        -
        -
        -

        Determine whether a date picker has been disabled.

        -
        -
      • - - -
      • -
        -

        hide

        -
        -
        Signature:
        -
        .datepicker( "hide" - - - - - - - -)
        -
        -
        -
        -

        Close a previously opened date picker.

        -
        -
      • - - -
      • -
        -

        show

        -
        -
        Signature:
        -
        .datepicker( "show" - - - - - - - -)
        -
        -
        -
        -

        Call up a previously attached date picker.

        -
        -
      • - - -
      • -
        -

        refresh

        -
        -
        Signature:
        -
        .datepicker( "refresh" - - - - - - - -)
        -
        -
        -
        -

        Redraw a date picker, after having made some external modifications.

        -
        -
      • - - -
      • -
        -

        getDate

        -
        -
        Signature:
        -
        .datepicker( "getDate" - - - - - - - -)
        -
        -
        -
        -

        Returns the current date for the datepicker or null if no date has been selected.

        -
        -
      • - - -
      • -
        -

        setDate

        -
        -
        Signature:
        -
        .datepicker( "setDate" - -, date - - - - - -)
        -
        -
        -
        -

        Sets the current date for the datepicker. The new date may be a Date object or a string in the current date format (e.g. '01/26/2009'), a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null to clear the selected date.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Datepicker plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.datepicker.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible">
      -   <div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">
      -      <a class="ui-datepicker-prev ui-corner-all">title="Prev"><span class="ui-icon ui-icon-circle-triangle-w">Prev</span></a>
      -      <a class="ui-datepicker-next ui-corner-all" title="Next"><span class="ui-icon ui-icon-circle-triangle-e">Next</span></a>
      -      <div class="ui-datepicker-title">
      -         <span class="ui-datepicker-month">January</span><span class="ui-datepicker-year">2009</span>
      -      </div>
      -   </div>
      -   <table class="ui-datepicker-calendar">
      -      <thead>
      -      <tr>
      -         <th class="ui-datepicker-week-end"><span title="Sunday">Su</span></th>
      -         ...
      -      </tr>
      -      </thead>
      -      <tbody><tr>
      -         <td class="ui-datepicker-week-end ui-datepicker-other-month "> 1 </td>
      -         ...
      -      </tr>
      -      </tbody>
      -   </table>
      -   <div class="ui-datepicker-buttonpane ui-widget-content">
      -      <button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all">Today</button>
      -      <button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all">Done</button>
      -   </div>
      -</div>
      -

      - - Note: This is a sample of markup generated by the datepicker plugin, not markup you should use to create a datepicker. The only markup needed for that is <input type="text" /> or <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/dialog.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/dialog.html deleted file mode 100644 index 7342ef0062..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/dialog.html +++ /dev/null @@ -1,1698 +0,0 @@ - - -
      -

      jQuery UI Dialog

      -
      -

      Overview

      -
      -

      A dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and closed with the 'x' icon by default.

      -

      If the content length exceeds the maximum height, a scrollbar will automatically appear.

      -

      A bottom button bar and semi-transparent modal overlay layer are common options that can be added.

      -

      A call to $(foo).dialog() will initialize a dialog instance and will auto-open the dialog by default. If you want to reuse a dialog, the easiest way is to disable the "auto-open" option with: $(foo).dialog({ autoOpen: false }) and open it with $(foo).dialog('open'). To close it, use $(foo).dialog('close'). A more in-depth explanation with a full demo is available on the Nemikor blog.

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Position
      • -
      • UI Widget
      • -
      • UI Mouse (Optional; only needed if using UI Draggable or UI Resizable)
      • -
      • UI Draggable (Optional)
      • -
      • UI Resizable (Optional)
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Dialog.
      -

      -
      $("#dialog").dialog();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#dialog").dialog();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="dialog" title="Dialog Title">I'm in a dialog</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the dialog. Can be set when initialising (first creating) the dialog.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the disabled option specified. -
        -
        -
        $( ".selector" ).dialog({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).dialog( "option", "disabled" );
        -//setter
        -$( ".selector" ).dialog( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoOpen

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        When autoOpen is true the dialog will open automatically when dialog is called. If false it will stay hidden until .dialog("open") is called on it.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the autoOpen option specified. -
        -
        -
        $( ".selector" ).dialog({ autoOpen: false });
        -
        - - -
        - Get or set the autoOpen option, after init. -
        -
        -
        //getter
        -var autoOpen = $( ".selector" ).dialog( "option", "autoOpen" );
        -//setter
        -$( ".selector" ).dialog( "option", "autoOpen", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        buttons

        -
        -
        Type:
        -
        Object
        - -
        Default:
        -
        { }
        - -
        -
        -
        -

        Specifies which buttons should be displayed on the dialog. The property key is the text of the button. The value is the callback function for when the button is clicked. The context of the callback is the dialog element; if you need access to the button, it is available as the target of the event object. -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the buttons option specified. -
        -
        -
        $( ".selector" ).dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });
        -
        - - -
        - Get or set the buttons option, after init. -
        -
        -
        //getter
        -var buttons = $( ".selector" ).dialog( "option", "buttons" );
        -//setter
        -$( ".selector" ).dialog( "option", "buttons", { "Ok": function() { $(this).dialog("close"); } } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        buttons

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        [ ]
        - -
        -
        -
        -

        Specifies which buttons should be displayed on the dialog. Each element of the array must be an Object defining the properties to set on the button. -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the buttons option specified. -
        -
        -
        $( ".selector" ).dialog({ buttons: [
        -    {
        -        text: "Ok",
        -        click: function() { $(this).dialog("close"); }
        -    }
        -] });
        -
        - - -
        - Get or set the buttons option, after init. -
        -
        -
        //getter
        -var buttons = $( ".selector" ).dialog( "option", "buttons" );
        -//setter
        -$( ".selector" ).dialog( "option", "buttons", [
        -    {
        -        text: "Ok",
        -        click: function() { $(this).dialog("close"); }
        -    }
        -] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        closeOnEscape

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        Specifies whether the dialog should close when it has focus and the user presses the esacpe (ESC) key.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the closeOnEscape option specified. -
        -
        -
        $( ".selector" ).dialog({ closeOnEscape: false });
        -
        - - -
        - Get or set the closeOnEscape option, after init. -
        -
        -
        //getter
        -var closeOnEscape = $( ".selector" ).dialog( "option", "closeOnEscape" );
        -//setter
        -$( ".selector" ).dialog( "option", "closeOnEscape", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        closeText

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'close'
        - -
        -
        -
        -

        Specifies the text for the close button. Note that the close text is visibly hidden when using a standard theme.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the closeText option specified. -
        -
        -
        $( ".selector" ).dialog({ closeText: 'hide' });
        -
        - - -
        - Get or set the closeText option, after init. -
        -
        -
        //getter
        -var closeText = $( ".selector" ).dialog( "option", "closeText" );
        -//setter
        -$( ".selector" ).dialog( "option", "closeText", 'hide' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dialogClass

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        The specified class name(s) will be added to the dialog, for additional theming.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the dialogClass option specified. -
        -
        -
        $( ".selector" ).dialog({ dialogClass: 'alert' });
        -
        - - -
        - Get or set the dialogClass option, after init. -
        -
        -
        //getter
        -var dialogClass = $( ".selector" ).dialog( "option", "dialogClass" );
        -//setter
        -$( ".selector" ).dialog( "option", "dialogClass", 'alert' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        draggable

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to true, the dialog will be draggable will be draggable by the titlebar.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the draggable option specified. -
        -
        -
        $( ".selector" ).dialog({ draggable: false });
        -
        - - -
        - Get or set the draggable option, after init. -
        -
        -
        //getter
        -var draggable = $( ".selector" ).dialog( "option", "draggable" );
        -//setter
        -$( ".selector" ).dialog( "option", "draggable", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        height

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        'auto'
        - -
        -
        -
        -

        The height of the dialog, in pixels. Specifying 'auto' is also supported to make the dialog adjust based on its content.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the height option specified. -
        -
        -
        $( ".selector" ).dialog({ height: 530 });
        -
        - - -
        - Get or set the height option, after init. -
        -
        -
        //getter
        -var height = $( ".selector" ).dialog( "option", "height" );
        -//setter
        -$( ".selector" ).dialog( "option", "height", 530 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        hide

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        The effect to be used when the dialog is closed.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the hide option specified. -
        -
        -
        $( ".selector" ).dialog({ hide: 'slide' });
        -
        - - -
        - Get or set the hide option, after init. -
        -
        -
        //getter
        -var hide = $( ".selector" ).dialog( "option", "hide" );
        -//setter
        -$( ".selector" ).dialog( "option", "hide", 'slide' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        maxHeight

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        The maximum height to which the dialog can be resized, in pixels.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the maxHeight option specified. -
        -
        -
        $( ".selector" ).dialog({ maxHeight: 400 });
        -
        - - -
        - Get or set the maxHeight option, after init. -
        -
        -
        //getter
        -var maxHeight = $( ".selector" ).dialog( "option", "maxHeight" );
        -//setter
        -$( ".selector" ).dialog( "option", "maxHeight", 400 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        maxWidth

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        The maximum width to which the dialog can be resized, in pixels.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the maxWidth option specified. -
        -
        -
        $( ".selector" ).dialog({ maxWidth: 600 });
        -
        - - -
        - Get or set the maxWidth option, after init. -
        -
        -
        //getter
        -var maxWidth = $( ".selector" ).dialog( "option", "maxWidth" );
        -//setter
        -$( ".selector" ).dialog( "option", "maxWidth", 600 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minHeight

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        150
        - -
        -
        -
        -

        The minimum height to which the dialog can be resized, in pixels.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the minHeight option specified. -
        -
        -
        $( ".selector" ).dialog({ minHeight: 300 });
        -
        - - -
        - Get or set the minHeight option, after init. -
        -
        -
        //getter
        -var minHeight = $( ".selector" ).dialog( "option", "minHeight" );
        -//setter
        -$( ".selector" ).dialog( "option", "minHeight", 300 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minWidth

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        150
        - -
        -
        -
        -

        The minimum width to which the dialog can be resized, in pixels.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the minWidth option specified. -
        -
        -
        $( ".selector" ).dialog({ minWidth: 400 });
        -
        - - -
        - Get or set the minWidth option, after init. -
        -
        -
        //getter
        -var minWidth = $( ".selector" ).dialog( "option", "minWidth" );
        -//setter
        -$( ".selector" ).dialog( "option", "minWidth", 400 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        modal

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, the dialog will have modal behavior; other items on the page will be disabled (i.e. cannot be interacted with). Modal dialogs create an overlay below the dialog but above other page elements.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the modal option specified. -
        -
        -
        $( ".selector" ).dialog({ modal: true });
        -
        - - -
        - Get or set the modal option, after init. -
        -
        -
        //getter
        -var modal = $( ".selector" ).dialog( "option", "modal" );
        -//setter
        -$( ".selector" ).dialog( "option", "modal", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        position

        -
        -
        Type:
        -
        String, Array
        - -
        Default:
        -
        'center'
        - -
        -
        -
        -

        Specifies where the dialog should be displayed. Possible values:
        1) a single string representing position within viewport: 'center', 'left', 'right', 'top', 'bottom'.
        2) an array containing an x,y coordinate pair in pixel offset from left, top corner of viewport (e.g. [350,100])
        3) an array containing x,y position string values (e.g. ['right','top'] for top right corner).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the position option specified. -
        -
        -
        $( ".selector" ).dialog({ position: 'top' });
        -
        - - -
        - Get or set the position option, after init. -
        -
        -
        //getter
        -var position = $( ".selector" ).dialog( "option", "position" );
        -//setter
        -$( ".selector" ).dialog( "option", "position", 'top' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        resizable

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to true, the dialog will be resizeable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the resizable option specified. -
        -
        -
        $( ".selector" ).dialog({ resizable: false });
        -
        - - -
        - Get or set the resizable option, after init. -
        -
        -
        //getter
        -var resizable = $( ".selector" ).dialog( "option", "resizable" );
        -//setter
        -$( ".selector" ).dialog( "option", "resizable", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        show

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        The effect to be used when the dialog is opened.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the show option specified. -
        -
        -
        $( ".selector" ).dialog({ show: 'slide' });
        -
        - - -
        - Get or set the show option, after init. -
        -
        -
        //getter
        -var show = $( ".selector" ).dialog( "option", "show" );
        -//setter
        -$( ".selector" ).dialog( "option", "show", 'slide' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        stack

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        Specifies whether the dialog will stack on top of other dialogs. This will cause the dialog to move to the front of other dialogs when it gains focus.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the stack option specified. -
        -
        -
        $( ".selector" ).dialog({ stack: false });
        -
        - - -
        - Get or set the stack option, after init. -
        -
        -
        //getter
        -var stack = $( ".selector" ).dialog( "option", "stack" );
        -//setter
        -$( ".selector" ).dialog( "option", "stack", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        title

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        ''
        - -
        -
        -
        -

        Specifies the title of the dialog. Any valid HTML may be set as the title. The title can also be specified by the title attribute on the dialog source element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the title option specified. -
        -
        -
        $( ".selector" ).dialog({ title: 'Dialog Title' });
        -
        - - -
        - Get or set the title option, after init. -
        -
        -
        //getter
        -var title = $( ".selector" ).dialog( "option", "title" );
        -//setter
        -$( ".selector" ).dialog( "option", "title", 'Dialog Title' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        width

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        300
        - -
        -
        -
        -

        The width of the dialog, in pixels.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the width option specified. -
        -
        -
        $( ".selector" ).dialog({ width: 460 });
        -
        - - -
        - Get or set the width option, after init. -
        -
        -
        //getter
        -var width = $( ".selector" ).dialog( "option", "width" );
        -//setter
        -$( ".selector" ).dialog( "option", "width", 460 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        zIndex

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1000
        - -
        -
        -
        -

        The starting z-index for the dialog.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a dialog with the zIndex option specified. -
        -
        -
        $( ".selector" ).dialog({ zIndex: 3999 });
        -
        - - -
        - Get or set the zIndex option, after init. -
        -
        -
        //getter
        -var zIndex = $( ".selector" ).dialog( "option", "zIndex" );
        -//setter
        -$( ".selector" ).dialog( "option", "zIndex", 3999 );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        dialogcreate
        -
        -
        -
        -

        This event is triggered when dialog is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: dialogcreate. -
        -
        -
        $( ".selector" ).bind( "dialogcreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        beforeClose

        -
        -
        Type:
        -
        dialogbeforeclose
        -
        -
        -
        -

        This event is triggered when a dialog attempts to close. If the beforeClose event handler (callback function) returns false, the close will be prevented.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the beforeClose event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   beforeClose: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the beforeClose event by type: dialogbeforeclose. -
        -
        -
        $( ".selector" ).bind( "dialogbeforeclose", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        open

        -
        -
        Type:
        -
        dialogopen
        -
        -
        -
        -

        This event is triggered when dialog is opened.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the open event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   open: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the open event by type: dialogopen. -
        -
        -
        $( ".selector" ).bind( "dialogopen", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        focus

        -
        -
        Type:
        -
        dialogfocus
        -
        -
        -
        -

        This event is triggered when the dialog gains focus.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the focus event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   focus: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the focus event by type: dialogfocus. -
        -
        -
        $( ".selector" ).bind( "dialogfocus", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        dragStart

        -
        -
        Type:
        -
        dialogdragstart
        -
        -
        -
        -

        This event is triggered at the beginning of the dialog being dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the dragStart event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   dragStart: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the dragStart event by type: dialogdragstart. -
        -
        -
        $( ".selector" ).bind( "dialogdragstart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        drag

        -
        -
        Type:
        -
        dialogdrag
        -
        -
        -
        -

        This event is triggered when the dialog is dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the drag event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   drag: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the drag event by type: dialogdrag. -
        -
        -
        $( ".selector" ).bind( "dialogdrag", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        dragStop

        -
        -
        Type:
        -
        dialogdragstop
        -
        -
        -
        -

        This event is triggered after the dialog has been dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the dragStop event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   dragStop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the dragStop event by type: dialogdragstop. -
        -
        -
        $( ".selector" ).bind( "dialogdragstop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        resizeStart

        -
        -
        Type:
        -
        dialogresizestart
        -
        -
        -
        -

        This event is triggered at the beginning of the dialog being resized.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the resizeStart event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   resizeStart: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the resizeStart event by type: dialogresizestart. -
        -
        -
        $( ".selector" ).bind( "dialogresizestart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        resize

        -
        -
        Type:
        -
        dialogresize
        -
        -
        -
        -

        This event is triggered when the dialog is resized. demo

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the resize event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   resize: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the resize event by type: dialogresize. -
        -
        -
        $( ".selector" ).bind( "dialogresize", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        resizeStop

        -
        -
        Type:
        -
        dialogresizestop
        -
        -
        -
        -

        This event is triggered after the dialog has been resized.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the resizeStop event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   resizeStop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the resizeStop event by type: dialogresizestop. -
        -
        -
        $( ".selector" ).bind( "dialogresizestop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        close

        -
        -
        Type:
        -
        dialogclose
        -
        -
        -
        -

        This event is triggered when the dialog is closed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the close event as an init option. -
        -
        -
        $( ".selector" ).dialog({
        -   close: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the close event by type: dialogclose. -
        -
        -
        $( ".selector" ).bind( "dialogclose", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .dialog( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the dialog functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .dialog( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the dialog.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .dialog( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the dialog.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .dialog( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any dialog option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .dialog( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple dialog options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .dialog( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-dialog element.

        -
        -
      • - - -
      • -
        -

        close

        -
        -
        Signature:
        -
        .dialog( "close" - - - - - - - -)
        -
        -
        -
        -

        Close the dialog.

        -
        -
      • - - -
      • -
        -

        isOpen

        -
        -
        Signature:
        -
        .dialog( "isOpen" - - - - - - - -)
        -
        -
        -
        -

        Returns true if the dialog is currently open.

        -
        -
      • - - -
      • -
        -

        moveToTop

        -
        -
        Signature:
        -
        .dialog( "moveToTop" - - - - - - - -)
        -
        -
        -
        -

        Move the dialog to the top of the dialogs stack.

        -
        -
      • - - -
      • -
        -

        open

        -
        -
        Signature:
        -
        .dialog( "open" - - - - - - - -)
        -
        -
        -
        -

        Open the dialog.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Dialog plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.dialog.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable">
      -   <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
      -      <span id="ui-dialog-title-dialog" class="ui-dialog-title">Dialog title</span>
      -      <a class="ui-dialog-titlebar-close ui-corner-all" href="#"><span class="ui-icon ui-icon-closethick">close</span></a>
      -   </div>
      -   <div style="height: 200px; min-height: 109px; width: auto;" class="ui-dialog-content ui-widget-content" id="dialog">
      -      <p>Dialog content goes here.</p>
      -   </div>
      -</div>
      -

      - - Note: This is a sample of markup generated by the dialog plugin, not markup you should use to create a dialog. The only markup needed for that is <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/draggable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/draggable.html deleted file mode 100644 index 4f534b7559..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/draggable.html +++ /dev/null @@ -1,1577 +0,0 @@ - - -
      -

      jQuery UI Draggable

      -
      -

      Overview

      -
      -

      The jQuery UI Draggable plugin makes selected elements draggable by mouse.

      -

      Draggable elements gets a class of ui-draggable. During drag the element also gets a class of ui-draggable-dragging. If you want not just drag, but drag-and-drop, see the jQuery UI Droppable plugin, which provides a drop target for draggables.

      -

      All callbacks (start, stop, drag) receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):

      -
        -
      • ui.helper - the jQuery object representing the helper that's being dragged
      • -
      • ui.position - current position of the helper as { top, left } object, relative to the offset element
      • -
      • ui.offset - current absolute position of the helper as { top, left } object, relative to page
      • -
      -


      -

      -

      To manipulate the position of a draggable during drag, you can either use a wrapper as the draggable helper and position the wrapped element with absolute positioning, or you can correct internal values like so: $(this).data('draggable').offset.click.top -= x.

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Mouse
      • -
      -
      -
      -

      Example

      -
      - -

      -Initialize a draggable with default options.
      -

      -
      $("#draggable").draggable();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <style type="text/css">
      -    #draggable { width: 100px; height: 70px; background: silver; }
      -  </style>
      -  <script>
      -  $(document).ready(function() {
      -    $("#draggable").draggable();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="draggable">Drag me</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the draggable. Can be set when initialising (first creating) the draggable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the disabled option specified. -
        -
        -
        $( ".selector" ).draggable({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).draggable( "option", "disabled" );
        -//setter
        -$( ".selector" ).draggable( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        addClasses

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to false, will prevent the ui-draggable class from being added. This may be desired as a performance optimization when calling .draggable() init on many hundreds of elements.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the addClasses option specified. -
        -
        -
        $( ".selector" ).draggable({ addClasses: false });
        -
        - - -
        - Get or set the addClasses option, after init. -
        -
        -
        //getter
        -var addClasses = $( ".selector" ).draggable( "option", "addClasses" );
        -//setter
        -$( ".selector" ).draggable( "option", "addClasses", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        appendTo

        -
        -
        Type:
        -
        Element, Selector
        - -
        Default:
        -
        'parent'
        - -
        -
        -
        -

        The element passed to or selected by the appendTo option will be used as the draggable helper's container during dragging. By default, the helper is appended to the same container as the draggable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the appendTo option specified. -
        -
        -
        $( ".selector" ).draggable({ appendTo: 'body' });
        -
        - - -
        - Get or set the appendTo option, after init. -
        -
        -
        //getter
        -var appendTo = $( ".selector" ).draggable( "option", "appendTo" );
        -//setter
        -$( ".selector" ).draggable( "option", "appendTo", 'body' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        axis

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Constrains dragging to either the horizontal (x) or vertical (y) axis. Possible values: 'x', 'y'.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the axis option specified. -
        -
        -
        $( ".selector" ).draggable({ axis: 'x' });
        -
        - - -
        - Get or set the axis option, after init. -
        -
        -
        //getter
        -var axis = $( ".selector" ).draggable( "option", "axis" );
        -//setter
        -$( ".selector" ).draggable( "option", "axis", 'x' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cancel

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        ':input,option'
        - -
        -
        -
        -

        Prevents dragging from starting on specified elements.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the cancel option specified. -
        -
        -
        $( ".selector" ).draggable({ cancel: 'button' });
        -
        - - -
        - Get or set the cancel option, after init. -
        -
        -
        //getter
        -var cancel = $( ".selector" ).draggable( "option", "cancel" );
        -//setter
        -$( ".selector" ).draggable( "option", "cancel", 'button' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        connectToSortable

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Allows the draggable to be dropped onto the specified sortables. If this option is used (helper must be set to 'clone' in order to work flawlessly), a draggable can be dropped onto a sortable list and then becomes part of it. -

        Note: Specifying this option as an array of selectors has been removed.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the connectToSortable option specified. -
        -
        -
        $( ".selector" ).draggable({ connectToSortable: 'ul#myList' });
        -
        - - -
        - Get or set the connectToSortable option, after init. -
        -
        -
        //getter
        -var connectToSortable = $( ".selector" ).draggable( "option", "connectToSortable" );
        -//setter
        -$( ".selector" ).draggable( "option", "connectToSortable", 'ul#myList' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        containment

        -
        -
        Type:
        -
        Selector, Element, String, Array
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Constrains dragging to within the bounds of the specified element or region. Possible string values: 'parent', 'document', 'window', [x1, y1, x2, y2].

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the containment option specified. -
        -
        -
        $( ".selector" ).draggable({ containment: 'parent' });
        -
        - - -
        - Get or set the containment option, after init. -
        -
        -
        //getter
        -var containment = $( ".selector" ).draggable( "option", "containment" );
        -//setter
        -$( ".selector" ).draggable( "option", "containment", 'parent' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cursor

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'auto'
        - -
        -
        -
        -

        The css cursor during the drag operation.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the cursor option specified. -
        -
        -
        $( ".selector" ).draggable({ cursor: 'crosshair' });
        -
        - - -
        - Get or set the cursor option, after init. -
        -
        -
        //getter
        -var cursor = $( ".selector" ).draggable( "option", "cursor" );
        -//setter
        -$( ".selector" ).draggable( "option", "cursor", 'crosshair' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cursorAt

        -
        -
        Type:
        -
        Object
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Sets the offset of the dragging helper relative to the mouse cursor. Coordinates can be given as a hash using a combination of one or two keys: { top, left, right, bottom }.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the cursorAt option specified. -
        -
        -
        $( ".selector" ).draggable({ cursorAt: { left: 5 } });
        -
        - - -
        - Get or set the cursorAt option, after init. -
        -
        -
        //getter
        -var cursorAt = $( ".selector" ).draggable( "option", "cursorAt" );
        -//setter
        -$( ".selector" ).draggable( "option", "cursorAt", { left: 5 } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        delay

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Time in milliseconds after mousedown until dragging should start. This option can be used to prevent unwanted drags when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the delay option specified. -
        -
        -
        $( ".selector" ).draggable({ delay: 500 });
        -
        - - -
        - Get or set the delay option, after init. -
        -
        -
        //getter
        -var delay = $( ".selector" ).draggable( "option", "delay" );
        -//setter
        -$( ".selector" ).draggable( "option", "delay", 500 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        distance

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Distance in pixels after mousedown the mouse must move before dragging should start. This option can be used to prevent unwanted drags when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the distance option specified. -
        -
        -
        $( ".selector" ).draggable({ distance: 30 });
        -
        - - -
        - Get or set the distance option, after init. -
        -
        -
        //getter
        -var distance = $( ".selector" ).draggable( "option", "distance" );
        -//setter
        -$( ".selector" ).draggable( "option", "distance", 30 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        grid

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Snaps the dragging helper to a grid, every x and y pixels. Array values: [x, y]

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the grid option specified. -
        -
        -
        $( ".selector" ).draggable({ grid: [50, 20] });
        -
        - - -
        - Get or set the grid option, after init. -
        -
        -
        //getter
        -var grid = $( ".selector" ).draggable( "option", "grid" );
        -//setter
        -$( ".selector" ).draggable( "option", "grid", [50, 20] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        handle

        -
        -
        Type:
        -
        Element, Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If specified, restricts drag start click to the specified element(s).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the handle option specified. -
        -
        -
        $( ".selector" ).draggable({ handle: 'h2' });
        -
        - - -
        - Get or set the handle option, after init. -
        -
        -
        //getter
        -var handle = $( ".selector" ).draggable( "option", "handle" );
        -//setter
        -$( ".selector" ).draggable( "option", "handle", 'h2' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        helper

        -
        -
        Type:
        -
        String, Function
        - -
        Default:
        -
        'original'
        - -
        -
        -
        -

        Allows for a helper element to be used for dragging display. Possible values: 'original', 'clone', Function. If a function is specified, it must return a DOMElement.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the helper option specified. -
        -
        -
        $( ".selector" ).draggable({ helper: 'clone' });
        -
        - - -
        - Get or set the helper option, after init. -
        -
        -
        //getter
        -var helper = $( ".selector" ).draggable( "option", "helper" );
        -//setter
        -$( ".selector" ).draggable( "option", "helper", 'clone' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        iframeFix

        -
        -
        Type:
        -
        Boolean, Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Prevent iframes from capturing the mousemove events during a drag. Useful in combination with cursorAt, or in any case, if the mouse cursor is not over the helper. If set to true, transparent overlays will be placed over all iframes on the page. If a selector is supplied, the matched iframes will have an overlay placed over them.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the iframeFix option specified. -
        -
        -
        $( ".selector" ).draggable({ iframeFix: true });
        -
        - - -
        - Get or set the iframeFix option, after init. -
        -
        -
        //getter
        -var iframeFix = $( ".selector" ).draggable( "option", "iframeFix" );
        -//setter
        -$( ".selector" ).draggable( "option", "iframeFix", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        opacity

        -
        -
        Type:
        -
        Float
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Opacity for the helper while being dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the opacity option specified. -
        -
        -
        $( ".selector" ).draggable({ opacity: 0.35 });
        -
        - - -
        - Get or set the opacity option, after init. -
        -
        -
        //getter
        -var opacity = $( ".selector" ).draggable( "option", "opacity" );
        -//setter
        -$( ".selector" ).draggable( "option", "opacity", 0.35 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        refreshPositions

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, all droppable positions are calculated on every mousemove. Caution: This solves issues on highly dynamic pages, but dramatically decreases performance.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the refreshPositions option specified. -
        -
        -
        $( ".selector" ).draggable({ refreshPositions: true });
        -
        - - -
        - Get or set the refreshPositions option, after init. -
        -
        -
        //getter
        -var refreshPositions = $( ".selector" ).draggable( "option", "refreshPositions" );
        -//setter
        -$( ".selector" ).draggable( "option", "refreshPositions", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        revert

        -
        -
        Type:
        -
        Boolean, String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, the element will return to its start position when dragging stops. Possible string values: 'valid', 'invalid'. If set to invalid, revert will only occur if the draggable has not been dropped on a droppable. For valid, it's the other way around.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the revert option specified. -
        -
        -
        $( ".selector" ).draggable({ revert: true });
        -
        - - -
        - Get or set the revert option, after init. -
        -
        -
        //getter
        -var revert = $( ".selector" ).draggable( "option", "revert" );
        -//setter
        -$( ".selector" ).draggable( "option", "revert", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        revertDuration

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        500
        - -
        -
        -
        -

        The duration of the revert animation, in milliseconds. Ignored if revert is false.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the revertDuration option specified. -
        -
        -
        $( ".selector" ).draggable({ revertDuration: 1000 });
        -
        - - -
        - Get or set the revertDuration option, after init. -
        -
        -
        //getter
        -var revertDuration = $( ".selector" ).draggable( "option", "revertDuration" );
        -//setter
        -$( ".selector" ).draggable( "option", "revertDuration", 1000 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scope

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'default'
        - -
        -
        -
        -

        Used to group sets of draggable and droppable items, in addition to droppable's accept option. A draggable with the same scope value as a droppable will be accepted by the droppable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the scope option specified. -
        -
        -
        $( ".selector" ).draggable({ scope: 'tasks' });
        -
        - - -
        - Get or set the scope option, after init. -
        -
        -
        //getter
        -var scope = $( ".selector" ).draggable( "option", "scope" );
        -//setter
        -$( ".selector" ).draggable( "option", "scope", 'tasks' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scroll

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to true, container auto-scrolls while dragging.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the scroll option specified. -
        -
        -
        $( ".selector" ).draggable({ scroll: false });
        -
        - - -
        - Get or set the scroll option, after init. -
        -
        -
        //getter
        -var scroll = $( ".selector" ).draggable( "option", "scroll" );
        -//setter
        -$( ".selector" ).draggable( "option", "scroll", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scrollSensitivity

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        20
        - -
        -
        -
        -

        Distance in pixels from the edge of the viewport after which the viewport should scroll. Distance is relative to pointer, not the draggable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the scrollSensitivity option specified. -
        -
        -
        $( ".selector" ).draggable({ scrollSensitivity: 40 });
        -
        - - -
        - Get or set the scrollSensitivity option, after init. -
        -
        -
        //getter
        -var scrollSensitivity = $( ".selector" ).draggable( "option", "scrollSensitivity" );
        -//setter
        -$( ".selector" ).draggable( "option", "scrollSensitivity", 40 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scrollSpeed

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        20
        - -
        -
        -
        -

        The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the scrollSpeed option specified. -
        -
        -
        $( ".selector" ).draggable({ scrollSpeed: 40 });
        -
        - - -
        - Get or set the scrollSpeed option, after init. -
        -
        -
        //getter
        -var scrollSpeed = $( ".selector" ).draggable( "option", "scrollSpeed" );
        -//setter
        -$( ".selector" ).draggable( "option", "scrollSpeed", 40 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        snap

        -
        -
        Type:
        -
        Boolean, Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to a selector or to true (equivalent to '.ui-draggable'), the draggable will snap to the edges of the selected elements when near an edge of the element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the snap option specified. -
        -
        -
        $( ".selector" ).draggable({ snap: true });
        -
        - - -
        - Get or set the snap option, after init. -
        -
        -
        //getter
        -var snap = $( ".selector" ).draggable( "option", "snap" );
        -//setter
        -$( ".selector" ).draggable( "option", "snap", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        snapMode

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'both'
        - -
        -
        -
        -

        Determines which edges of snap elements the draggable will snap to. Ignored if snap is false. Possible values: 'inner', 'outer', 'both'

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the snapMode option specified. -
        -
        -
        $( ".selector" ).draggable({ snapMode: 'outer' });
        -
        - - -
        - Get or set the snapMode option, after init. -
        -
        -
        //getter
        -var snapMode = $( ".selector" ).draggable( "option", "snapMode" );
        -//setter
        -$( ".selector" ).draggable( "option", "snapMode", 'outer' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        snapTolerance

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        20
        - -
        -
        -
        -

        The distance in pixels from the snap element edges at which snapping should occur. Ignored if snap is false.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the snapTolerance option specified. -
        -
        -
        $( ".selector" ).draggable({ snapTolerance: 40 });
        -
        - - -
        - Get or set the snapTolerance option, after init. -
        -
        -
        //getter
        -var snapTolerance = $( ".selector" ).draggable( "option", "snapTolerance" );
        -//setter
        -$( ".selector" ).draggable( "option", "snapTolerance", 40 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        stack

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Controls the z-Index of the set of elements that match the selector, always brings to front the dragged item. Very useful in things like window managers.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the stack option specified. -
        -
        -
        $( ".selector" ).draggable({ stack: ".products" });
        -
        - - -
        - Get or set the stack option, after init. -
        -
        -
        //getter
        -var stack = $( ".selector" ).draggable( "option", "stack" );
        -//setter
        -$( ".selector" ).draggable( "option", "stack", ".products" );
        -
        - -
        -
        -
      • - - -
      • -
        -

        zIndex

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        z-index for the helper while being dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a draggable with the zIndex option specified. -
        -
        -
        $( ".selector" ).draggable({ zIndex: 2700 });
        -
        - - -
        - Get or set the zIndex option, after init. -
        -
        -
        //getter
        -var zIndex = $( ".selector" ).draggable( "option", "zIndex" );
        -//setter
        -$( ".selector" ).draggable( "option", "zIndex", 2700 );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        dragcreate
        -
        -
        -
        -

        This event is triggered when draggable is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).draggable({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: dragcreate. -
        -
        -
        $( ".selector" ).bind( "dragcreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        start

        -
        -
        Type:
        -
        dragstart
        -
        -
        -
        -

        This event is triggered when dragging starts.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the start event as an init option. -
        -
        -
        $( ".selector" ).draggable({
        -   start: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the start event by type: dragstart. -
        -
        -
        $( ".selector" ).bind( "dragstart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        drag

        -
        -
        Type:
        -
        drag
        -
        -
        -
        -

        This event is triggered when the mouse is moved during the dragging.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the drag event as an init option. -
        -
        -
        $( ".selector" ).draggable({
        -   drag: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the drag event by type: drag. -
        -
        -
        $( ".selector" ).bind( "drag", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        stop

        -
        -
        Type:
        -
        dragstop
        -
        -
        -
        -

        This event is triggered when dragging stops.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the stop event as an init option. -
        -
        -
        $( ".selector" ).draggable({
        -   stop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the stop event by type: dragstop. -
        -
        -
        $( ".selector" ).bind( "dragstop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .draggable( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the draggable functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .draggable( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the draggable.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .draggable( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the draggable.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .draggable( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any draggable option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .draggable( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple draggable options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .draggable( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-draggable element.

        -
        -
      • - - -
      -
      -
      -

      Theming

      -

      The jQuery UI Draggable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.draggable.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-draggable"></div> -

      - - Note: This is a sample of markup generated by the draggable plugin, not markup you should use to create a draggable. The only markup needed for that is <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/droppable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/droppable.html deleted file mode 100644 index 2ee68e654a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/droppable.html +++ /dev/null @@ -1,829 +0,0 @@ - - -
      -

      jQuery UI Droppable

      -
      -

      Overview

      -
      -

      The jQuery UI Droppable plugin makes selected elements droppable (meaning they accept being dropped on by draggables). You can specify which (individually) or which kind of draggables each will accept.

      -

      All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):

      -
        -
      • ui.draggable - current draggable element, a jQuery object.
      • -
      • ui.helper - current draggable helper, a jQuery object
      • -
      • ui.position - current position of the draggable helper { top: , left: }
      • -
      • ui.offset - current absolute position of the draggable helper { top: , left: }
      • -
      -
      -
      -

      Dependencies

      - -
      -
      -

      Example

      -
      - -

      -Makes the div droppable (a drop target for a draggable).
      -

      -
      $("#draggable").draggable();
      -    $("#droppable").droppable({
      -      drop: function() { alert('dropped'); }
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <style type="text/css">
      -    #draggable { width: 75px; height: 25px; background: silver; padding: 10px; }
      -    #droppable { position: absolute; left: 250px; top: 0; width: 125px; height: 75px; background: gray; color: white; padding: 10px; }
      -  </style>
      -  <script>
      -  $(document).ready(function() {
      -    $("#draggable").draggable();
      -    $("#droppable").droppable({
      -      drop: function() { alert('dropped'); }
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="droppable">Drop here</div>
      -<div id="draggable">Drag me</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the droppable. Can be set when initialising (first creating) the droppable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the disabled option specified. -
        -
        -
        $( ".selector" ).droppable({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).droppable( "option", "disabled" );
        -//setter
        -$( ".selector" ).droppable( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        accept

        -
        -
        Type:
        -
        Selector, Function
        - -
        Default:
        -
        '*'
        - -
        -
        -
        -

        All draggables that match the selector will be accepted. If a function is specified, the function will be called for each draggable on the page (passed as the first argument to the function), to provide a custom filter. The function should return true if the draggable should be accepted.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the accept option specified. -
        -
        -
        $( ".selector" ).droppable({ accept: '.special' });
        -
        - - -
        - Get or set the accept option, after init. -
        -
        -
        //getter
        -var accept = $( ".selector" ).droppable( "option", "accept" );
        -//setter
        -$( ".selector" ).droppable( "option", "accept", '.special' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        activeClass

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If specified, the class will be added to the droppable while an acceptable draggable is being dragged.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the activeClass option specified. -
        -
        -
        $( ".selector" ).droppable({ activeClass: 'ui-state-highlight' });
        -
        - - -
        - Get or set the activeClass option, after init. -
        -
        -
        //getter
        -var activeClass = $( ".selector" ).droppable( "option", "activeClass" );
        -//setter
        -$( ".selector" ).droppable( "option", "activeClass", 'ui-state-highlight' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        addClasses

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to false, will prevent the ui-droppable class from being added. This may be desired as a performance optimization when calling .droppable() init on many hundreds of elements.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the addClasses option specified. -
        -
        -
        $( ".selector" ).droppable({ addClasses: false });
        -
        - - -
        - Get or set the addClasses option, after init. -
        -
        -
        //getter
        -var addClasses = $( ".selector" ).droppable( "option", "addClasses" );
        -//setter
        -$( ".selector" ).droppable( "option", "addClasses", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        greedy

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If true, will prevent event propagation on nested droppables.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the greedy option specified. -
        -
        -
        $( ".selector" ).droppable({ greedy: true });
        -
        - - -
        - Get or set the greedy option, after init. -
        -
        -
        //getter
        -var greedy = $( ".selector" ).droppable( "option", "greedy" );
        -//setter
        -$( ".selector" ).droppable( "option", "greedy", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        hoverClass

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If specified, the class will be added to the droppable while an acceptable draggable is being hovered.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the hoverClass option specified. -
        -
        -
        $( ".selector" ).droppable({ hoverClass: 'drophover' });
        -
        - - -
        - Get or set the hoverClass option, after init. -
        -
        -
        //getter
        -var hoverClass = $( ".selector" ).droppable( "option", "hoverClass" );
        -//setter
        -$( ".selector" ).droppable( "option", "hoverClass", 'drophover' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scope

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'default'
        - -
        -
        -
        -

        Used to group sets of draggable and droppable items, in addition to droppable's accept option. A draggable with the same scope value as a droppable will be accepted.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the scope option specified. -
        -
        -
        $( ".selector" ).droppable({ scope: 'tasks' });
        -
        - - -
        - Get or set the scope option, after init. -
        -
        -
        //getter
        -var scope = $( ".selector" ).droppable( "option", "scope" );
        -//setter
        -$( ".selector" ).droppable( "option", "scope", 'tasks' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        tolerance

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'intersect'
        - -
        -
        -
        -

        Specifies which mode to use for testing whether a draggable is 'over' a droppable. Possible values: 'fit', 'intersect', 'pointer', 'touch'. -

        -
          -
        • fit: draggable overlaps the droppable entirely
        • -
        • intersect: draggable overlaps the droppable at least 50%
        • -
        • pointer: mouse pointer overlaps the droppable
        • -
        • touch: draggable overlaps the droppable any amount
        • -
        -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a droppable with the tolerance option specified. -
        -
        -
        $( ".selector" ).droppable({ tolerance: 'fit' });
        -
        - - -
        - Get or set the tolerance option, after init. -
        -
        -
        //getter
        -var tolerance = $( ".selector" ).droppable( "option", "tolerance" );
        -//setter
        -$( ".selector" ).droppable( "option", "tolerance", 'fit' );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        dropcreate
        -
        -
        -
        -

        This event is triggered when droppable is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: dropcreate. -
        -
        -
        $( ".selector" ).bind( "dropcreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        activate

        -
        -
        Type:
        -
        dropactivate
        -
        -
        -
        -

        This event is triggered any time an accepted draggable starts dragging. This can be useful if you want to make the droppable 'light up' when it can be dropped on.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the activate event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   activate: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the activate event by type: dropactivate. -
        -
        -
        $( ".selector" ).bind( "dropactivate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        deactivate

        -
        -
        Type:
        -
        dropdeactivate
        -
        -
        -
        -

        This event is triggered any time an accepted draggable stops dragging.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the deactivate event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   deactivate: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the deactivate event by type: dropdeactivate. -
        -
        -
        $( ".selector" ).bind( "dropdeactivate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        over

        -
        -
        Type:
        -
        dropover
        -
        -
        -
        -

        This event is triggered as an accepted draggable is dragged 'over' (within the tolerance of) this droppable.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the over event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   over: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the over event by type: dropover. -
        -
        -
        $( ".selector" ).bind( "dropover", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        out

        -
        -
        Type:
        -
        dropout
        -
        -
        -
        -

        This event is triggered when an accepted draggable is dragged out (within the tolerance of) this droppable.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the out event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   out: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the out event by type: dropout. -
        -
        -
        $( ".selector" ).bind( "dropout", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        drop

        -
        -
        Type:
        -
        drop
        -
        -
        -
        -

        This event is triggered when an accepted draggable is dropped 'over' (within the tolerance of) this droppable. In the callback, $(this) represents the droppable the draggable is dropped on. -ui.draggable represents the draggable.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the drop event as an init option. -
        -
        -
        $( ".selector" ).droppable({
        -   drop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the drop event by type: drop. -
        -
        -
        $( ".selector" ).bind( "drop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .droppable( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the droppable functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .droppable( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the droppable.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .droppable( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the droppable.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .droppable( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any droppable option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .droppable( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple droppable options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .droppable( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-droppable element.

        -
        -
      • - - -
      -
      -
      -

      Theming

      -

      The jQuery UI Droppable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.droppable.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-droppable"></div> -

      - - Note: This is a sample of markup generated by the droppable plugin, not markup you should use to create a droppable. The only markup needed for that is <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/effect.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/effect.html deleted file mode 100644 index 9826900258..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/effect.html +++ /dev/null @@ -1,143 +0,0 @@ - - -
      -

      jQuery UI effect

      -
      -

      Overview

      -
      -

      effect( effect, [options], [speed], [callback] )

      -

      Uses a specific effect on an element (without the show/hide logic).

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Apply the effect explode if you click on the element.
      -

      -
      $("p").click(function () {
      -      $("div").effect("explode");
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<script src="http://ui.jquery.com/latest/ui/effects.explode.js"></script>
      -<style type="text/css">
      -  div { margin: 0 auto; width: 100px; height: 80px; background: blue; position: relative; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $("div").effect("explode");
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p>Click me</p><div></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        effect

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The effect to be used. Possible values: 'blind', 'bounce', 'clip', 'drop', 'explode', 'fold', 'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide', 'transfer'.

        -
        -
      • - - -
      • -
        -

        options

        -
        -
        Type:
        -
        Hash
        - -
        Optional
        - -
        -
        -
        -

        A object/hash including specific options for the effect.

        -
        -
      • - - -
      • -
        -

        speed

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - - -
      • -
        -

        callback

        -
        -
        Type:
        -
        Function
        - -
        Optional
        - -
        -
        -
        -

        A function that is called after the effect is completed.

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/hide.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/hide.html deleted file mode 100644 index 1ad4a50851..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/hide.html +++ /dev/null @@ -1,144 +0,0 @@ - - -
      -

      jQuery UI hide

      -
      -

      Overview

      -
      -

      hide( effect, [options], [speed], [callback] )

      -

      The enhanced hide method optionally accepts jQuery UI advanced effects.

      -

      Uses a specific effect on an element to hide the element if the first argument is an effect string.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Apply the effect slide if you click on the p to hide a div.
      -

      -
      $("p").click(function () {
      -      $("div").hide("slide", {}, 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<script src="http://ui.jquery.com/latest/ui/effects.slide.js"></script>
      -<style type="text/css">
      -  div { margin: 0px; width: 100px; height: 80px; background: blue; position: relative; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $("div").hide("slide", {}, 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p>Click me</p><div></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        effect

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.

        -
        -
      • - - -
      • -
        -

        options

        -
        -
        Type:
        -
        Hash
        - -
        Optional
        - -
        -
        -
        -

        A object/hash including specific options for the effect.

        -
        -
      • - - -
      • -
        -

        speed

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the predefined speeds ("slow" or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - - -
      • -
        -

        callback

        -
        -
        Type:
        -
        Function
        - -
        Optional
        - -
        -
        -
        -

        A function that is called after the effect is completed.

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/position.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/position.html deleted file mode 100644 index 8d9f04cf53..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/position.html +++ /dev/null @@ -1,227 +0,0 @@ - - -
      -

      jQuery UI Position Utility

      -
      -

      Overview

      -
      -

      Utility script for positioning any widget relative to the window, document, a particular element, or the cursor/mouse.

      -

      Note: jQuery UI does not support positioning hidden elements.

      -

      Does not need ui.core.js or effects.core.js.

      -
      -
      -

      Dependencies

      -
        -
      • none (only jQuery core)
      • -
      -
      -
      -

      Example

      -
      - -

      -Clicking on the green element transfers to the other.
      -

      -
      -$("#position1").position({
      -  my: "center",
      -  at: "center",
      -  of: "#targetElement"
      -});
      -$("#position2").position({
      -  my: "left top",
      -  at: "left top",
      -  of: "#targetElement"
      -});
      -$("#position3").position({
      -  my: "right center",
      -  at: "right bottom",
      -  of: "#targetElement"
      -});
      -$(document).mousemove(function(ev){
      -  $("#position4").position({
      -    my: "left bottom",
      -    of: ev,
      -    offset: "3 -3",
      -    collision: "fit"
      -  });
      -});
      -
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <style type="text/css">
      -#targetElement { width:240px;height:200px;background-color:#999;margin:30px auto; }
      -.positionDiv { width:50px;height:50px;opacity:0.6; }
      -#position1 {background-color:#F00;}
      -#position2 {background-color:#0F0;}
      -#position3 {background-color:#00F;}
      -#position4 {background-color:#FF0;}
      -</style>
      -
      -  <script>
      -  $(document).ready(function() {
      -    
      -$("#position1").position({
      -  my: "center",
      -  at: "center",
      -  of: "#targetElement"
      -});
      -$("#position2").position({
      -  my: "left top",
      -  at: "left top",
      -  of: "#targetElement"
      -});
      -$("#position3").position({
      -  my: "right center",
      -  at: "right bottom",
      -  of: "#targetElement"
      -});
      -$(document).mousemove(function(ev){
      -  $("#position4").position({
      -    my: "left bottom",
      -    of: ev,
      -    offset: "3 -3",
      -    collision: "fit"
      -  });
      -});
      -
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="targetElement">
      -  <div class="positionDiv" id="position1"></div>
      -  <div class="positionDiv" id="position2"></div>
      -  <div class="positionDiv" id="position3"></div>
      -  <div class="positionDiv" id="position4"></div>
      -</div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        my

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        Defines which position on the element being positioned to align with the target element: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center"

        -
        -
      • - - -
      • -
        -

        at

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        Defines which position on the target element to align the positioned element against: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center"

        -
        -
      • - - -
      • -
        -

        of

        -
        -
        Type:
        -
        Selector, Element, jQuery, Event
        - -
        -
        -
        -

        Element to position against. If you provide a selector, the first matching element will be used. If you provide a jQuery object, the first element will be used. If you provide an event object, the pageX and pageY properties will be used. Example: "#top-menu"

        -
        -
      • - - -
      • -
        -

        offset

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        Add these left-top values to the calculated position, eg. "50 50" (left top) A single value such as "50" will apply to both.

        -
        -
      • - - -
      • -
        -

        collision

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        When the positioned element overflows the window in some direction, move it to an alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical, eg. "flip", "fit", "fit flip", "fit none". -

        -
        • flip: to the opposite side and the collision detection is run again to see if it will fit. If it won't fit in either position, the center option should be used as a fall back. -
        • fit: so the element keeps in the desired direction, but is re-positioned so it fits. -
        • none: not do collision detection. -
        -

        -
        -
      • - - -
      • -
        -

        using

        -
        -
        Type:
        -
        Function
        - -
        -
        -
        -

        When specified the actual property setting is delegated to this callback. Receives a single parameter which is a hash of top and left values for the position that should be set.

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/progressbar.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/progressbar.html deleted file mode 100644 index fe2a30a4ed..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/progressbar.html +++ /dev/null @@ -1,460 +0,0 @@ - - -
      -

      jQuery UI Progressbar

      -
      -

      Overview

      -
      -

      -The progress bar is designed to simply display the current % complete for a process. The bar is coded to be flexibly sized through CSS and will scale to fit inside it's parent container by default. -

      -

      -This is a determinate progress bar, meaning that it should only be used in situations where the system can accurately update the current status complete. A determinate progress bar should never fill from left to right, then loop back to empty for a single process -- if the actual percent complete status cannot be calculated, an indeterminate progress bar (coming soon) or spinner animation is a better way to provide user feedback. -

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Progressbar.
      -

      -
      $("#progressbar").progressbar({ value: 37 });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#progressbar").progressbar({ value: 37 });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="progressbar"></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the progressbar. Can be set when initialising (first creating) the progressbar.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a progressbar with the disabled option specified. -
        -
        -
        $( ".selector" ).progressbar({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).progressbar( "option", "disabled" );
        -//setter
        -$( ".selector" ).progressbar( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        value

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        The value of the progressbar.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a progressbar with the value option specified. -
        -
        -
        $( ".selector" ).progressbar({ value: 37 });
        -
        - - -
        - Get or set the value option, after init. -
        -
        -
        //getter
        -var value = $( ".selector" ).progressbar( "option", "value" );
        -//setter
        -$( ".selector" ).progressbar( "option", "value", 37 );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        progressbarcreate
        -
        -
        -
        -

        This event is triggered when progressbar is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).progressbar({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: progressbarcreate. -
        -
        -
        $( ".selector" ).bind( "progressbarcreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        change

        -
        -
        Type:
        -
        progressbarchange
        -
        -
        -
        -

        This event is triggered when the value of the progressbar changes.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the change event as an init option. -
        -
        -
        $( ".selector" ).progressbar({
        -   change: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the change event by type: progressbarchange. -
        -
        -
        $( ".selector" ).bind( "progressbarchange", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        complete

        -
        -
        Type:
        -
        progressbarcomplete
        -
        -
        -
        -

        This event is triggered when the value of the progressbar reaches the maximum value of 100.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the complete event as an init option. -
        -
        -
        $( ".selector" ).progressbar({
        -   complete: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the complete event by type: progressbarcomplete. -
        -
        -
        $( ".selector" ).bind( "progressbarcomplete", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .progressbar( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the progressbar functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .progressbar( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the progressbar.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .progressbar( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the progressbar.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .progressbar( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any progressbar option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .progressbar( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple progressbar options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .progressbar( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-progressbar element.

        -
        -
      • - - -
      • -
        -

        value

        -
        -
        Signature:
        -
        .progressbar( "value" - -, [value] - - - - - -)
        -
        -
        -
        -

        This method gets or sets the current value of the progressbar.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Progressbar plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.progressbar.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-progressbar ui-widget ui-widget-content ui-corner-all">
      -    <div style="width: 37%;" class="ui-progressbar-value ui-widget-header ui-corner-left"></div>
      - </div> -

      - - Note: This is a sample of markup generated by the progressbar plugin, not markup you should use to create a progressbar. The only markup needed for that is <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/removeClass.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/removeClass.html deleted file mode 100644 index cde94f1073..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/removeClass.html +++ /dev/null @@ -1,113 +0,0 @@ - - -
      -

      jQuery UI removeClass

      -
      -

      Overview

      -
      -

      removeClass( [class], [duration] )

      -

      Removes all or specified class from each of the set of matched elements with an optional transition between the states.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Removes the class 'selected' from the matched elements with a one second transition.
      -

      -
      $("p").click(function () {
      -      $(this).removeClass("selected", 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<style type="text/css">
      -  p { cursor: pointer; font-size: 1.2em; }
      -  .selected { color:red; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $(this).removeClass("selected", 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p class="selected">Click me to remove 'selected' class.</p>
      -<p class="selected">Click me to remove 'selected' class.</p>
      -<p class="selected">Click me to remove 'selected' class.</p>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        class

        -
        -
        Type:
        -
        String
        - -
        Optional
        - -
        -
        -
        -

        CSS classes to remove from the elements.

        -
        -
      • - - -
      • -
        -

        duration

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/resizable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/resizable.html deleted file mode 100644 index 1b0385e2d7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/resizable.html +++ /dev/null @@ -1,1201 +0,0 @@ - - -
      -

      jQuery UI Resizable

      -
      -

      Overview

      -
      -

      The jQuery UI Resizable plugin makes selected elements resizable (meaning they have draggable resize handles). You can specify one or more handles as well as min and max width and height.

      -

      All callbacks (start,stop,resize) receive two arguments: The original browser event and a prepared ui object. The ui object has the following fields:

      -
        -
      • ui.helper - a jQuery object containing the helper element
      • -
      • ui.originalPosition - {top, left} before resizing started
      • -
      • ui.originalSize - {width, height} before resizing started
      • -
      • ui.position - {top, left} current position
      • -
      • ui.size - {width, height} current size
      • -
      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Mouse
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Resizable.
      -

      -
      $("#resizable").resizable();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <style type="text/css">
      -    #resizable { width: 100px; height: 100px; background: silver; }
      -  </style>
      -  <script>
      -  $(document).ready(function() {
      -    $("#resizable").resizable();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="resizable"></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the resizable. Can be set when initialising (first creating) the resizable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the disabled option specified. -
        -
        -
        $( ".selector" ).resizable({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).resizable( "option", "disabled" );
        -//setter
        -$( ".selector" ).resizable( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        alsoResize

        -
        -
        Type:
        -
        Selector, jQuery, Element
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Resize these elements synchronous when resizing.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the alsoResize option specified. -
        -
        -
        $( ".selector" ).resizable({ alsoResize: '.other' });
        -
        - - -
        - Get or set the alsoResize option, after init. -
        -
        -
        //getter
        -var alsoResize = $( ".selector" ).resizable( "option", "alsoResize" );
        -//setter
        -$( ".selector" ).resizable( "option", "alsoResize", '.other' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        animate

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Animates to the final size after resizing.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the animate option specified. -
        -
        -
        $( ".selector" ).resizable({ animate: true });
        -
        - - -
        - Get or set the animate option, after init. -
        -
        -
        //getter
        -var animate = $( ".selector" ).resizable( "option", "animate" );
        -//setter
        -$( ".selector" ).resizable( "option", "animate", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        animateDuration

        -
        -
        Type:
        -
        Integer, String
        - -
        Default:
        -
        'slow'
        - -
        -
        -
        -

        Duration time for animating, in milliseconds. Other possible values: 'slow', 'normal', 'fast'.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the animateDuration option specified. -
        -
        -
        $( ".selector" ).resizable({ animateDuration: 500 });
        -
        - - -
        - Get or set the animateDuration option, after init. -
        -
        -
        //getter
        -var animateDuration = $( ".selector" ).resizable( "option", "animateDuration" );
        -//setter
        -$( ".selector" ).resizable( "option", "animateDuration", 500 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        animateEasing

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'swing'
        - -
        -
        -
        -

        Easing effect for animating.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the animateEasing option specified. -
        -
        -
        $( ".selector" ).resizable({ animateEasing: 'swing' });
        -
        - - -
        - Get or set the animateEasing option, after init. -
        -
        -
        //getter
        -var animateEasing = $( ".selector" ).resizable( "option", "animateEasing" );
        -//setter
        -$( ".selector" ).resizable( "option", "animateEasing", 'swing' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        aspectRatio

        -
        -
        Type:
        -
        Boolean, Float
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, resizing is constrained by the original aspect ratio. Otherwise a custom aspect ratio can be specified, such as 9 / 16, or 0.5.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the aspectRatio option specified. -
        -
        -
        $( ".selector" ).resizable({ aspectRatio: .75 });
        -
        - - -
        - Get or set the aspectRatio option, after init. -
        -
        -
        //getter
        -var aspectRatio = $( ".selector" ).resizable( "option", "aspectRatio" );
        -//setter
        -$( ".selector" ).resizable( "option", "aspectRatio", .75 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoHide

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, automatically hides the handles except when the mouse hovers over the element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the autoHide option specified. -
        -
        -
        $( ".selector" ).resizable({ autoHide: true });
        -
        - - -
        - Get or set the autoHide option, after init. -
        -
        -
        //getter
        -var autoHide = $( ".selector" ).resizable( "option", "autoHide" );
        -//setter
        -$( ".selector" ).resizable( "option", "autoHide", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cancel

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        ':input,option'
        - -
        -
        -
        -

        Prevents resizing if you start on elements matching the selector.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the cancel option specified. -
        -
        -
        $( ".selector" ).resizable({ cancel: ':input,option' });
        -
        - - -
        - Get or set the cancel option, after init. -
        -
        -
        //getter
        -var cancel = $( ".selector" ).resizable( "option", "cancel" );
        -//setter
        -$( ".selector" ).resizable( "option", "cancel", ':input,option' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        containment

        -
        -
        Type:
        -
        String, Element, Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Constrains resizing to within the bounds of the specified element. Possible values: 'parent', 'document', a DOMElement, or a Selector.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the containment option specified. -
        -
        -
        $( ".selector" ).resizable({ containment: 'parent' });
        -
        - - -
        - Get or set the containment option, after init. -
        -
        -
        //getter
        -var containment = $( ".selector" ).resizable( "option", "containment" );
        -//setter
        -$( ".selector" ).resizable( "option", "containment", 'parent' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        delay

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Tolerance, in milliseconds, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond duration. This can help prevent unintended resizing when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the delay option specified. -
        -
        -
        $( ".selector" ).resizable({ delay: 20 });
        -
        - - -
        - Get or set the delay option, after init. -
        -
        -
        //getter
        -var delay = $( ".selector" ).resizable( "option", "delay" );
        -//setter
        -$( ".selector" ).resizable( "option", "delay", 20 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        distance

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Tolerance, in pixels, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond distance. This can help prevent unintended resizing when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the distance option specified. -
        -
        -
        $( ".selector" ).resizable({ distance: 20 });
        -
        - - -
        - Get or set the distance option, after init. -
        -
        -
        //getter
        -var distance = $( ".selector" ).resizable( "option", "distance" );
        -//setter
        -$( ".selector" ).resizable( "option", "distance", 20 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        ghost

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, a semi-transparent helper element is shown for resizing.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the ghost option specified. -
        -
        -
        $( ".selector" ).resizable({ ghost: true });
        -
        - - -
        - Get or set the ghost option, after init. -
        -
        -
        //getter
        -var ghost = $( ".selector" ).resizable( "option", "ghost" );
        -//setter
        -$( ".selector" ).resizable( "option", "ghost", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        grid

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Snaps the resizing element to a grid, every x and y pixels. Array values: [x, y]

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the grid option specified. -
        -
        -
        $( ".selector" ).resizable({ grid: [50, 50] });
        -
        - - -
        - Get or set the grid option, after init. -
        -
        -
        //getter
        -var grid = $( ".selector" ).resizable( "option", "grid" );
        -//setter
        -$( ".selector" ).resizable( "option", "grid", [50, 50] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        handles

        -
        -
        Type:
        -
        String, Object
        - -
        Default:
        -
        'e, s, se'
        - -
        -
        -
        -

        If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'. The necessary handles will be auto-generated by the plugin. -

        If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }. The value of any specified should be a jQuery selector matching the child element of the resizable to use as that handle. If the handle is not a child of the resizable, you can pass in the DOMElement or a valid jQuery object directly.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the handles option specified. -
        -
        -
        $( ".selector" ).resizable({ handles: 'n, e, s, w' });
        -
        - - -
        - Get or set the handles option, after init. -
        -
        -
        //getter
        -var handles = $( ".selector" ).resizable( "option", "handles" );
        -//setter
        -$( ".selector" ).resizable( "option", "handles", 'n, e, s, w' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        helper

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        This is the css class that will be added to a proxy element to outline the resize during the drag of the resize handle. Once the resize is complete, the original element is sized.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the helper option specified. -
        -
        -
        $( ".selector" ).resizable({ helper: 'ui-state-highlight' });
        -
        - - -
        - Get or set the helper option, after init. -
        -
        -
        //getter
        -var helper = $( ".selector" ).resizable( "option", "helper" );
        -//setter
        -$( ".selector" ).resizable( "option", "helper", 'ui-state-highlight' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        maxHeight

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        This is the maximum height the resizable should be allowed to resize to.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the maxHeight option specified. -
        -
        -
        $( ".selector" ).resizable({ maxHeight: 300 });
        -
        - - -
        - Get or set the maxHeight option, after init. -
        -
        -
        //getter
        -var maxHeight = $( ".selector" ).resizable( "option", "maxHeight" );
        -//setter
        -$( ".selector" ).resizable( "option", "maxHeight", 300 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        maxWidth

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        This is the maximum width the resizable should be allowed to resize to.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the maxWidth option specified. -
        -
        -
        $( ".selector" ).resizable({ maxWidth: 250 });
        -
        - - -
        - Get or set the maxWidth option, after init. -
        -
        -
        //getter
        -var maxWidth = $( ".selector" ).resizable( "option", "maxWidth" );
        -//setter
        -$( ".selector" ).resizable( "option", "maxWidth", 250 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minHeight

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        10
        - -
        -
        -
        -

        This is the minimum height the resizable should be allowed to resize to.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the minHeight option specified. -
        -
        -
        $( ".selector" ).resizable({ minHeight: 150 });
        -
        - - -
        - Get or set the minHeight option, after init. -
        -
        -
        //getter
        -var minHeight = $( ".selector" ).resizable( "option", "minHeight" );
        -//setter
        -$( ".selector" ).resizable( "option", "minHeight", 150 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        minWidth

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        10
        - -
        -
        -
        -

        This is the minimum width the resizable should be allowed to resize to.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a resizable with the minWidth option specified. -
        -
        -
        $( ".selector" ).resizable({ minWidth: 75 });
        -
        - - -
        - Get or set the minWidth option, after init. -
        -
        -
        //getter
        -var minWidth = $( ".selector" ).resizable( "option", "minWidth" );
        -//setter
        -$( ".selector" ).resizable( "option", "minWidth", 75 );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        resizecreate
        -
        -
        -
        -

        This event is triggered when resizable is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).resizable({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: resizecreate. -
        -
        -
        $( ".selector" ).bind( "resizecreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        start

        -
        -
        Type:
        -
        resizestart
        -
        -
        -
        -

        This event is triggered at the start of a resize operation.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the start event as an init option. -
        -
        -
        $( ".selector" ).resizable({
        -   start: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the start event by type: resizestart. -
        -
        -
        $( ".selector" ).bind( "resizestart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        resize

        -
        -
        Type:
        -
        resize
        -
        -
        -
        -

        This event is triggered during the resize, on the drag of the resize handler.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the resize event as an init option. -
        -
        -
        $( ".selector" ).resizable({
        -   resize: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the resize event by type: resize. -
        -
        -
        $( ".selector" ).bind( "resize", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        stop

        -
        -
        Type:
        -
        resizestop
        -
        -
        -
        -

        This event is triggered at the end of a resize operation.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the stop event as an init option. -
        -
        -
        $( ".selector" ).resizable({
        -   stop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the stop event by type: resizestop. -
        -
        -
        $( ".selector" ).bind( "resizestop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .resizable( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the resizable functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .resizable( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the resizable.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .resizable( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the resizable.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .resizable( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any resizable option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .resizable( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple resizable options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .resizable( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-resizable element.

        -
        -
      • - - -
      -
      -
      -

      Theming

      -

      The jQuery UI Resizable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.resizable.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-resizable">
      -   <div style="-moz-user-select: none;" unselectable="on" class="ui-resizable-handle ui-resizable-e"></div>
      -   <div style="-moz-user-select: none;" unselectable="on" class="ui-resizable-handle ui-resizable-s"></div>
      -   <div unselectable="on" style="z-index: 1001; -moz-user-select: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div>
      -</div> -

      - - Note: This is a sample of markup generated by the resizable plugin, not markup you should use to create a resizable. The only markup needed for that is <div></div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/selectable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/selectable.html deleted file mode 100644 index 1b4bcaba4c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/selectable.html +++ /dev/null @@ -1,848 +0,0 @@ - - -
      -

      jQuery UI Selectable

      -
      -

      Overview

      -
      -

      The jQuery UI Selectable plugin allows for elements to be selected by dragging a box (sometimes called a lasso) with the mouse over the elements. Also, elements can be selected by click or drag while holding the Ctrl/Meta key, allowing for multiple (non-contiguous) selections.

      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Mouse
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Selectable.
      -

      -
      $("#selectable").selectable();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <style type="text/css">
      -#selectable .ui-selecting {
      -	background: silver;
      -}
      -#selectable .ui-selected {
      -	background: gray;
      -}
      -</style>
      -
      -  <script>
      -  $(document).ready(function() {
      -    $("#selectable").selectable();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<ul id="selectable">
      -<li>Item 1</li>
      -<li>Item 2</li>
      -<li>Item 3</li>
      -<li>Item 4</li>
      -<li>Item 5</li>
      -</ul>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the selectable. Can be set when initialising (first creating) the selectable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the disabled option specified. -
        -
        -
        $( ".selector" ).selectable({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).selectable( "option", "disabled" );
        -//setter
        -$( ".selector" ).selectable( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        autoRefresh

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        This determines whether to refresh (recalculate) the position and size of each selectee at the beginning of each select operation. If you have many many items, you may want to set this to false and call the refresh method manually.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the autoRefresh option specified. -
        -
        -
        $( ".selector" ).selectable({ autoRefresh: false });
        -
        - - -
        - Get or set the autoRefresh option, after init. -
        -
        -
        //getter
        -var autoRefresh = $( ".selector" ).selectable( "option", "autoRefresh" );
        -//setter
        -$( ".selector" ).selectable( "option", "autoRefresh", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cancel

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        ':input,option'
        - -
        -
        -
        -

        Prevents selecting if you start on elements matching the selector.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the cancel option specified. -
        -
        -
        $( ".selector" ).selectable({ cancel: ':input,option' });
        -
        - - -
        - Get or set the cancel option, after init. -
        -
        -
        //getter
        -var cancel = $( ".selector" ).selectable( "option", "cancel" );
        -//setter
        -$( ".selector" ).selectable( "option", "cancel", ':input,option' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        delay

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Time in milliseconds to define when the selecting should start. It helps preventing unwanted selections when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the delay option specified. -
        -
        -
        $( ".selector" ).selectable({ delay: 20 });
        -
        - - -
        - Get or set the delay option, after init. -
        -
        -
        //getter
        -var delay = $( ".selector" ).selectable( "option", "delay" );
        -//setter
        -$( ".selector" ).selectable( "option", "delay", 20 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        distance

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Tolerance, in pixels, for when selecting should start. If specified, selecting will not start until after mouse is dragged beyond distance.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the distance option specified. -
        -
        -
        $( ".selector" ).selectable({ distance: 20 });
        -
        - - -
        - Get or set the distance option, after init. -
        -
        -
        //getter
        -var distance = $( ".selector" ).selectable( "option", "distance" );
        -//setter
        -$( ".selector" ).selectable( "option", "distance", 20 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        filter

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        '*'
        - -
        -
        -
        -

        The matching child elements will be made selectees (able to be selected).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the filter option specified. -
        -
        -
        $( ".selector" ).selectable({ filter: 'li' });
        -
        - - -
        - Get or set the filter option, after init. -
        -
        -
        //getter
        -var filter = $( ".selector" ).selectable( "option", "filter" );
        -//setter
        -$( ".selector" ).selectable( "option", "filter", 'li' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        tolerance

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'touch'
        - -
        -
        -
        -

        Possible values: 'touch', 'fit'. -

        -
          -
        • fit: draggable overlaps the droppable entirely
        • -
        • touch: draggable overlaps the droppable any amount
        • -
        -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a selectable with the tolerance option specified. -
        -
        -
        $( ".selector" ).selectable({ tolerance: 'fit' });
        -
        - - -
        - Get or set the tolerance option, after init. -
        -
        -
        //getter
        -var tolerance = $( ".selector" ).selectable( "option", "tolerance" );
        -//setter
        -$( ".selector" ).selectable( "option", "tolerance", 'fit' );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        selectablecreate
        -
        -
        -
        -

        This event is triggered when selectable is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: selectablecreate. -
        -
        -
        $( ".selector" ).bind( "selectablecreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        selected

        -
        -
        Type:
        -
        selectableselected
        -
        -
        -
        -

        This event is triggered at the end of the select operation, on each element added to the selection.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the selected event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   selected: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the selected event by type: selectableselected. -
        -
        -
        $( ".selector" ).bind( "selectableselected", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        selecting

        -
        -
        Type:
        -
        selectableselecting
        -
        -
        -
        -

        This event is triggered during the select operation, on each element added to the selection.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the selecting event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   selecting: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the selecting event by type: selectableselecting. -
        -
        -
        $( ".selector" ).bind( "selectableselecting", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        start

        -
        -
        Type:
        -
        selectablestart
        -
        -
        -
        -

        This event is triggered at the beginning of the select operation.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the start event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   start: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the start event by type: selectablestart. -
        -
        -
        $( ".selector" ).bind( "selectablestart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        stop

        -
        -
        Type:
        -
        selectablestop
        -
        -
        -
        -

        This event is triggered at the end of the select operation.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the stop event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   stop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the stop event by type: selectablestop. -
        -
        -
        $( ".selector" ).bind( "selectablestop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        unselected

        -
        -
        Type:
        -
        selectableunselected
        -
        -
        -
        -

        This event is triggered at the end of the select operation, on each element removed from the selection.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the unselected event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   unselected: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the unselected event by type: selectableunselected. -
        -
        -
        $( ".selector" ).bind( "selectableunselected", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        unselecting

        -
        -
        Type:
        -
        selectableunselecting
        -
        -
        -
        -

        This event is triggered during the select operation, on each element removed from the selection.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the unselecting event as an init option. -
        -
        -
        $( ".selector" ).selectable({
        -   unselecting: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the unselecting event by type: selectableunselecting. -
        -
        -
        $( ".selector" ).bind( "selectableunselecting", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .selectable( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the selectable functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .selectable( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the selectable.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .selectable( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the selectable.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .selectable( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any selectable option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .selectable( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple selectable options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .selectable( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-selectable element.

        -
        -
      • - - -
      • -
        -

        refresh

        -
        -
        Signature:
        -
        .selectable( "refresh" - - - - - - - -)
        -
        -
        -
        -

        Refresh the position and size of each selectee element. This method can be used to manually recalculate the position and size of each selectee element. Very useful if autoRefresh is set to false.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Selectable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.selectable.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <ul class="ui-selectable">
      -   <li class="ui-selectee"></li>
      -   <li class="ui-selectee"></li>
      -   <li class="ui-selectee"></li>
      -</ul> -

      - - Note: This is a sample of markup generated by the selectable plugin, not markup you should use to create a selectable. The only markup needed for that is
      <ul>
      -   <li></li>
      -   <li></li>
      -   <li></li>
      -</ul>. -
      -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/show.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/show.html deleted file mode 100644 index 7df77a32ea..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/show.html +++ /dev/null @@ -1,144 +0,0 @@ - - -
      -

      jQuery UI show

      -
      -

      Overview

      -
      -

      show( effect, [options], [speed], [callback] )

      -

      The enhanced show method optionally accepts jQuery UI advanced effects.

      -

      Uses a specific effect on an element to show the element if the first argument is a effect string.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Apply the effect slide if you click on the p to show a div.
      -

      -
      $("p").click(function () {
      -      $("div").show("slide", {}, 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<script src="http://ui.jquery.com/latest/ui/effects.slide.js"></script>
      -<style type="text/css">
      -  div { display: none; margin: 0px; width: 100px; height: 80px; background: blue; position: relative; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $("div").show("slide", {}, 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p>Click me</p><div></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        effect

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.

        -
        -
      • - - -
      • -
        -

        options

        -
        -
        Type:
        -
        Hash
        - -
        Optional
        - -
        -
        -
        -

        A object/hash including specific options for the effect.

        -
        -
      • - - -
      • -
        -

        speed

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the predefined speeds ("slow" or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - - -
      • -
        -

        callback

        -
        -
        Type:
        -
        Function
        - -
        Optional
        - -
        -
        -
        -

        A function that is called after the effect is completed.

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/slider.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/slider.html deleted file mode 100644 index 4a7c9f130c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/slider.html +++ /dev/null @@ -1,860 +0,0 @@ - - -
      -

      jQuery UI Slider

      -
      -

      Overview

      -
      -

      The jQuery UI Slider plugin makes selected elements into sliders. There are various options such as multiple handles, and ranges. The handle can be moved with the mouse or the arrow keys.

      -

      All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'): -

      The slider widget will create handle elements with the class 'ui-slider-handle' on initialization. You can specify custom handle elements by creating and appending the elements and adding the 'ui-slider-handle' class before init. It will only create the number of handles needed to match the length of value/values. For example, if you specify 'values: [1, 5, 18]' and create one custom handle, the plugin will create the other two. -

      -
        -
      • ui.handle: DOMElement - the current focused handle -
      • ui.value: Integer - the current handle's value -
      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Mouse
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Slider.
      -

      -
      $("#slider").slider();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -    <style type="text/css">
      -    #slider { margin: 10px; }
      -  </style>
      -  <script>
      -  $(document).ready(function() {
      -    $("#slider").slider();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="slider"></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the slider. Can be set when initialising (first creating) the slider.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the disabled option specified. -
        -
        -
        $( ".selector" ).slider({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).slider( "option", "disabled" );
        -//setter
        -$( ".selector" ).slider( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        animate

        -
        -
        Type:
        -
        Boolean, String, Number
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Whether to slide handle smoothly when user click outside handle on the bar. Will also accept a string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the animate option specified. -
        -
        -
        $( ".selector" ).slider({ animate: true });
        -
        - - -
        - Get or set the animate option, after init. -
        -
        -
        //getter
        -var animate = $( ".selector" ).slider( "option", "animate" );
        -//setter
        -$( ".selector" ).slider( "option", "animate", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        max

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        100
        - -
        -
        -
        -

        The maximum value of the slider.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the max option specified. -
        -
        -
        $( ".selector" ).slider({ max: 7 });
        -
        - - -
        - Get or set the max option, after init. -
        -
        -
        //getter
        -var max = $( ".selector" ).slider( "option", "max" );
        -//setter
        -$( ".selector" ).slider( "option", "max", 7 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        min

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        The minimum value of the slider.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the min option specified. -
        -
        -
        $( ".selector" ).slider({ min: -7 });
        -
        - - -
        - Get or set the min option, after init. -
        -
        -
        //getter
        -var min = $( ".selector" ).slider( "option", "min" );
        -//setter
        -$( ".selector" ).slider( "option", "min", -7 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        orientation

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'horizontal'
        - -
        -
        -
        -

        This option determines whether the slider has the min at the left, the max at the right or the min at the bottom, the max at the top. Possible values: 'horizontal', 'vertical'.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the orientation option specified. -
        -
        -
        $( ".selector" ).slider({ orientation: 'vertical' });
        -
        - - -
        - Get or set the orientation option, after init. -
        -
        -
        //getter
        -var orientation = $( ".selector" ).slider( "option", "orientation" );
        -//setter
        -$( ".selector" ).slider( "option", "orientation", 'vertical' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        range

        -
        -
        Type:
        -
        Boolean, String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, the slider will detect if you have two handles and create a stylable range element between these two. Two other possible values are 'min' and 'max'. A min range goes from the slider min to one handle. A max range goes from one handle to the slider max.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the range option specified. -
        -
        -
        $( ".selector" ).slider({ range: 'min' });
        -
        - - -
        - Get or set the range option, after init. -
        -
        -
        //getter
        -var range = $( ".selector" ).slider( "option", "range" );
        -//setter
        -$( ".selector" ).slider( "option", "range", 'min' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        step

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Determines the size or amount of each interval or step the slider takes between min and max. The full specified value range of the slider (max - min) needs to be evenly divisible by the step.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the step option specified. -
        -
        -
        $( ".selector" ).slider({ step: 5 });
        -
        - - -
        - Get or set the step option, after init. -
        -
        -
        //getter
        -var step = $( ".selector" ).slider( "option", "step" );
        -//setter
        -$( ".selector" ).slider( "option", "step", 5 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        value

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Determines the value of the slider, if there's only one handle. If there is more than one handle, determines the value of the first handle.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the value option specified. -
        -
        -
        $( ".selector" ).slider({ value: 37 });
        -
        - - -
        - Get or set the value option, after init. -
        -
        -
        //getter
        -var value = $( ".selector" ).slider( "option", "value" );
        -//setter
        -$( ".selector" ).slider( "option", "value", 37 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        values

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        This option can be used to specify multiple handles. If range is set to true, the length of 'values' should be 2.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a slider with the values option specified. -
        -
        -
        $( ".selector" ).slider({ values: [1,5,9] });
        -
        - - -
        - Get or set the values option, after init. -
        -
        -
        //getter
        -var values = $( ".selector" ).slider( "option", "values" );
        -//setter
        -$( ".selector" ).slider( "option", "values", [1,5,9] );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        slidecreate
        -
        -
        -
        -

        This event is triggered when slider is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).slider({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: slidecreate. -
        -
        -
        $( ".selector" ).bind( "slidecreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        start

        -
        -
        Type:
        -
        slidestart
        -
        -
        -
        -

        This event is triggered when the user starts sliding.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the start event as an init option. -
        -
        -
        $( ".selector" ).slider({
        -   start: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the start event by type: slidestart. -
        -
        -
        $( ".selector" ).bind( "slidestart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        slide

        -
        -
        Type:
        -
        slide
        -
        -
        -
        -

        This event is triggered on every mouse move during slide. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(..).slider('value', index) to get another handles' value. -

        Return false in order to prevent a slide, based on ui.value.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the slide event as an init option. -
        -
        -
        $( ".selector" ).slider({
        -   slide: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the slide event by type: slide. -
        -
        -
        $( ".selector" ).bind( "slide", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        change

        -
        -
        Type:
        -
        slidechange
        -
        -
        -
        -

        This event is triggered on slide stop, or if the value is changed programmatically (by the value method). Takes arguments event and ui. Use event.orginalEvent to detect whether the value changed by mouse, keyboard, or programmatically. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(this).slider('values', index) to get another handle's value.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the change event as an init option. -
        -
        -
        $( ".selector" ).slider({
        -   change: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the change event by type: slidechange. -
        -
        -
        $( ".selector" ).bind( "slidechange", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        stop

        -
        -
        Type:
        -
        slidestop
        -
        -
        -
        -

        This event is triggered when the user stops sliding.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the stop event as an init option. -
        -
        -
        $( ".selector" ).slider({
        -   stop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the stop event by type: slidestop. -
        -
        -
        $( ".selector" ).bind( "slidestop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .slider( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the slider functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .slider( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the slider.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .slider( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the slider.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .slider( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any slider option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .slider( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple slider options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .slider( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-slider element.

        -
        -
      • - - -
      • -
        -

        value

        -
        -
        Signature:
        -
        .slider( "value" - -, [value] - - - - - -)
        -
        -
        -
        -

        Gets or sets the value of the slider. For single handle sliders.

        -
        -
      • - - -
      • -
        -

        values

        -
        -
        Signature:
        -
        .slider( "values" - -, index - -, [value] - - - -)
        -
        -
        -
        -

        Gets or sets the values of the slider. For multiple handle or range sliders.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Slider plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.slider.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">
      -   <a style="left: 0%;" class="ui-slider-handle ui-state-default ui-corner-all" href="#"></a>
      -</div>
      -

      - - Note: This is a sample of markup generated by the slider plugin, not markup you should use to create a slider. The only markup needed for that is <div><div>. - -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/sortable.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/sortable.html deleted file mode 100644 index 3f9a0308c5..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/sortable.html +++ /dev/null @@ -1,1953 +0,0 @@ - - -
      -

      jQuery UI Sortable

      -
      -

      Overview

      -
      -

      The jQuery UI Sortable plugin makes selected elements sortable by dragging with the mouse.

      -

      All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):

      -
        -
      • ui.helper - the current helper element (most often a clone of the item)
      • -
      • ui.position - current position of the helper
      • -
      • ui.offset - current absolute position of the helper
      • -
      • ui.item - the current dragged element
      • -
      • ui.placeholder - the placeholder (if you defined one)
      • -
      • ui.sender - the sortable where the item comes from (only exists if you move from one connected list to another)
      • -
      -
      -
      -

      Dependencies

      -
        -
      • UI Core
      • -
      • UI Widget
      • -
      • UI Mouse
      • -
      -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Sortable.
      -

      -
      $("#sortable").sortable();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#sortable").sortable();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<ul id="sortable">
      -<li>Item 1</li>
      -<li>Item 2</li>
      -<li>Item 3</li>
      -<li>Item 4</li>
      -<li>Item 5</li>
      -</ul>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the sortable. Can be set when initialising (first creating) the sortable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the disabled option specified. -
        -
        -
        $( ".selector" ).sortable({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).sortable( "option", "disabled" );
        -//setter
        -$( ".selector" ).sortable( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        appendTo

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'parent'
        - -
        -
        -
        -

        Defines where the helper that moves with the mouse is being appended to during the drag (for example, to resolve overlap/zIndex issues).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the appendTo option specified. -
        -
        -
        $( ".selector" ).sortable({ appendTo: 'body' });
        -
        - - -
        - Get or set the appendTo option, after init. -
        -
        -
        //getter
        -var appendTo = $( ".selector" ).sortable( "option", "appendTo" );
        -//setter
        -$( ".selector" ).sortable( "option", "appendTo", 'body' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        axis

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If defined, the items can be dragged only horizontally or vertically. Possible values:'x', 'y'.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the axis option specified. -
        -
        -
        $( ".selector" ).sortable({ axis: 'x' });
        -
        - - -
        - Get or set the axis option, after init. -
        -
        -
        //getter
        -var axis = $( ".selector" ).sortable( "option", "axis" );
        -//setter
        -$( ".selector" ).sortable( "option", "axis", 'x' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cancel

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        ':input,button'
        - -
        -
        -
        -

        Prevents sorting if you start on elements matching the selector.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the cancel option specified. -
        -
        -
        $( ".selector" ).sortable({ cancel: 'button' });
        -
        - - -
        - Get or set the cancel option, after init. -
        -
        -
        //getter
        -var cancel = $( ".selector" ).sortable( "option", "cancel" );
        -//setter
        -$( ".selector" ).sortable( "option", "cancel", 'button' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        connectWith

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Takes a jQuery selector with items that also have sortables applied. If used, the sortable is now connected to the other one-way, so you can drag from this sortable to the other.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the connectWith option specified. -
        -
        -
        $( ".selector" ).sortable({ connectWith: '.otherlist' });
        -
        - - -
        - Get or set the connectWith option, after init. -
        -
        -
        //getter
        -var connectWith = $( ".selector" ).sortable( "option", "connectWith" );
        -//setter
        -$( ".selector" ).sortable( "option", "connectWith", '.otherlist' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        containment

        -
        -
        Type:
        -
        Element, String, Selector
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Constrains dragging to within the bounds of the specified element - can be a DOM element, 'parent', 'document', 'window', or a jQuery selector. -

        Note: the element specified for containment must have a calculated width and height (though it need not be explicit), so for example, if you have float:left sortable children and specify containment:'parent' be sure to have float:left on the sortable/parent container as well or it will have height: 0, causing undefined behavior.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the containment option specified. -
        -
        -
        $( ".selector" ).sortable({ containment: 'parent' });
        -
        - - -
        - Get or set the containment option, after init. -
        -
        -
        //getter
        -var containment = $( ".selector" ).sortable( "option", "containment" );
        -//setter
        -$( ".selector" ).sortable( "option", "containment", 'parent' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cursor

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'auto'
        - -
        -
        -
        -

        Defines the cursor that is being shown while sorting.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the cursor option specified. -
        -
        -
        $( ".selector" ).sortable({ cursor: 'crosshair' });
        -
        - - -
        - Get or set the cursor option, after init. -
        -
        -
        //getter
        -var cursor = $( ".selector" ).sortable( "option", "cursor" );
        -//setter
        -$( ".selector" ).sortable( "option", "cursor", 'crosshair' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cursorAt

        -
        -
        Type:
        -
        Object
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys: { top, left, right, bottom }.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the cursorAt option specified. -
        -
        -
        $( ".selector" ).sortable({ cursorAt: 'top' });
        -
        - - -
        - Get or set the cursorAt option, after init. -
        -
        -
        //getter
        -var cursorAt = $( ".selector" ).sortable( "option", "cursorAt" );
        -//setter
        -$( ".selector" ).sortable( "option", "cursorAt", 'top' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        delay

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Time in milliseconds to define when the sorting should start. It helps preventing unwanted drags when clicking on an element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the delay option specified. -
        -
        -
        $( ".selector" ).sortable({ delay: 500 });
        -
        - - -
        - Get or set the delay option, after init. -
        -
        -
        //getter
        -var delay = $( ".selector" ).sortable( "option", "delay" );
        -//setter
        -$( ".selector" ).sortable( "option", "delay", 500 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        distance

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1
        - -
        -
        -
        -

        Tolerance, in pixels, for when sorting should start. If specified, sorting will not start until after mouse is dragged beyond distance. Can be used to allow for clicks on elements within a handle.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the distance option specified. -
        -
        -
        $( ".selector" ).sortable({ distance: 30 });
        -
        - - -
        - Get or set the distance option, after init. -
        -
        -
        //getter
        -var distance = $( ".selector" ).sortable( "option", "distance" );
        -//setter
        -$( ".selector" ).sortable( "option", "distance", 30 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        dropOnEmpty

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If false items from this sortable can't be dropped to an empty linked sortable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the dropOnEmpty option specified. -
        -
        -
        $( ".selector" ).sortable({ dropOnEmpty: false });
        -
        - - -
        - Get or set the dropOnEmpty option, after init. -
        -
        -
        //getter
        -var dropOnEmpty = $( ".selector" ).sortable( "option", "dropOnEmpty" );
        -//setter
        -$( ".selector" ).sortable( "option", "dropOnEmpty", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        forceHelperSize

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If true, forces the helper to have a size.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the forceHelperSize option specified. -
        -
        -
        $( ".selector" ).sortable({ forceHelperSize: true });
        -
        - - -
        - Get or set the forceHelperSize option, after init. -
        -
        -
        //getter
        -var forceHelperSize = $( ".selector" ).sortable( "option", "forceHelperSize" );
        -//setter
        -$( ".selector" ).sortable( "option", "forceHelperSize", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        forcePlaceholderSize

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If true, forces the placeholder to have a size.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the forcePlaceholderSize option specified. -
        -
        -
        $( ".selector" ).sortable({ forcePlaceholderSize: true });
        -
        - - -
        - Get or set the forcePlaceholderSize option, after init. -
        -
        -
        //getter
        -var forcePlaceholderSize = $( ".selector" ).sortable( "option", "forcePlaceholderSize" );
        -//setter
        -$( ".selector" ).sortable( "option", "forcePlaceholderSize", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        grid

        -
        -
        Type:
        -
        Array
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Snaps the sorting element or helper to a grid, every x and y pixels. Array values: [x, y]

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the grid option specified. -
        -
        -
        $( ".selector" ).sortable({ grid: [50, 20] });
        -
        - - -
        - Get or set the grid option, after init. -
        -
        -
        //getter
        -var grid = $( ".selector" ).sortable( "option", "grid" );
        -//setter
        -$( ".selector" ).sortable( "option", "grid", [50, 20] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        handle

        -
        -
        Type:
        -
        Selector, Element
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Restricts sort start click to the specified element.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the handle option specified. -
        -
        -
        $( ".selector" ).sortable({ handle: 'h2' });
        -
        - - -
        - Get or set the handle option, after init. -
        -
        -
        //getter
        -var handle = $( ".selector" ).sortable( "option", "handle" );
        -//setter
        -$( ".selector" ).sortable( "option", "handle", 'h2' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        helper

        -
        -
        Type:
        -
        String, Function
        - -
        Default:
        -
        'original'
        - -
        -
        -
        -

        Allows for a helper element to be used for dragging display. The supplied function receives the event and the element being sorted, and should return a DOMElement to be used as a custom proxy helper. Possible values: 'original', 'clone'

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the helper option specified. -
        -
        -
        $( ".selector" ).sortable({ helper: 'clone' });
        -
        - - -
        - Get or set the helper option, after init. -
        -
        -
        //getter
        -var helper = $( ".selector" ).sortable( "option", "helper" );
        -//setter
        -$( ".selector" ).sortable( "option", "helper", 'clone' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        items

        -
        -
        Type:
        -
        Selector
        - -
        Default:
        -
        '> *'
        - -
        -
        -
        -

        Specifies which items inside the element should be sortable.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the items option specified. -
        -
        -
        $( ".selector" ).sortable({ items: 'li' });
        -
        - - -
        - Get or set the items option, after init. -
        -
        -
        //getter
        -var items = $( ".selector" ).sortable( "option", "items" );
        -//setter
        -$( ".selector" ).sortable( "option", "items", 'li' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        opacity

        -
        -
        Type:
        -
        Float
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Defines the opacity of the helper while sorting. From 0.01 to 1

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the opacity option specified. -
        -
        -
        $( ".selector" ).sortable({ opacity: 0.6 });
        -
        - - -
        - Get or set the opacity option, after init. -
        -
        -
        //getter
        -var opacity = $( ".selector" ).sortable( "option", "opacity" );
        -//setter
        -$( ".selector" ).sortable( "option", "opacity", 0.6 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        placeholder

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Class that gets applied to the otherwise white space.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the placeholder option specified. -
        -
        -
        $( ".selector" ).sortable({ placeholder: 'ui-state-highlight' });
        -
        - - -
        - Get or set the placeholder option, after init. -
        -
        -
        //getter
        -var placeholder = $( ".selector" ).sortable( "option", "placeholder" );
        -//setter
        -$( ".selector" ).sortable( "option", "placeholder", 'ui-state-highlight' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        revert

        -
        -
        Type:
        -
        Boolean/Integer
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        If set to true, the item will be reverted to its new DOM position with a smooth animation. Optionally, it can also be set to a number that controls the duration of the animation in ms.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the revert option specified. -
        -
        -
        $( ".selector" ).sortable({ revert: true });
        -
        - - -
        - Get or set the revert option, after init. -
        -
        -
        //getter
        -var revert = $( ".selector" ).sortable( "option", "revert" );
        -//setter
        -$( ".selector" ).sortable( "option", "revert", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scroll

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        true
        - -
        -
        -
        -

        If set to true, the page scrolls when coming to an edge.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the scroll option specified. -
        -
        -
        $( ".selector" ).sortable({ scroll: false });
        -
        - - -
        - Get or set the scroll option, after init. -
        -
        -
        //getter
        -var scroll = $( ".selector" ).sortable( "option", "scroll" );
        -//setter
        -$( ".selector" ).sortable( "option", "scroll", false );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scrollSensitivity

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        20
        - -
        -
        -
        -

        Defines how near the mouse must be to an edge to start scrolling.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the scrollSensitivity option specified. -
        -
        -
        $( ".selector" ).sortable({ scrollSensitivity: 40 });
        -
        - - -
        - Get or set the scrollSensitivity option, after init. -
        -
        -
        //getter
        -var scrollSensitivity = $( ".selector" ).sortable( "option", "scrollSensitivity" );
        -//setter
        -$( ".selector" ).sortable( "option", "scrollSensitivity", 40 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        scrollSpeed

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        20
        - -
        -
        -
        -

        The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the scrollSpeed option specified. -
        -
        -
        $( ".selector" ).sortable({ scrollSpeed: 40 });
        -
        - - -
        - Get or set the scrollSpeed option, after init. -
        -
        -
        //getter
        -var scrollSpeed = $( ".selector" ).sortable( "option", "scrollSpeed" );
        -//setter
        -$( ".selector" ).sortable( "option", "scrollSpeed", 40 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        tolerance

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'intersect'
        - -
        -
        -
        -

        This is the way the reordering behaves during drag. Possible values: 'intersect', 'pointer'. In some setups, 'pointer' is more natural. -

        -
          -
        • intersect: draggable overlaps the droppable at least 50%
        • -
        • pointer: mouse pointer overlaps the droppable
        • -
        -

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the tolerance option specified. -
        -
        -
        $( ".selector" ).sortable({ tolerance: 'pointer' });
        -
        - - -
        - Get or set the tolerance option, after init. -
        -
        -
        //getter
        -var tolerance = $( ".selector" ).sortable( "option", "tolerance" );
        -//setter
        -$( ".selector" ).sortable( "option", "tolerance", 'pointer' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        zIndex

        -
        -
        Type:
        -
        Integer
        - -
        Default:
        -
        1000
        - -
        -
        -
        -

        Z-index for element/helper while being sorted.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a sortable with the zIndex option specified. -
        -
        -
        $( ".selector" ).sortable({ zIndex: 5 });
        -
        - - -
        - Get or set the zIndex option, after init. -
        -
        -
        //getter
        -var zIndex = $( ".selector" ).sortable( "option", "zIndex" );
        -//setter
        -$( ".selector" ).sortable( "option", "zIndex", 5 );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        sortcreate
        -
        -
        -
        -

        This event is triggered when sortable is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: sortcreate. -
        -
        -
        $( ".selector" ).bind( "sortcreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        start

        -
        -
        Type:
        -
        sortstart
        -
        -
        -
        -

        This event is triggered when sorting starts.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the start event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   start: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the start event by type: sortstart. -
        -
        -
        $( ".selector" ).bind( "sortstart", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        sort

        -
        -
        Type:
        -
        sort
        -
        -
        -
        -

        This event is triggered during sorting.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the sort event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   sort: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the sort event by type: sort. -
        -
        -
        $( ".selector" ).bind( "sort", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        change

        -
        -
        Type:
        -
        sortchange
        -
        -
        -
        -

        This event is triggered during sorting, but only when the DOM position has changed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the change event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   change: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the change event by type: sortchange. -
        -
        -
        $( ".selector" ).bind( "sortchange", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        beforeStop

        -
        -
        Type:
        -
        sortbeforestop
        -
        -
        -
        -

        This event is triggered when sorting stops, but when the placeholder/helper is still available.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the beforeStop event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   beforeStop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the beforeStop event by type: sortbeforestop. -
        -
        -
        $( ".selector" ).bind( "sortbeforestop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        stop

        -
        -
        Type:
        -
        sortstop
        -
        -
        -
        -

        This event is triggered when sorting has stopped.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the stop event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   stop: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the stop event by type: sortstop. -
        -
        -
        $( ".selector" ).bind( "sortstop", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        update

        -
        -
        Type:
        -
        sortupdate
        -
        -
        -
        -

        This event is triggered when the user stopped sorting and the DOM position has changed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the update event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   update: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the update event by type: sortupdate. -
        -
        -
        $( ".selector" ).bind( "sortupdate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        receive

        -
        -
        Type:
        -
        sortreceive
        -
        -
        -
        -

        This event is triggered when a connected sortable list has received an item from another list.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the receive event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   receive: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the receive event by type: sortreceive. -
        -
        -
        $( ".selector" ).bind( "sortreceive", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        remove

        -
        -
        Type:
        -
        sortremove
        -
        -
        -
        -

        This event is triggered when a sortable item has been dragged out from the list and into another.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the remove event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   remove: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the remove event by type: sortremove. -
        -
        -
        $( ".selector" ).bind( "sortremove", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        over

        -
        -
        Type:
        -
        sortover
        -
        -
        -
        -

        This event is triggered when a sortable item is moved into a connected list.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the over event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   over: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the over event by type: sortover. -
        -
        -
        $( ".selector" ).bind( "sortover", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        out

        -
        -
        Type:
        -
        sortout
        -
        -
        -
        -

        This event is triggered when a sortable item is moved away from a connected list.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the out event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   out: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the out event by type: sortout. -
        -
        -
        $( ".selector" ).bind( "sortout", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        activate

        -
        -
        Type:
        -
        sortactivate
        -
        -
        -
        -

        This event is triggered when using connected lists, every connected list on drag start receives it.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the activate event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   activate: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the activate event by type: sortactivate. -
        -
        -
        $( ".selector" ).bind( "sortactivate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        deactivate

        -
        -
        Type:
        -
        sortdeactivate
        -
        -
        -
        -

        This event is triggered when sorting was stopped, is propagated to all possible connected lists.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the deactivate event as an init option. -
        -
        -
        $( ".selector" ).sortable({
        -   deactivate: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the deactivate event by type: sortdeactivate. -
        -
        -
        $( ".selector" ).bind( "sortdeactivate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .sortable( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the sortable functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .sortable( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the sortable.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .sortable( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the sortable.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .sortable( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any sortable option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .sortable( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple sortable options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .sortable( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-sortable element.

        -
        -
      • - - -
      • -
        -

        serialize

        -
        -
        Signature:
        -
        .sortable( "serialize" - -, [options] - - - - - -)
        -
        -
        -
        -

        Serializes the sortable's item id's into a form/ajax submittable string. Calling this method produces a hash that can be appended to any url to easily submit a new item order back to the server. -

        It works by default by looking at the id of each item in the format 'setname_number', and it spits out a hash like "setname[]=number&setname[]=number". -

        You can also give in a option hash as second argument to custom define how the function works. The possible options are: 'key' (replaces part1[] with whatever you want), 'attribute' (test another attribute than 'id') and 'expression' (use your own regexp). -

        If serialize returns an empty string, make sure the id attributes include an underscore. They must be in the form: "set_number" For example, a 3 element list with id attributes foo_1, foo_5, foo_2 will serialize to foo[]=1&foo[]=5&foo[]=2. You can use an underscore, equal sign or hyphen to separate the set and number. For example foo=1 or foo-1 or foo_1 all serialize to foo[]=1.

        -
        -
      • - - -
      • -
        -

        toArray

        -
        -
        Signature:
        -
        .sortable( "toArray" - - - - - - - -)
        -
        -
        -
        -

        Serializes the sortable's item id's into an array of string. If you have -

        -
        -<ul id="a_sortable"><br>
        -<li id="hello">Hello</li><br>
        -<li id="goodbye">Good bye</li><br>
        -</ul>
        -
        -

        and do -

        -
        var result = $('#a_sortable').sortable('toArray');
        -

        then -

        -
        result[0] will contain "hello" and result[1] will contain "goodbye".

        -
        -
      • - -

        -

      • -
        -

        refresh

        -
        -
        Signature:
        -
        .sortable( "refresh" - - - - - - - -)
        -
        -
        -
        -

        Refresh the sortable items. Custom trigger the reloading of all sortable items, causing new items to be recognized.

        -
        -
      • - - -
      • -
        -

        refreshPositions

        -
        -
        Signature:
        -
        .sortable( "refreshPositions" - - - - - - - -)
        -
        -
        -
        -

        Refresh the cached positions of the sortables' items. Calling this method refreshes the cached item positions of all sortables. This is usually done automatically by the script and slows down performance. Use wisely.

        -
        -
      • - - -
      • -
        -

        cancel

        -
        -
        Signature:
        -
        .sortable( "cancel" - - - - - - - -)
        -
        -
        -
        -

        Cancels a change in the current sortable and reverts it back to how it was before the current sort started. Useful in the stop and receive callback functions. -

        If the sortable item is not being moved from one connected sortable to another: -

        -
        $(this).sortable('cancel');
        -

        will cancel the change. -

        If the sortable item is being moved from one connected sortable to another: -

        -
        $(ui.sender).sortable('cancel');
        -

        will cancel the change. Useful in the 'receive' callback.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Sortable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.sortable.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <ul class="ui-sortable">
      -   <li></li>
      -   <li class="ui-sortable-helper"></li>
      -   <li class="ui-sortable-placeholder"></li>
      -   <li></li>
      -</ul> -

      - - Note: This is a sample of markup generated by the sortable plugin, not markup you should use to create a sortable. The only markup needed for that is
      <ul>
      -   <li></li>
      -   <li></li>
      -   <li></li>
      -</ul>. -
      -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/switchClass.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/switchClass.html deleted file mode 100644 index 45424c9dcc..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/switchClass.html +++ /dev/null @@ -1,129 +0,0 @@ - - -
      -

      jQuery UI switchClass

      -
      -

      Overview

      -
      -

      switchClass( remove, add, [duration] )

      -

      Switches from the class defined in the first argument to the class defined as second argument, using an optional transition.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Switch the class 'highlight' to 'blue' when a paragraph is clicked with a one second transition.
      -

      -
      $("p").click(function () {
      -      $(this).switchClass("highlight", "blue", 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<style type="text/css">
      -  p { margin: 4px; font-size:16px; font-weight:bolder; 
      -      cursor:pointer; }
      -  .blue { background: blue; }
      -  .highlight { background:yellow; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $(this).switchClass("highlight", "blue", 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p class="highlight">Click to switch</p>
      -<p class="highlight">to blue</p>
      -<p class="highlight">on these</p>
      -<p class="highlight">paragraphs</p>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        remove

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The CSS class that will be removed.

        -
        -
      • - - -
      • -
        -

        add

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The CSS class that will be added.

        -
        -
      • - - -
      • -
        -

        duration

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/tabs.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/tabs.html deleted file mode 100644 index e5a0975feb..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/tabs.html +++ /dev/null @@ -1,1549 +0,0 @@ - - -
      -

      jQuery UI Tabs

      -
      -

      Overview

      -
      -

      Tabs are generally used to break content into multiple sections that can be swapped to save space, much like an accordion.

      -

      By default a tab widget will swap between tabbed sections onClick, but the events can be changed to onHover through an option. Tab content can be loaded via Ajax by setting an href on a tab.

      -

      NOTE: Tabs created dynamically using .tabs( "add", ... ) are given an id of ui-tabs-NUM, where NUM is an auto-incrementing id. If you use this naming convention for your own elements, you may encounter problems.

      -

      Contents

      - -
      -

      Events

      -

      A series of events fire when interacting with a tabs interface: -

      -
      • tabsselect, tabsload, tabsshow (in that order) -
      • tabsadd, tabsremove -
      • tabsenable, tabsdisable -
      -

      Event binding example: -

      -
      $('#example').bind('tabsselect', function(event, ui) {
      -
      -    // Objects available in the function context:
      -    ui.tab     // anchor element of the selected (clicked) tab
      -    ui.panel   // element, that contains the selected/clicked tab contents
      -    ui.index   // zero-based index of the selected (clicked) tab
      -
      -});
      -

      Note that if a handler for the tabsselect event returns false, the clicked tab will not become selected (useful for example if switching to the next tab requires a form validation). -

      -

      Ajax mode

      -

      Tabs supports loading tab content via Ajax in an unobtrusive manner. -

      The HTML you need is slightly different from the one that is used for static tabs: A list of links pointing to existing resources (from where the content gets loaded) and no additional containers at all (unobtrusive!). The containers' markup is going to be created on the fly: -

      -
      -<div id="example">
      -     <ul>
      -         <li><a href="ahah_1.html"><span>Content 1</span></a></li>
      -         <li><a href="ahah_2.html"><span>Content 2</span></a></li>
      -         <li><a href="ahah_3.html"><span>Content 3</span></a></li>
      -     </ul>
      -</div>
      -
      -

      Obviously this degrades gracefully - the links, e.g. the content, will still be accessible with JavaScript disabled. -

      Note that if you wish to reuse an existing container, you -could do so by matching a title attribute and the container's id: -

      -
      -<li><a href="hello/world.html" title="Todo Overview"> ... </a></li>
      -
      -

      and a container like: -

      -
      -<div id="Todo_Overview"> ... </div>
      -
      -

      (Note how white space is replaced with an underscore) -

      This is useful if you want a human readable hash in the URL instead of -a cryptic generated one. -

      -

      Back button and bookmarking

      -

      Tabs 2 already supported this functionality, although the history plugin needs a rewrite first (it doesn't support Safari 3 and is in general a little inflexible) before it can be build back into the tabs. It is planned and Klaus is working on it whenever he finds the time. Actual bugs in the UI Tabs plugin itself always have higher priority though. -

      -

      How to...

      -

      ...retrieve the index of the currently selected tab

      -
      var $tabs = $('#example').tabs();
      -var selected = $tabs.tabs('option', 'selected'); // => 0
      -

      ...open links in the current tab instead of leaving the page

      -

      "Hijax" links after tab content has been loaded: -

      -
      $('#example').tabs({
      -    load: function(event, ui) {
      -        $('a', ui.panel).click(function() {
      -            $(ui.panel).load(this.href);
      -            return false;
      -        });
      -    }
      -});
      -

      ...select a tab from a text link instead of clicking a tab itself

      -
      var $tabs = $('#example').tabs(); // first tab selected
      -
      -$('#my-text-link').click(function() { // bind click event to link
      -    $tabs.tabs('select', 2); // switch to third tab
      -    return false;
      -});
      -

      ...prevent switching to the tab on click depending on form validation

      -

      Returning false in the tabs select handler prevents the clicked tab from becoming selected. -

      -
      $('#example').tabs({
      -    select: function(event, ui) {
      -        var isValid = ... // form validation returning true or false
      -        return isValid;
      -    }
      -});
      -

      ...immediately select a just added tab

      -
      var $tabs = $('#example').tabs({
      -    add: function(event, ui) {
      -        $tabs.tabs('select', '#' + ui.panel.id);
      -    }
      -});
      -

      ...follow a tab's URL instead of loading its content via ajax

      -

      Note that opening a tab in a new window is unexpected, e.g. -inconsistent behaviour exposing a usablity problem (http://www.useit.com/alertbox/tabs.html). -

      -
      $('#example').tabs({
      -    select: function(event, ui) {
      -        var url = $.data(ui.tab, 'load.tabs');
      -        if( url ) {
      -            location.href = url;
      -            return false;
      -        }
      -        return true;
      -    }
      -});
      -


      -

      -

      ...prevent a FOUC (Flash of Unstyled Content) before tabs are initialized

      -

      Add the necessary classes to hide an inactive tab panel to the HTML right away - note that this will not degrade gracefully with JavaScript being disabled: -

      -
      <div id="example" class="ui-tabs">
      -  ...
      -  <div id="a-tab-panel" class="ui-tabs-hide"> </div>
      -  ...
      -</div>
      -

      Why does...

      -

      ...my slider, Google Map, sIFR etc. not work when placed in a hidden (inactive) tab?

      -

      Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via display: none so that any elements inside won't report their actual width and height (0 in most browsers). -

      There's an easy workaround. Use the off-left technique for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with -

      -
      .ui-tabs .ui-tabs-hide {
      -    position: absolute;
      -    left: -10000px;
      -}
      -

      For Google maps you can also resize the map once the tab is displayed like this: -

      -
      $('#example').bind('tabsshow', function(event, ui) {
      -    if (ui.panel.id == "map-tab") {
      -        resizeMap();
      -    }
      -});
      -resizeMap() will call Google Maps' checkResize() on the particular map. -
      -
      -

      Dependencies

      - -
      -
      -

      Example

      -
      - -

      -A simple jQuery UI Tabs.
      -

      -
      $("#tabs").tabs();
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  
      -  <script>
      -  $(document).ready(function() {
      -    $("#tabs").tabs();
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<div id="tabs">
      -    <ul>
      -        <li><a href="#fragment-1"><span>One</span></a></li>
      -        <li><a href="#fragment-2"><span>Two</span></a></li>
      -        <li><a href="#fragment-3"><span>Three</span></a></li>
      -    </ul>
      -    <div id="fragment-1">
      -        <p>First tab is active by default:</p>
      -        <pre><code>$('#example').tabs();</code></pre>
      -    </div>
      -    <div id="fragment-2">
      -        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      -        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      -    </div>
      -    <div id="fragment-3">
      -        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      -        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      -        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      -    </div>
      -</div>
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Options

      -
        - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Disables (true) or enables (false) the tabs. Can be set when initialising (first creating) the tabs.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the disabled option specified. -
        -
        -
        $( ".selector" ).tabs({ disabled: true });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).tabs( "option", "disabled" );
        -//setter
        -$( ".selector" ).tabs( "option", "disabled", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        ajaxOptions

        -
        -
        Type:
        -
        Options
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        Additional Ajax options to consider when loading tab content (see $.ajax).

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the ajaxOptions option specified. -
        -
        -
        $( ".selector" ).tabs({ ajaxOptions: { async: false } });
        -
        - - -
        - Get or set the ajaxOptions option, after init. -
        -
        -
        //getter
        -var ajaxOptions = $( ".selector" ).tabs( "option", "ajaxOptions" );
        -//setter
        -$( ".selector" ).tabs( "option", "ajaxOptions", { async: false } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        cache

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Whether or not to cache remote tabs content, e.g. load only once or with every click. Cached content is being lazy loaded, e.g once and only once for the first click. Note that to prevent the actual Ajax requests from being cached by the browser you need to provide an extra cache: false flag to ajaxOptions.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the cache option specified. -
        -
        -
        $( ".selector" ).tabs({ cache: true });
        -
        - - -
        - Get or set the cache option, after init. -
        -
        -
        //getter
        -var cache = $( ".selector" ).tabs( "option", "cache" );
        -//setter
        -$( ".selector" ).tabs( "option", "cache", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        collapsible

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        Set to true to allow an already selected tab to become unselected again upon reselection.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the collapsible option specified. -
        -
        -
        $( ".selector" ).tabs({ collapsible: true });
        -
        - - -
        - Get or set the collapsible option, after init. -
        -
        -
        //getter
        -var collapsible = $( ".selector" ).tabs( "option", "collapsible" );
        -//setter
        -$( ".selector" ).tabs( "option", "collapsible", true );
        -
        - -
        -
        -
      • - - - - - -
      • -
        -

        deselectable

        -
        -
        Type:
        -
        Boolean
        - -
        Default:
        -
        false
        - -
        -
        -
        -

        deprecated in jQuery UI 1.7, use collapsible.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the deselectable option specified. -
        -
        -
        $( ".selector" ).tabs({ deselectable: true });
        -
        - - -
        - Get or set the deselectable option, after init. -
        -
        -
        //getter
        -var deselectable = $( ".selector" ).tabs( "option", "deselectable" );
        -//setter
        -$( ".selector" ).tabs( "option", "deselectable", true );
        -
        - -
        -
        -
      • - - -
      • -
        -

        disabled

        -
        -
        Type:
        -
        Array<Number>
        - -
        Default:
        -
        []
        - -
        -
        -
        -

        An array containing the position of the tabs (zero-based index) that should be disabled on initialization.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the disabled option specified. -
        -
        -
        $( ".selector" ).tabs({ disabled: [1, 2] });
        -
        - - -
        - Get or set the disabled option, after init. -
        -
        -
        //getter
        -var disabled = $( ".selector" ).tabs( "option", "disabled" );
        -//setter
        -$( ".selector" ).tabs( "option", "disabled", [1, 2] );
        -
        - -
        -
        -
      • - - -
      • -
        -

        event

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'click'
        - -
        -
        -
        -

        The type of event to be used for selecting a tab.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the event option specified. -
        -
        -
        $( ".selector" ).tabs({ event: 'mouseover' });
        -
        - - -
        - Get or set the event option, after init. -
        -
        -
        //getter
        -var event = $( ".selector" ).tabs( "option", "event" );
        -//setter
        -$( ".selector" ).tabs( "option", "event", 'mouseover' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        fx

        -
        -
        Type:
        -
        Options, Array<Options>
        - -
        Default:
        -
        null
        - -
        -
        -
        -

        Enable animations for hiding and showing tab panels. The duration option can be a string representing one of the three predefined speeds ("slow", "normal", "fast") or the duration in milliseconds to run an animation (default is "normal").

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the fx option specified. -
        -
        -
        $( ".selector" ).tabs({ fx: { opacity: 'toggle' } });
        -
        - - -
        - Get or set the fx option, after init. -
        -
        -
        //getter
        -var fx = $( ".selector" ).tabs( "option", "fx" );
        -//setter
        -$( ".selector" ).tabs( "option", "fx", { opacity: 'toggle' } );
        -
        - -
        -
        -
      • - - -
      • -
        -

        idPrefix

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        'ui-tabs-'
        - -
        -
        -
        -

        If the remote tab, its anchor element that is, has no title attribute to generate an id from, an id/fragment identifier is created from this prefix and a unique id returned by $.data(el), for example "ui-tabs-54".

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the idPrefix option specified. -
        -
        -
        $( ".selector" ).tabs({ idPrefix: 'ui-tabs-primary' });
        -
        - - -
        - Get or set the idPrefix option, after init. -
        -
        -
        //getter
        -var idPrefix = $( ".selector" ).tabs( "option", "idPrefix" );
        -//setter
        -$( ".selector" ).tabs( "option", "idPrefix", 'ui-tabs-primary' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        panelTemplate

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        '<div></div>'
        - -
        -
        -
        -

        HTML template from which a new tab panel is created in case of adding a tab with the add method or when creating a panel for a remote tab on the fly.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the panelTemplate option specified. -
        -
        -
        $( ".selector" ).tabs({ panelTemplate: '<li></li>' });
        -
        - - -
        - Get or set the panelTemplate option, after init. -
        -
        -
        //getter
        -var panelTemplate = $( ".selector" ).tabs( "option", "panelTemplate" );
        -//setter
        -$( ".selector" ).tabs( "option", "panelTemplate", '<li></li>' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        selected

        -
        -
        Type:
        -
        Number
        - -
        Default:
        -
        0
        - -
        -
        -
        -

        Zero-based index of the tab to be selected on initialization. To set all tabs to unselected pass -1 as value.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the selected option specified. -
        -
        -
        $( ".selector" ).tabs({ selected: 3 });
        -
        - - -
        - Get or set the selected option, after init. -
        -
        -
        //getter
        -var selected = $( ".selector" ).tabs( "option", "selected" );
        -//setter
        -$( ".selector" ).tabs( "option", "selected", 3 );
        -
        - -
        -
        -
      • - - -
      • -
        -

        spinner

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        '<em>Loading&#8230;</em>'
        - -
        -
        -
        -

        The HTML content of this string is shown in a tab title while remote content is loading. Pass in empty string to deactivate that behavior. An span element must be present in the A tag of the title, for the spinner content to be visible.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the spinner option specified. -
        -
        -
        $( ".selector" ).tabs({ spinner: 'Retrieving data...' });
        -
        - - -
        - Get or set the spinner option, after init. -
        -
        -
        //getter
        -var spinner = $( ".selector" ).tabs( "option", "spinner" );
        -//setter
        -$( ".selector" ).tabs( "option", "spinner", 'Retrieving data...' );
        -
        - -
        -
        -
      • - - -
      • -
        -

        tabTemplate

        -
        -
        Type:
        -
        String
        - -
        Default:
        -
        '<li><a href="#{href}"><span>#{label}</span></a></li>'
        - -
        -
        -
        -

        HTML template from which a new tab is created and added. The placeholders #{href} and #{label} are replaced with the url and tab label that are passed as arguments to the add method.

        -
        -
        -

        Code examples

        -
        - -
        - Initialize a tabs with the tabTemplate option specified. -
        -
        -
        $( ".selector" ).tabs({ tabTemplate: '<div><a href="#{href}"><span>#{label}</span></a></div>' });
        -
        - - -
        - Get or set the tabTemplate option, after init. -
        -
        -
        //getter
        -var tabTemplate = $( ".selector" ).tabs( "option", "tabTemplate" );
        -//setter
        -$( ".selector" ).tabs( "option", "tabTemplate", '<div><a href="#{href}"><span>#{label}</span></a></div>' );
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Events

      -
        - -
      • -
        -

        create

        -
        -
        Type:
        -
        tabscreate
        -
        -
        -
        -

        This event is triggered when tabs is created.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the create event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   create: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the create event by type: tabscreate. -
        -
        -
        $( ".selector" ).bind( "tabscreate", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        select

        -
        -
        Type:
        -
        tabsselect
        -
        -
        -
        -

        This event is triggered when clicking a tab.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the select event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   select: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the select event by type: tabsselect. -
        -
        -
        $( ".selector" ).bind( "tabsselect", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        load

        -
        -
        Type:
        -
        tabsload
        -
        -
        -
        -

        This event is triggered after the content of a remote tab has been loaded.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the load event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   load: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the load event by type: tabsload. -
        -
        -
        $( ".selector" ).bind( "tabsload", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        show

        -
        -
        Type:
        -
        tabsshow
        -
        -
        -
        -

        This event is triggered when a tab is shown.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the show event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   show: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the show event by type: tabsshow. -
        -
        -
        $( ".selector" ).bind( "tabsshow", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        add

        -
        -
        Type:
        -
        tabsadd
        -
        -
        -
        -

        This event is triggered when a tab is added.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the add event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   add: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the add event by type: tabsadd. -
        -
        -
        $( ".selector" ).bind( "tabsadd", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        remove

        -
        -
        Type:
        -
        tabsremove
        -
        -
        -
        -

        This event is triggered when a tab is removed.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the remove event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   remove: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the remove event by type: tabsremove. -
        -
        -
        $( ".selector" ).bind( "tabsremove", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Type:
        -
        tabsenable
        -
        -
        -
        -

        This event is triggered when a tab is enabled.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the enable event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   enable: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the enable event by type: tabsenable. -
        -
        -
        $( ".selector" ).bind( "tabsenable", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Type:
        -
        tabsdisable
        -
        -
        -
        -

        This event is triggered when a tab is disabled.

        -
        -
        -

        Code examples

        -
        - -
        - Supply a callback function to handle the disable event as an init option. -
        -
        -
        $( ".selector" ).tabs({
        -   disable: function(event, ui) { ... }
        -});
        -
        - - -
        - Bind to the disable event by type: tabsdisable. -
        -
        -
        $( ".selector" ).bind( "tabsdisable", function(event, ui) {
        -  ...
        -});
        -
        - -
        -
        -
      • - -
      -
      -
      -

      Methods

      -
        - -
      • -
        -

        destroy

        -
        -
        Signature:
        -
        .tabs( "destroy" - - - - - - - -)
        -
        -
        -
        -

        Remove the tabs functionality completely. This will return the element back to its pre-init state.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .tabs( "disable" - - - - - - - -)
        -
        -
        -
        -

        Disable the tabs.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .tabs( "enable" - - - - - - - -)
        -
        -
        -
        -

        Enable the tabs.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .tabs( "option" - -, optionName - -, [value] - - - -)
        -
        -
        -
        -

        Get or set any tabs option. If no value is specified, will act as a getter.

        -
        -
      • - - -
      • -
        -

        option

        -
        -
        Signature:
        -
        .tabs( "option" - -, options - - - - - -)
        -
        -
        -
        -

        Set multiple tabs options at once by providing an options object.

        -
        -
      • - - -
      • -
        -

        widget

        -
        -
        Signature:
        -
        .tabs( "widget" - - - - - - - -)
        -
        -
        -
        -

        Returns the .ui-tabs element.

        -
        -
      • - - -
      • -
        -

        add

        -
        -
        Signature:
        -
        .tabs( "add" - -, url - -, label - -, [index] - -)
        -
        -
        -
        -

        Add a new tab. The second argument is either a URL consisting of a fragment identifier only to create an in-page tab or a full url (relative or absolute, no cross-domain support) to turn the new tab into an Ajax (remote) tab. The third is the zero-based position where to insert the new tab. Optional, by default a new tab is appended at the end.

        -
        -
      • - - -
      • -
        -

        remove

        -
        -
        Signature:
        -
        .tabs( "remove" - -, index - - - - - -)
        -
        -
        -
        -

        Remove a tab. The second argument is the zero-based index of the tab to be removed.

        -
        -
      • - - -
      • -
        -

        enable

        -
        -
        Signature:
        -
        .tabs( "enable" - -, index - - - - - -)
        -
        -
        -
        -

        Enable a disabled tab. To enable more than one tab at once reset the disabled property like: $('#example').tabs("option","disabled",[]);. The second argument is the zero-based index of the tab to be enabled.

        -
        -
      • - - -
      • -
        -

        disable

        -
        -
        Signature:
        -
        .tabs( "disable" - -, index - - - - - -)
        -
        -
        -
        -

        Disable a tab. The selected tab cannot be disabled. To disable more than one tab at once use: $('#example').tabs("option","disabled", [1, 2, 3]); The second argument is the zero-based index of the tab to be disabled.

        -
        -
      • - - -
      • -
        -

        select

        -
        -
        Signature:
        -
        .tabs( "select" - -, index - - - - - -)
        -
        -
        -
        -

        Select a tab, as if it were clicked. The second argument is the zero-based index of the tab to be selected or the id selector of the panel the tab is associated with (the tab's href fragment identifier, e.g. hash, points to the panel's id).

        -
        -
      • - - -
      • -
        -

        load

        -
        -
        Signature:
        -
        .tabs( "load" - -, index - - - - - -)
        -
        -
        -
        -

        Reload the content of an Ajax tab programmatically. This method always loads the tab content from the remote location, even if cache is set to true. The second argument is the zero-based index of the tab to be reloaded.

        -
        -
      • - - -
      • -
        -

        url

        -
        -
        Signature:
        -
        .tabs( "url" - -, index - -, url - - - -)
        -
        -
        -
        -

        Change the url from which an Ajax (remote) tab will be loaded. The specified URL will be used for subsequent loads. Note that you can not only change the URL for an existing remote tab with this method, but also turn an in-page tab into a remote tab. The second argument is the zero-based index of the tab of which its URL is to be updated. The third is a URL the content of the tab is loaded from.

        -
        -
      • - - -
      • -
        -

        length

        -
        -
        Signature:
        -
        .tabs( "length" - - - - - - - -)
        -
        -
        -
        -

        Retrieve the number of tabs of the first matched tab pane.

        -
        -
      • - - -
      • -
        -

        abort

        -
        -
        Signature:
        -
        .tabs( "abort" - - - - - - - -)
        -
        -
        -
        -

        Terminate all running tab ajax requests and animations.

        -
        -
      • - - -
      • -
        -

        rotate

        -
        -
        Signature:
        -
        .tabs( "rotate" - -, ms - -, [continuing] - - - -)
        -
        -
        -
        -

        Set up an automatic rotation through tabs of a tab pane. The second argument is an amount of time in milliseconds until the next tab in the cycle gets activated. Use 0 or null to stop the rotation. The third controls whether or not to continue the rotation after a tab has been selected by a user. Default: false.

        -
        -
      • - -
      -
      -
      -

      Theming

      -

      The jQuery UI Tabs plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. -

      -

      If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.tabs.css stylesheet that can be modified. These classes are highlighed in bold below. -

      - -

      Sample markup with jQuery UI CSS Framework classes

      - <div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
      -   <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
      -     <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Nunc tincidunt</a></li>
      -      <li class="ui-state-default ui-corner-top"><a href="#tabs-2">Proin dolor</a></li>
      -   <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tabs-1">
      -      <p>Tab one content goes here.</p>
      -   </div>
      -    ...
      -</div>
      -

      - - Note: This is a sample of markup generated by the tabs plugin, not markup you should use to create a tabs. The only markup needed for that is
      <div id="tabs">
      -   <ul>
      -      <li><a href="#tabs-1">Nunc tincidunt</a></li>
      -      <li><a href="#tabs-2">Proin dolor</a></li>
      -      <li><a href="#tabs-3">Aenean lacinia</a></li>
      -   </ul>
      -   <div id="tabs-1">
      -      <p>Tab 1 content</p>
      -   </div>
      -   <div id="tabs-2">
      -      <p>Tab 2 content</p>
      -   </div>
      -   <div id="tabs-3">
      -      <p>Tab 3 content</p>
      -   </div>
      -</div>. -
      -

      - -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggle.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggle.html deleted file mode 100644 index 26c792cfb9..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggle.html +++ /dev/null @@ -1,144 +0,0 @@ - - -
      -

      jQuery UI toggle

      -
      -

      Overview

      -
      -

      toggle( effect, [options], [speed], [callback] )

      -

      The enhanced toggle method optionally accepts jQuery UI advanced effects.

      -

      Uses a specific effect on an element to toggle the element if the first argument is an effect string.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Apply the effect slide if you click on the p to toggle a div.
      -

      -
      $("p").click(function () {
      -      $("div").toggle("slide", {}, 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<script src="http://ui.jquery.com/latest/ui/effects.slide.js"></script>
      -<style type="text/css">
      -  div { display: none; margin: 0px; width: 100px; height: 80px; background: blue; position: relative; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $("div").toggle("slide", {}, 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p>Click me</p><div></div>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        effect

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.

        -
        -
      • - - -
      • -
        -

        options

        -
        -
        Type:
        -
        Hash
        - -
        Optional
        - -
        -
        -
        -

        A object/hash including specific options for the effect.

        -
        -
      • - - -
      • -
        -

        speed

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the predefined speeds ("slow" or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - - -
      • -
        -

        callback

        -
        -
        Type:
        -
        Function
        - -
        Optional
        - -
        -
        -
        -

        A function that is called after the effect is completed.

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggleClass.html b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggleClass.html deleted file mode 100644 index d1b45d43ae..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/docs/toggleClass.html +++ /dev/null @@ -1,111 +0,0 @@ - - -
      -

      jQuery UI toggleClass

      -
      -

      Overview

      -
      -

      toggleClass( class, [duration] )

      -

      Adds the specified class if it is not present, and removes the specified class if it is present, using an optional transition.

      -
      -
      -

      Dependencies

      -
        -
      • Effects Core
      • -
      -
      -
      -

      Example

      -
      - -

      -Adds the 'selected' class if it is not present, and removes the 'selected' class if it is present.
      -

      -
      $("p").click(function () {
      -      $(this).toggleClass("selected", 1000);
      -    });
      -
      -

      -

      -
      <!DOCTYPE html>
      -<html>
      -<head>
      -  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      -  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      -  <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
      -<style type="text/css">
      -  p { cursor: pointer; font-size: 1.2em; }
      -  .selected { color:red; }
      -</style>
      -  <script>
      -  $(document).ready(function() {
      -    $("p").click(function () {
      -      $(this).toggleClass("selected", 1000);
      -    });
      -  });
      -  </script>
      -</head>
      -<body style="font-size:62.5%;">
      -  
      -<p>Click me to toggle 'selected' class.</p>
      -<p class="selected">Click me to toggle 'selected' class.</p>
      -<p>Click me to toggle 'selected' class.</p>
      -
      -</body>
      -</html>
      -
      -

      -

      -
      -
      -
      -

      Arguments

      -
        - -
      • -
        -

        class

        -
        -
        Type:
        -
        String
        - -
        -
        -
        -

        A CSS class to toggle on the elements.

        -
        -
      • - - -
      • -
        -

        duration

        -
        -
        Type:
        -
        String, Number
        - -
        Optional
        - -
        -
        -
        -

        A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

        -
        -
      • - -
      -
      -
      - -

      - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/external/jquery.bgiframe-2.1.2.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/external/jquery.bgiframe-2.1.2.js deleted file mode 100644 index 5cd38bb1d1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/external/jquery.bgiframe-2.1.2.js +++ /dev/null @@ -1,39 +0,0 @@ -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Version 2.1.2 - */ - -(function($){ - -$.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) { - s = $.extend({ - top : 'auto', // auto == .currentStyle.borderTopWidth - left : 'auto', // auto == .currentStyle.borderLeftWidth - width : 'auto', // auto == offsetWidth - height : 'auto', // auto == offsetHeight - opacity : true, - src : 'javascript:false;' - }, s); - var html = '' : ''); - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '
      '; - var monthHtml = ''; - // month selection - if (secondary || !changeMonth) - monthHtml += '' + monthNames[drawMonth] + ''; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += ''; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); - // year selection - if ( !inst.yearshtml ) { - inst.yearshtml = ''; - if (secondary || !changeYear) - html += '' + drawYear + ''; - else { - // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ''; - //when showing there is no need for later update - if( ! $.browser.mozilla ){ - html += inst.yearshtml; - inst.yearshtml = null; - } else { - // will be replaced later with inst.yearshtml - html += ''; - } - } - } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '
      '; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') - this._notifyChange(inst); - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var newDate = (minDate && date < minDate ? minDate : date); - newDate = (maxDate && newDate > maxDate ? maxDate : newDate); - return newDate; - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day == 'object' ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); - } -}); - -/* jQuery extend now ignores nulls! */ -function extendRemove(target, props) { - $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) - target[name] = props[name]; - return target; -}; - -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - -/* Invoke the datepicker functionality. - @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality - @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Verify an empty collection wasn't passed - Fixes #6976 */ - if ( !this.length ) { - return this; - } - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); - $.datepicker.initialized = true; - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.12"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; - -})(jQuery); -/* - * jQuery UI Progressbar 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget( "ui.progressbar", { - options: { - value: 0, - max: 100 - }, - - min: 0, - - _create: function() { - this.element - .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .attr({ - role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() - }); - - this.valueDiv = $( "
      " ) - .appendTo( this.element ); - - this.oldValue = this._value(); - this._refreshValue(); - }, - - destroy: function() { - this.element - .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .removeAttr( "role" ) - .removeAttr( "aria-valuemin" ) - .removeAttr( "aria-valuemax" ) - .removeAttr( "aria-valuenow" ); - - this.valueDiv.remove(); - - $.Widget.prototype.destroy.apply( this, arguments ); - }, - - value: function( newValue ) { - if ( newValue === undefined ) { - return this._value(); - } - - this._setOption( "value", newValue ); - return this; - }, - - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; - } - return Math.min( this.options.max, Math.max( this.min, val ) ); - }, - - _percentage: function() { - return 100 * this._value() / this.options.max; - }, - - _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); - - if ( this.oldValue !== value ) { - this.oldValue = value; - this._trigger( "change" ); - } - - this.valueDiv - .toggle( value > this.min ) - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); - } -}); - -$.extend( $.ui.progressbar, { - version: "1.8.12" -}); - -})( jQuery ); -/* - * jQuery UI Effects 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -;jQuery.effects || (function($, undefined) { - -$.effects = {}; - - - -/******************************************************************************/ -/****************************** COLOR ANIMATIONS ******************************/ -/******************************************************************************/ - -// override the animation for color styles -$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', - 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'], -function(i, attr) { - $.fx.step[attr] = function(fx) { - if (!fx.colorInit) { - fx.start = getColor(fx.elem, attr); - fx.end = getRGB(fx.end); - fx.colorInit = true; - } - - fx.elem.style[attr] = 'rgb(' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')'; - }; -}); - -// Color Conversion functions from highlightFade -// By Blair Mitchelmore -// http://jquery.offput.ca/highlightFade/ - -// Parse strings looking for color tuples [255,255,255] -function getRGB(color) { - var result; - - // Check if we're already dealing with an array of colors - if ( color && color.constructor == Array && color.length == 3 ) - return color; - - // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; - - // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; - - // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; - - // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; - - // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 - if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) - return colors['transparent']; - - // Otherwise, we're most likely dealing with a named color - return colors[$.trim(color).toLowerCase()]; -} - -function getColor(elem, attr) { - var color; - - do { - color = $.curCSS(elem, attr); - - // Keep going until we find an element that has color, or we hit the body - if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) - break; - - attr = "backgroundColor"; - } while ( elem = elem.parentNode ); - - return getRGB(color); -}; - -// Some named colors to work with -// From Interface by Stefan Petre -// http://interface.eyecon.ro/ - -var colors = { - aqua:[0,255,255], - azure:[240,255,255], - beige:[245,245,220], - black:[0,0,0], - blue:[0,0,255], - brown:[165,42,42], - cyan:[0,255,255], - darkblue:[0,0,139], - darkcyan:[0,139,139], - darkgrey:[169,169,169], - darkgreen:[0,100,0], - darkkhaki:[189,183,107], - darkmagenta:[139,0,139], - darkolivegreen:[85,107,47], - darkorange:[255,140,0], - darkorchid:[153,50,204], - darkred:[139,0,0], - darksalmon:[233,150,122], - darkviolet:[148,0,211], - fuchsia:[255,0,255], - gold:[255,215,0], - green:[0,128,0], - indigo:[75,0,130], - khaki:[240,230,140], - lightblue:[173,216,230], - lightcyan:[224,255,255], - lightgreen:[144,238,144], - lightgrey:[211,211,211], - lightpink:[255,182,193], - lightyellow:[255,255,224], - lime:[0,255,0], - magenta:[255,0,255], - maroon:[128,0,0], - navy:[0,0,128], - olive:[128,128,0], - orange:[255,165,0], - pink:[255,192,203], - purple:[128,0,128], - violet:[128,0,128], - red:[255,0,0], - silver:[192,192,192], - white:[255,255,255], - yellow:[255,255,0], - transparent: [255,255,255] -}; - - - -/******************************************************************************/ -/****************************** CLASS ANIMATIONS ******************************/ -/******************************************************************************/ - -var classAnimationActions = ['add', 'remove', 'toggle'], - shorthandStyles = { - border: 1, - borderBottom: 1, - borderColor: 1, - borderLeft: 1, - borderRight: 1, - borderTop: 1, - borderWidth: 1, - margin: 1, - padding: 1 - }; - -function getElementStyles() { - var style = document.defaultView - ? document.defaultView.getComputedStyle(this, null) - : this.currentStyle, - newStyle = {}, - key, - camelCase; - - // webkit enumerates style porperties - if (style && style.length && style[0] && style[style[0]]) { - var len = style.length; - while (len--) { - key = style[len]; - if (typeof style[key] == 'string') { - camelCase = key.replace(/\-(\w)/g, function(all, letter){ - return letter.toUpperCase(); - }); - newStyle[camelCase] = style[key]; - } - } - } else { - for (key in style) { - if (typeof style[key] === 'string') { - newStyle[key] = style[key]; - } - } - } - - return newStyle; -} - -function filterStyles(styles) { - var name, value; - for (name in styles) { - value = styles[name]; - if ( - // ignore null and undefined values - value == null || - // ignore functions (when does this occur?) - $.isFunction(value) || - // shorthand styles that need to be expanded - name in shorthandStyles || - // ignore scrollbars (break in IE) - (/scrollbar/).test(name) || - - // only colors or values that can be converted to numbers - (!(/color/i).test(name) && isNaN(parseFloat(value))) - ) { - delete styles[name]; - } - } - - return styles; -} - -function styleDifference(oldStyle, newStyle) { - var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459 - name; - - for (name in newStyle) { - if (oldStyle[name] != newStyle[name]) { - diff[name] = newStyle[name]; - } - } - - return diff; -} - -$.effects.animateClass = function(value, duration, easing, callback) { - if ($.isFunction(easing)) { - callback = easing; - easing = null; - } - - return this.queue('fx', function() { - var that = $(this), - originalStyleAttr = that.attr('style') || ' ', - originalStyle = filterStyles(getElementStyles.call(this)), - newStyle, - className = that.attr('className'); - - $.each(classAnimationActions, function(i, action) { - if (value[action]) { - that[action + 'Class'](value[action]); - } - }); - newStyle = filterStyles(getElementStyles.call(this)); - that.attr('className', className); - - that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() { - $.each(classAnimationActions, function(i, action) { - if (value[action]) { that[action + 'Class'](value[action]); } - }); - // work around bug in IE by clearing the cssText before setting it - if (typeof that.attr('style') == 'object') { - that.attr('style').cssText = ''; - that.attr('style').cssText = originalStyleAttr; - } else { - that.attr('style', originalStyleAttr); - } - if (callback) { callback.apply(this, arguments); } - }); - - // $.animate adds a function to the end of the queue - // but we want it at the front - var queue = $.queue(this), - anim = queue.splice(queue.length - 1, 1)[0]; - queue.splice(1, 0, anim); - $.dequeue(this); - }); -}; - -$.fn.extend({ - _addClass: $.fn.addClass, - addClass: function(classNames, speed, easing, callback) { - return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); - }, - - _removeClass: $.fn.removeClass, - removeClass: function(classNames,speed,easing,callback) { - return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); - }, - - _toggleClass: $.fn.toggleClass, - toggleClass: function(classNames, force, speed, easing, callback) { - if ( typeof force == "boolean" || force === undefined ) { - if ( !speed ) { - // without speed parameter; - return this._toggleClass(classNames, force); - } else { - return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); - } - } else { - // without switch parameter; - return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); - } - }, - - switchClass: function(remove,add,speed,easing,callback) { - return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); - } -}); - - - -/******************************************************************************/ -/*********************************** EFFECTS **********************************/ -/******************************************************************************/ - -$.extend($.effects, { - version: "1.8.12", - - // Saves a set of properties in a data storage - save: function(element, set) { - for(var i=0; i < set.length; i++) { - if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); - } - }, - - // Restores a set of previously saved properties from a data storage - restore: function(element, set) { - for(var i=0; i < set.length; i++) { - if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); - } - }, - - setMode: function(el, mode) { - if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle - return mode; - }, - - getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value - // this should be a little more flexible in the future to handle a string & hash - var y, x; - switch (origin[0]) { - case 'top': y = 0; break; - case 'middle': y = 0.5; break; - case 'bottom': y = 1; break; - default: y = origin[0] / original.height; - }; - switch (origin[1]) { - case 'left': x = 0; break; - case 'center': x = 0.5; break; - case 'right': x = 1; break; - default: x = origin[1] / original.width; - }; - return {x: x, y: y}; - }, - - // Wraps the element around a wrapper that copies position properties - createWrapper: function(element) { - - // if the element is already wrapped, return it - if (element.parent().is('.ui-effects-wrapper')) { - return element.parent(); - } - - // wrap the element - var props = { - width: element.outerWidth(true), - height: element.outerHeight(true), - 'float': element.css('float') - }, - wrapper = $('
      ') - .addClass('ui-effects-wrapper') - .css({ - fontSize: '100%', - background: 'transparent', - border: 'none', - margin: 0, - padding: 0 - }); - - element.wrap(wrapper); - wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element - - // transfer positioning properties to the wrapper - if (element.css('position') == 'static') { - wrapper.css({ position: 'relative' }); - element.css({ position: 'relative' }); - } else { - $.extend(props, { - position: element.css('position'), - zIndex: element.css('z-index') - }); - $.each(['top', 'left', 'bottom', 'right'], function(i, pos) { - props[pos] = element.css(pos); - if (isNaN(parseInt(props[pos], 10))) { - props[pos] = 'auto'; - } - }); - element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' }); - } - - return wrapper.css(props).show(); - }, - - removeWrapper: function(element) { - if (element.parent().is('.ui-effects-wrapper')) - return element.parent().replaceWith(element); - return element; - }, - - setTransition: function(element, list, factor, value) { - value = value || {}; - $.each(list, function(i, x){ - unit = element.cssUnit(x); - if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; - }); - return value; - } -}); - - -function _normalizeArguments(effect, options, speed, callback) { - // shift params for method overloading - if (typeof effect == 'object') { - callback = options; - speed = null; - options = effect; - effect = options.effect; - } - if ($.isFunction(options)) { - callback = options; - speed = null; - options = {}; - } - if (typeof options == 'number' || $.fx.speeds[options]) { - callback = speed; - speed = options; - options = {}; - } - if ($.isFunction(speed)) { - callback = speed; - speed = null; - } - - options = options || {}; - - speed = speed || options.duration; - speed = $.fx.off ? 0 : typeof speed == 'number' - ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default; - - callback = callback || options.complete; - - return [effect, options, speed, callback]; -} - -function standardSpeed( speed ) { - // valid standard speeds - if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { - return true; - } - - // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects[ speed ] ) { - return true; - } - - return false; -} - -$.fn.extend({ - effect: function(effect, options, speed, callback) { - var args = _normalizeArguments.apply(this, arguments), - // TODO: make effects take actual parameters instead of a hash - args2 = { - options: args[1], - duration: args[2], - callback: args[3] - }, - mode = args2.options.mode, - effectMethod = $.effects[effect]; - - if ( $.fx.off || !effectMethod ) { - // delegate to the original method (e.g., .show()) if possible - if ( mode ) { - return this[ mode ]( args2.duration, args2.callback ); - } else { - return this.each(function() { - if ( args2.callback ) { - args2.callback.call( this ); - } - }); - } - } - - return effectMethod.call(this, args2); - }, - - _show: $.fn.show, - show: function(speed) { - if ( standardSpeed( speed ) ) { - return this._show.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'show'; - return this.effect.apply(this, args); - } - }, - - _hide: $.fn.hide, - hide: function(speed) { - if ( standardSpeed( speed ) ) { - return this._hide.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'hide'; - return this.effect.apply(this, args); - } - }, - - // jQuery core overloads toggle and creates _toggle - __toggle: $.fn.toggle, - toggle: function(speed) { - if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { - return this.__toggle.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'toggle'; - return this.effect.apply(this, args); - } - }, - - // helper functions - cssUnit: function(key) { - var style = this.css(key), val = []; - $.each( ['em','px','%','pt'], function(i, unit){ - if(style.indexOf(unit) > 0) - val = [parseFloat(style), unit]; - }); - return val; - } -}); - - - -/******************************************************************************/ -/*********************************** EASING ***********************************/ -/******************************************************************************/ - -/* - * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ - * - * Uses the built in easing capabilities added In jQuery 1.1 - * to offer multiple easing options - * - * TERMS OF USE - jQuery Easing - * - * Open source under the BSD License. - * - * Copyright 2008 George McGinley Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * -*/ - -// t: current time, b: begInnIng value, c: change In value, d: duration -$.easing.jswing = $.easing.swing; - -$.extend($.easing, -{ - def: 'easeOutQuad', - swing: function (x, t, b, c, d) { - //alert($.easing.default); - return $.easing[$.easing.def](x, t, b, c, d); - }, - easeInQuad: function (x, t, b, c, d) { - return c*(t/=d)*t + b; - }, - easeOutQuad: function (x, t, b, c, d) { - return -c *(t/=d)*(t-2) + b; - }, - easeInOutQuad: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t + b; - return -c/2 * ((--t)*(t-2) - 1) + b; - }, - easeInCubic: function (x, t, b, c, d) { - return c*(t/=d)*t*t + b; - }, - easeOutCubic: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t + 1) + b; - }, - easeInOutCubic: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; - }, - easeInQuart: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t + b; - }, - easeOutQuart: function (x, t, b, c, d) { - return -c * ((t=t/d-1)*t*t*t - 1) + b; - }, - easeInOutQuart: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t + b; - return -c/2 * ((t-=2)*t*t*t - 2) + b; - }, - easeInQuint: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t*t + b; - }, - easeOutQuint: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t*t*t + 1) + b; - }, - easeInOutQuint: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; - return c/2*((t-=2)*t*t*t*t + 2) + b; - }, - easeInSine: function (x, t, b, c, d) { - return -c * Math.cos(t/d * (Math.PI/2)) + c + b; - }, - easeOutSine: function (x, t, b, c, d) { - return c * Math.sin(t/d * (Math.PI/2)) + b; - }, - easeInOutSine: function (x, t, b, c, d) { - return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; - }, - easeInExpo: function (x, t, b, c, d) { - return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; - }, - easeOutExpo: function (x, t, b, c, d) { - return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; - }, - easeInOutExpo: function (x, t, b, c, d) { - if (t==0) return b; - if (t==d) return b+c; - if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; - return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; - }, - easeInCirc: function (x, t, b, c, d) { - return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; - }, - easeOutCirc: function (x, t, b, c, d) { - return c * Math.sqrt(1 - (t=t/d-1)*t) + b; - }, - easeInOutCirc: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; - return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; - }, - easeInElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - }, - easeOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; - }, - easeInOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; - }, - easeInBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*(t/=d)*t*((s+1)*t - s) + b; - }, - easeOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; - }, - easeInOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; - return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; - }, - easeInBounce: function (x, t, b, c, d) { - return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; - }, - easeOutBounce: function (x, t, b, c, d) { - if ((t/=d) < (1/2.75)) { - return c*(7.5625*t*t) + b; - } else if (t < (2/2.75)) { - return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; - } else if (t < (2.5/2.75)) { - return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; - } else { - return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; - } - }, - easeInOutBounce: function (x, t, b, c, d) { - if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; - return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; - } -}); - -/* - * - * TERMS OF USE - EASING EQUATIONS - * - * Open source under the BSD License. - * - * Copyright 2001 Robert Penner - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -})(jQuery); -/* - * jQuery UI Effects Blind 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Blind - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.blind = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'vertical') ? 'height' : 'width'; - var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); - if(mode == 'show') wrapper.css(ref, 0); // Shift - - // Animation - var animation = {}; - animation[ref] = mode == 'show' ? distance : 0; - - // Animate - wrapper.animate(animation, o.duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Bounce 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Bounce - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.bounce = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'up'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 5; // Default # of times - var speed = o.duration || 250; // Default speed per bounce - if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - if (mode == 'hide') distance = distance / (times * 2); - if (mode != 'hide') times--; - - // Animate - if (mode == 'show') { // Show Bounce - var animation = {opacity: 1}; - animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation, speed / 2, o.options.easing); - distance = distance / 2; - times--; - }; - for (var i = 0; i < times; i++) { // Bounces - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); - distance = (mode == 'hide') ? distance * 2 : distance / 2; - }; - if (mode == 'hide') { // Last Bounce - var animation = {opacity: 0}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - el.animate(animation, speed / 2, o.options.easing, function(){ - el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - } else { - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - }; - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Clip 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Clip - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.clip = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','height','width']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var animate = el[0].tagName == 'IMG' ? wrapper : el; - var ref = { - size: (direction == 'vertical') ? 'height' : 'width', - position: (direction == 'vertical') ? 'top' : 'left' - }; - var distance = (direction == 'vertical') ? animate.height() : animate.width(); - if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift - - // Animation - var animation = {}; - animation[ref.size] = mode == 'show' ? distance : 0; - animation[ref.position] = mode == 'show' ? 0 : distance / 2; - - // Animate - animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Drop 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Drop - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.drop = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','opacity']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - - // Animation - var animation = {opacity: mode == 'show' ? 1 : 0}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Explode 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Explode - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.explode = function(o) { - - return this.queue(function() { - - var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - - o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; - var el = $(this).show().css('visibility', 'hidden'); - var offset = el.offset(); - - //Substract the margins - not fixing the problem yet. - offset.top -= parseInt(el.css("marginTop"),10) || 0; - offset.left -= parseInt(el.css("marginLeft"),10) || 0; - - var width = el.outerWidth(true); - var height = el.outerHeight(true); - - for(var i=0;i') - .css({ - position: 'absolute', - visibility: 'visible', - left: -j*(width/cells), - top: -i*(height/rows) - }) - .parent() - .addClass('ui-effects-explode') - .css({ - position: 'absolute', - overflow: 'hidden', - width: width/cells, - height: height/rows, - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), - opacity: o.options.mode == 'show' ? 0 : 1 - }).animate({ - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), - opacity: o.options.mode == 'show' ? 1 : 0 - }, o.duration || 500); - } - } - - // Set a timeout, to call the callback approx. when the other animations have finished - setTimeout(function() { - - o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); - if(o.callback) o.callback.apply(el[0]); // Callback - el.dequeue(); - - $('div.ui-effects-explode').remove(); - - }, o.duration || 500); - - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Fade 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.fade = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'); - - elem.animate({ opacity: mode }, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); -/* - * jQuery UI Effects Fold 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.fold = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var size = o.options.size || 15; // Default fold size - var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value - var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var widthFirst = ((mode == 'show') != horizFirst); - var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; - var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; - var percent = /([0-9]+)%/.exec(size); - if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; - if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift - - // Animation - var animation1 = {}, animation2 = {}; - animation1[ref[0]] = mode == 'show' ? distance[0] : size; - animation2[ref[1]] = mode == 'show' ? distance[1] : 0; - - // Animate - wrapper.animate(animation1, duration, o.options.easing) - .animate(animation2, duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Highlight 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.highlight = function(o) { - return this.queue(function() { - var elem = $(this), - props = ['backgroundImage', 'backgroundColor', 'opacity'], - mode = $.effects.setMode(elem, o.options.mode || 'show'), - animation = { - backgroundColor: elem.css('backgroundColor') - }; - - if (mode == 'hide') { - animation.opacity = 0; - } - - $.effects.save(elem, props); - elem - .show() - .css({ - backgroundImage: 'none', - backgroundColor: o.options.color || '#ffff99' - }) - .animate(animation, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (mode == 'hide' && elem.hide()); - $.effects.restore(elem, props); - (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter')); - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); -/* - * jQuery UI Effects Pulsate 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.pulsate = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'show'); - times = ((o.options.times || 5) * 2) - 1; - duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2, - isVisible = elem.is(':visible'), - animateTo = 0; - - if (!isVisible) { - elem.css('opacity', 0).show(); - animateTo = 1; - } - - if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { - times--; - } - - for (var i = 0; i < times; i++) { - elem.animate({ opacity: animateTo }, duration, o.options.easing); - animateTo = (animateTo + 1) % 2; - } - - elem.animate({ opacity: animateTo }, duration, o.options.easing, function() { - if (animateTo == 0) { - elem.hide(); - } - (o.callback && o.callback.apply(this, arguments)); - }); - - elem - .queue('fx', function() { elem.dequeue(); }) - .dequeue(); - }); -}; - -})(jQuery); -/* - * jQuery UI Effects Scale 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Scale - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.puff = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'), - percent = parseInt(o.options.percent, 10) || 150, - factor = percent / 100, - original = { height: elem.height(), width: elem.width() }; - - $.extend(o.options, { - fade: true, - mode: mode, - percent: mode == 'hide' ? percent : 100, - from: mode == 'hide' - ? original - : { - height: original.height * factor, - width: original.width * factor - } - }); - - elem.effect('scale', o.options, o.duration, o.callback); - elem.dequeue(); - }); -}; - -$.effects.scale = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this); - - // Set options - var options = $.extend(true, {}, o.options); - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent - var direction = o.options.direction || 'both'; // Set default axis - var origin = o.options.origin; // The origin of the scaling - if (mode != 'effect') { // Set default origin and restore for show/hide - options.origin = origin || ['middle','center']; - options.restore = true; - } - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state - - // Adjust - var factor = { // Set scaling factor - y: direction != 'horizontal' ? (percent / 100) : 1, - x: direction != 'vertical' ? (percent / 100) : 1 - }; - el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state - - if (o.options.fade) { // Fade option to support puff - if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; - if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; - }; - - // Animation - options.from = el.from; options.to = el.to; options.mode = mode; - - // Animate - el.effect('size', options, o.duration, o.callback); - el.dequeue(); - }); - -}; - -$.effects.size = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity']; - var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore - var props2 = ['width','height','overflow']; // Copy for children - var cProps = ['fontSize']; - var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; - var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var restore = o.options.restore || false; // Default restore - var scale = o.options.scale || 'both'; // Default scale mode - var origin = o.options.origin; // The origin of the sizing - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || original; // Default from state - el.to = o.options.to || original; // Default to state - // Adjust - if (origin) { // Calculate baseline shifts - var baseline = $.effects.getBaseline(origin, original); - el.from.top = (original.height - el.from.height) * baseline.y; - el.from.left = (original.width - el.from.width) * baseline.x; - el.to.top = (original.height - el.to.height) * baseline.y; - el.to.left = (original.width - el.to.width) * baseline.x; - }; - var factor = { // Set scaling factor - from: {y: el.from.height / original.height, x: el.from.width / original.width}, - to: {y: el.to.height / original.height, x: el.to.width / original.width} - }; - if (scale == 'box' || scale == 'both') { // Scale the css box - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(vProps); - el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - props = props.concat(hProps); - el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); - el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); - }; - }; - if (scale == 'content' || scale == 'both') { // Scale the content - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(cProps); - el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); - }; - }; - $.effects.save(el, restore ? props : props1); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - el.css('overflow','hidden').css(el.from); // Shift - - // Animate - if (scale == 'content' || scale == 'both') { // Scale the children - vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size - hProps = hProps.concat(['marginLeft','marginRight']); // Add margins - props2 = props.concat(vProps).concat(hProps); // Concat - el.find("*[width]").each(function(){ - child = $(this); - if (restore) $.effects.save(child, props2); - var c_original = {height: child.height(), width: child.width()}; // Save original - child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; - child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; - if (factor.from.y != factor.to.y) { // Vertical props scaling - child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); - child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); - child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); - }; - child.css(child.from); // Shift children - child.animate(child.to, o.duration, o.options.easing, function(){ - if (restore) $.effects.restore(child, props2); // Restore children - }); // Animate children - }); - }; - - // Animate - el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if (el.to.opacity === 0) { - el.css('opacity', el.from.opacity); - } - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Shake 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Shake - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.shake = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'left'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 3; // Default # of times - var speed = o.duration || o.options.duration || 140; // Default speed per shake - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - - // Animation - var animation = {}, animation1 = {}, animation2 = {}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; - animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; - - // Animate - el.animate(animation, speed, o.options.easing); - for (var i = 1; i < times; i++) { // Shakes - el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); - }; - el.animate(animation1, speed, o.options.easing). - animate(animation, speed / 2, o.options.easing, function(){ // Last shake - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Slide 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Slide - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.slide = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); - if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift - - // Animation - var animation = {}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); -/* - * jQuery UI Effects Transfer 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Transfer - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.transfer = function(o) { - return this.queue(function() { - var elem = $(this), - target = $(o.options.to), - endPosition = target.offset(), - animation = { - top: endPosition.top, - left: endPosition.left, - height: target.innerHeight(), - width: target.innerWidth() - }, - startPosition = elem.offset(), - transfer = $('
      ') - .appendTo(document.body) - .addClass(o.options.className) - .css({ - top: startPosition.top, - left: startPosition.left, - height: elem.innerHeight(), - width: elem.innerWidth(), - position: 'absolute' - }) - .animate(animation, o.duration, o.options.easing, function() { - transfer.remove(); - (o.callback && o.callback.apply(elem[0], arguments)); - elem.dequeue(); - }); - }); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.blind.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.blind.js deleted file mode 100644 index be9e4dd18d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.blind.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * jQuery UI Effects Blind 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Blind - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.blind = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'vertical') ? 'height' : 'width'; - var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); - if(mode == 'show') wrapper.css(ref, 0); // Shift - - // Animation - var animation = {}; - animation[ref] = mode == 'show' ? distance : 0; - - // Animate - wrapper.animate(animation, o.duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.bounce.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.bounce.js deleted file mode 100644 index 4e27b51597..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.bounce.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * jQuery UI Effects Bounce 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Bounce - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.bounce = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'up'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 5; // Default # of times - var speed = o.duration || 250; // Default speed per bounce - if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - if (mode == 'hide') distance = distance / (times * 2); - if (mode != 'hide') times--; - - // Animate - if (mode == 'show') { // Show Bounce - var animation = {opacity: 1}; - animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation, speed / 2, o.options.easing); - distance = distance / 2; - times--; - }; - for (var i = 0; i < times; i++) { // Bounces - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); - distance = (mode == 'hide') ? distance * 2 : distance / 2; - }; - if (mode == 'hide') { // Last Bounce - var animation = {opacity: 0}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - el.animate(animation, speed / 2, o.options.easing, function(){ - el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - } else { - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - }; - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.clip.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.clip.js deleted file mode 100644 index 71493c0731..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.clip.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * jQuery UI Effects Clip 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Clip - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.clip = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','height','width']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var animate = el[0].tagName == 'IMG' ? wrapper : el; - var ref = { - size: (direction == 'vertical') ? 'height' : 'width', - position: (direction == 'vertical') ? 'top' : 'left' - }; - var distance = (direction == 'vertical') ? animate.height() : animate.width(); - if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift - - // Animation - var animation = {}; - animation[ref.size] = mode == 'show' ? distance : 0; - animation[ref.position] = mode == 'show' ? 0 : distance / 2; - - // Animate - animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.core.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.core.js deleted file mode 100644 index 5c63352332..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.core.js +++ /dev/null @@ -1,747 +0,0 @@ -/* - * jQuery UI Effects 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -;jQuery.effects || (function($, undefined) { - -$.effects = {}; - - - -/******************************************************************************/ -/****************************** COLOR ANIMATIONS ******************************/ -/******************************************************************************/ - -// override the animation for color styles -$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', - 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'], -function(i, attr) { - $.fx.step[attr] = function(fx) { - if (!fx.colorInit) { - fx.start = getColor(fx.elem, attr); - fx.end = getRGB(fx.end); - fx.colorInit = true; - } - - fx.elem.style[attr] = 'rgb(' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')'; - }; -}); - -// Color Conversion functions from highlightFade -// By Blair Mitchelmore -// http://jquery.offput.ca/highlightFade/ - -// Parse strings looking for color tuples [255,255,255] -function getRGB(color) { - var result; - - // Check if we're already dealing with an array of colors - if ( color && color.constructor == Array && color.length == 3 ) - return color; - - // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; - - // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; - - // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; - - // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; - - // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 - if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) - return colors['transparent']; - - // Otherwise, we're most likely dealing with a named color - return colors[$.trim(color).toLowerCase()]; -} - -function getColor(elem, attr) { - var color; - - do { - color = $.curCSS(elem, attr); - - // Keep going until we find an element that has color, or we hit the body - if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) - break; - - attr = "backgroundColor"; - } while ( elem = elem.parentNode ); - - return getRGB(color); -}; - -// Some named colors to work with -// From Interface by Stefan Petre -// http://interface.eyecon.ro/ - -var colors = { - aqua:[0,255,255], - azure:[240,255,255], - beige:[245,245,220], - black:[0,0,0], - blue:[0,0,255], - brown:[165,42,42], - cyan:[0,255,255], - darkblue:[0,0,139], - darkcyan:[0,139,139], - darkgrey:[169,169,169], - darkgreen:[0,100,0], - darkkhaki:[189,183,107], - darkmagenta:[139,0,139], - darkolivegreen:[85,107,47], - darkorange:[255,140,0], - darkorchid:[153,50,204], - darkred:[139,0,0], - darksalmon:[233,150,122], - darkviolet:[148,0,211], - fuchsia:[255,0,255], - gold:[255,215,0], - green:[0,128,0], - indigo:[75,0,130], - khaki:[240,230,140], - lightblue:[173,216,230], - lightcyan:[224,255,255], - lightgreen:[144,238,144], - lightgrey:[211,211,211], - lightpink:[255,182,193], - lightyellow:[255,255,224], - lime:[0,255,0], - magenta:[255,0,255], - maroon:[128,0,0], - navy:[0,0,128], - olive:[128,128,0], - orange:[255,165,0], - pink:[255,192,203], - purple:[128,0,128], - violet:[128,0,128], - red:[255,0,0], - silver:[192,192,192], - white:[255,255,255], - yellow:[255,255,0], - transparent: [255,255,255] -}; - - - -/******************************************************************************/ -/****************************** CLASS ANIMATIONS ******************************/ -/******************************************************************************/ - -var classAnimationActions = ['add', 'remove', 'toggle'], - shorthandStyles = { - border: 1, - borderBottom: 1, - borderColor: 1, - borderLeft: 1, - borderRight: 1, - borderTop: 1, - borderWidth: 1, - margin: 1, - padding: 1 - }; - -function getElementStyles() { - var style = document.defaultView - ? document.defaultView.getComputedStyle(this, null) - : this.currentStyle, - newStyle = {}, - key, - camelCase; - - // webkit enumerates style porperties - if (style && style.length && style[0] && style[style[0]]) { - var len = style.length; - while (len--) { - key = style[len]; - if (typeof style[key] == 'string') { - camelCase = key.replace(/\-(\w)/g, function(all, letter){ - return letter.toUpperCase(); - }); - newStyle[camelCase] = style[key]; - } - } - } else { - for (key in style) { - if (typeof style[key] === 'string') { - newStyle[key] = style[key]; - } - } - } - - return newStyle; -} - -function filterStyles(styles) { - var name, value; - for (name in styles) { - value = styles[name]; - if ( - // ignore null and undefined values - value == null || - // ignore functions (when does this occur?) - $.isFunction(value) || - // shorthand styles that need to be expanded - name in shorthandStyles || - // ignore scrollbars (break in IE) - (/scrollbar/).test(name) || - - // only colors or values that can be converted to numbers - (!(/color/i).test(name) && isNaN(parseFloat(value))) - ) { - delete styles[name]; - } - } - - return styles; -} - -function styleDifference(oldStyle, newStyle) { - var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459 - name; - - for (name in newStyle) { - if (oldStyle[name] != newStyle[name]) { - diff[name] = newStyle[name]; - } - } - - return diff; -} - -$.effects.animateClass = function(value, duration, easing, callback) { - if ($.isFunction(easing)) { - callback = easing; - easing = null; - } - - return this.queue('fx', function() { - var that = $(this), - originalStyleAttr = that.attr('style') || ' ', - originalStyle = filterStyles(getElementStyles.call(this)), - newStyle, - className = that.attr('className'); - - $.each(classAnimationActions, function(i, action) { - if (value[action]) { - that[action + 'Class'](value[action]); - } - }); - newStyle = filterStyles(getElementStyles.call(this)); - that.attr('className', className); - - that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() { - $.each(classAnimationActions, function(i, action) { - if (value[action]) { that[action + 'Class'](value[action]); } - }); - // work around bug in IE by clearing the cssText before setting it - if (typeof that.attr('style') == 'object') { - that.attr('style').cssText = ''; - that.attr('style').cssText = originalStyleAttr; - } else { - that.attr('style', originalStyleAttr); - } - if (callback) { callback.apply(this, arguments); } - }); - - // $.animate adds a function to the end of the queue - // but we want it at the front - var queue = $.queue(this), - anim = queue.splice(queue.length - 1, 1)[0]; - queue.splice(1, 0, anim); - $.dequeue(this); - }); -}; - -$.fn.extend({ - _addClass: $.fn.addClass, - addClass: function(classNames, speed, easing, callback) { - return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); - }, - - _removeClass: $.fn.removeClass, - removeClass: function(classNames,speed,easing,callback) { - return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); - }, - - _toggleClass: $.fn.toggleClass, - toggleClass: function(classNames, force, speed, easing, callback) { - if ( typeof force == "boolean" || force === undefined ) { - if ( !speed ) { - // without speed parameter; - return this._toggleClass(classNames, force); - } else { - return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); - } - } else { - // without switch parameter; - return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); - } - }, - - switchClass: function(remove,add,speed,easing,callback) { - return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); - } -}); - - - -/******************************************************************************/ -/*********************************** EFFECTS **********************************/ -/******************************************************************************/ - -$.extend($.effects, { - version: "1.8.12", - - // Saves a set of properties in a data storage - save: function(element, set) { - for(var i=0; i < set.length; i++) { - if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); - } - }, - - // Restores a set of previously saved properties from a data storage - restore: function(element, set) { - for(var i=0; i < set.length; i++) { - if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); - } - }, - - setMode: function(el, mode) { - if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle - return mode; - }, - - getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value - // this should be a little more flexible in the future to handle a string & hash - var y, x; - switch (origin[0]) { - case 'top': y = 0; break; - case 'middle': y = 0.5; break; - case 'bottom': y = 1; break; - default: y = origin[0] / original.height; - }; - switch (origin[1]) { - case 'left': x = 0; break; - case 'center': x = 0.5; break; - case 'right': x = 1; break; - default: x = origin[1] / original.width; - }; - return {x: x, y: y}; - }, - - // Wraps the element around a wrapper that copies position properties - createWrapper: function(element) { - - // if the element is already wrapped, return it - if (element.parent().is('.ui-effects-wrapper')) { - return element.parent(); - } - - // wrap the element - var props = { - width: element.outerWidth(true), - height: element.outerHeight(true), - 'float': element.css('float') - }, - wrapper = $('
      ') - .addClass('ui-effects-wrapper') - .css({ - fontSize: '100%', - background: 'transparent', - border: 'none', - margin: 0, - padding: 0 - }); - - element.wrap(wrapper); - wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element - - // transfer positioning properties to the wrapper - if (element.css('position') == 'static') { - wrapper.css({ position: 'relative' }); - element.css({ position: 'relative' }); - } else { - $.extend(props, { - position: element.css('position'), - zIndex: element.css('z-index') - }); - $.each(['top', 'left', 'bottom', 'right'], function(i, pos) { - props[pos] = element.css(pos); - if (isNaN(parseInt(props[pos], 10))) { - props[pos] = 'auto'; - } - }); - element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' }); - } - - return wrapper.css(props).show(); - }, - - removeWrapper: function(element) { - if (element.parent().is('.ui-effects-wrapper')) - return element.parent().replaceWith(element); - return element; - }, - - setTransition: function(element, list, factor, value) { - value = value || {}; - $.each(list, function(i, x){ - unit = element.cssUnit(x); - if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; - }); - return value; - } -}); - - -function _normalizeArguments(effect, options, speed, callback) { - // shift params for method overloading - if (typeof effect == 'object') { - callback = options; - speed = null; - options = effect; - effect = options.effect; - } - if ($.isFunction(options)) { - callback = options; - speed = null; - options = {}; - } - if (typeof options == 'number' || $.fx.speeds[options]) { - callback = speed; - speed = options; - options = {}; - } - if ($.isFunction(speed)) { - callback = speed; - speed = null; - } - - options = options || {}; - - speed = speed || options.duration; - speed = $.fx.off ? 0 : typeof speed == 'number' - ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default; - - callback = callback || options.complete; - - return [effect, options, speed, callback]; -} - -function standardSpeed( speed ) { - // valid standard speeds - if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { - return true; - } - - // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects[ speed ] ) { - return true; - } - - return false; -} - -$.fn.extend({ - effect: function(effect, options, speed, callback) { - var args = _normalizeArguments.apply(this, arguments), - // TODO: make effects take actual parameters instead of a hash - args2 = { - options: args[1], - duration: args[2], - callback: args[3] - }, - mode = args2.options.mode, - effectMethod = $.effects[effect]; - - if ( $.fx.off || !effectMethod ) { - // delegate to the original method (e.g., .show()) if possible - if ( mode ) { - return this[ mode ]( args2.duration, args2.callback ); - } else { - return this.each(function() { - if ( args2.callback ) { - args2.callback.call( this ); - } - }); - } - } - - return effectMethod.call(this, args2); - }, - - _show: $.fn.show, - show: function(speed) { - if ( standardSpeed( speed ) ) { - return this._show.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'show'; - return this.effect.apply(this, args); - } - }, - - _hide: $.fn.hide, - hide: function(speed) { - if ( standardSpeed( speed ) ) { - return this._hide.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'hide'; - return this.effect.apply(this, args); - } - }, - - // jQuery core overloads toggle and creates _toggle - __toggle: $.fn.toggle, - toggle: function(speed) { - if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { - return this.__toggle.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'toggle'; - return this.effect.apply(this, args); - } - }, - - // helper functions - cssUnit: function(key) { - var style = this.css(key), val = []; - $.each( ['em','px','%','pt'], function(i, unit){ - if(style.indexOf(unit) > 0) - val = [parseFloat(style), unit]; - }); - return val; - } -}); - - - -/******************************************************************************/ -/*********************************** EASING ***********************************/ -/******************************************************************************/ - -/* - * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ - * - * Uses the built in easing capabilities added In jQuery 1.1 - * to offer multiple easing options - * - * TERMS OF USE - jQuery Easing - * - * Open source under the BSD License. - * - * Copyright 2008 George McGinley Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * -*/ - -// t: current time, b: begInnIng value, c: change In value, d: duration -$.easing.jswing = $.easing.swing; - -$.extend($.easing, -{ - def: 'easeOutQuad', - swing: function (x, t, b, c, d) { - //alert($.easing.default); - return $.easing[$.easing.def](x, t, b, c, d); - }, - easeInQuad: function (x, t, b, c, d) { - return c*(t/=d)*t + b; - }, - easeOutQuad: function (x, t, b, c, d) { - return -c *(t/=d)*(t-2) + b; - }, - easeInOutQuad: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t + b; - return -c/2 * ((--t)*(t-2) - 1) + b; - }, - easeInCubic: function (x, t, b, c, d) { - return c*(t/=d)*t*t + b; - }, - easeOutCubic: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t + 1) + b; - }, - easeInOutCubic: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; - }, - easeInQuart: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t + b; - }, - easeOutQuart: function (x, t, b, c, d) { - return -c * ((t=t/d-1)*t*t*t - 1) + b; - }, - easeInOutQuart: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t + b; - return -c/2 * ((t-=2)*t*t*t - 2) + b; - }, - easeInQuint: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t*t + b; - }, - easeOutQuint: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t*t*t + 1) + b; - }, - easeInOutQuint: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; - return c/2*((t-=2)*t*t*t*t + 2) + b; - }, - easeInSine: function (x, t, b, c, d) { - return -c * Math.cos(t/d * (Math.PI/2)) + c + b; - }, - easeOutSine: function (x, t, b, c, d) { - return c * Math.sin(t/d * (Math.PI/2)) + b; - }, - easeInOutSine: function (x, t, b, c, d) { - return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; - }, - easeInExpo: function (x, t, b, c, d) { - return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; - }, - easeOutExpo: function (x, t, b, c, d) { - return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; - }, - easeInOutExpo: function (x, t, b, c, d) { - if (t==0) return b; - if (t==d) return b+c; - if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; - return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; - }, - easeInCirc: function (x, t, b, c, d) { - return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; - }, - easeOutCirc: function (x, t, b, c, d) { - return c * Math.sqrt(1 - (t=t/d-1)*t) + b; - }, - easeInOutCirc: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; - return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; - }, - easeInElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - }, - easeOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; - }, - easeInOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; - }, - easeInBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*(t/=d)*t*((s+1)*t - s) + b; - }, - easeOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; - }, - easeInOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; - return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; - }, - easeInBounce: function (x, t, b, c, d) { - return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; - }, - easeOutBounce: function (x, t, b, c, d) { - if ((t/=d) < (1/2.75)) { - return c*(7.5625*t*t) + b; - } else if (t < (2/2.75)) { - return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; - } else if (t < (2.5/2.75)) { - return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; - } else { - return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; - } - }, - easeInOutBounce: function (x, t, b, c, d) { - if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; - return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; - } -}); - -/* - * - * TERMS OF USE - EASING EQUATIONS - * - * Open source under the BSD License. - * - * Copyright 2001 Robert Penner - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.drop.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.drop.js deleted file mode 100644 index 2e52d1d951..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.drop.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * jQuery UI Effects Drop 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Drop - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.drop = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','opacity']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - - // Animation - var animation = {opacity: mode == 'show' ? 1 : 0}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.explode.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.explode.js deleted file mode 100644 index 15ef4ce539..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.explode.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * jQuery UI Effects Explode 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Explode - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.explode = function(o) { - - return this.queue(function() { - - var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - - o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; - var el = $(this).show().css('visibility', 'hidden'); - var offset = el.offset(); - - //Substract the margins - not fixing the problem yet. - offset.top -= parseInt(el.css("marginTop"),10) || 0; - offset.left -= parseInt(el.css("marginLeft"),10) || 0; - - var width = el.outerWidth(true); - var height = el.outerHeight(true); - - for(var i=0;i') - .css({ - position: 'absolute', - visibility: 'visible', - left: -j*(width/cells), - top: -i*(height/rows) - }) - .parent() - .addClass('ui-effects-explode') - .css({ - position: 'absolute', - overflow: 'hidden', - width: width/cells, - height: height/rows, - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), - opacity: o.options.mode == 'show' ? 0 : 1 - }).animate({ - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), - opacity: o.options.mode == 'show' ? 1 : 0 - }, o.duration || 500); - } - } - - // Set a timeout, to call the callback approx. when the other animations have finished - setTimeout(function() { - - o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); - if(o.callback) o.callback.apply(el[0]); // Callback - el.dequeue(); - - $('div.ui-effects-explode').remove(); - - }, o.duration || 500); - - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fade.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fade.js deleted file mode 100644 index fec691d530..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fade.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * jQuery UI Effects Fade 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.fade = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'); - - elem.animate({ opacity: mode }, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fold.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fold.js deleted file mode 100644 index 543164f57a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.fold.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * jQuery UI Effects Fold 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.fold = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var size = o.options.size || 15; // Default fold size - var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value - var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var widthFirst = ((mode == 'show') != horizFirst); - var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; - var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; - var percent = /([0-9]+)%/.exec(size); - if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; - if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift - - // Animation - var animation1 = {}, animation2 = {}; - animation1[ref[0]] = mode == 'show' ? distance[0] : size; - animation2[ref[1]] = mode == 'show' ? distance[1] : 0; - - // Animate - wrapper.animate(animation1, duration, o.options.easing) - .animate(animation2, duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.highlight.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.highlight.js deleted file mode 100644 index 14fb1d5858..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.highlight.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * jQuery UI Effects Highlight 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.highlight = function(o) { - return this.queue(function() { - var elem = $(this), - props = ['backgroundImage', 'backgroundColor', 'opacity'], - mode = $.effects.setMode(elem, o.options.mode || 'show'), - animation = { - backgroundColor: elem.css('backgroundColor') - }; - - if (mode == 'hide') { - animation.opacity = 0; - } - - $.effects.save(elem, props); - elem - .show() - .css({ - backgroundImage: 'none', - backgroundColor: o.options.color || '#ffff99' - }) - .animate(animation, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (mode == 'hide' && elem.hide()); - $.effects.restore(elem, props); - (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter')); - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.pulsate.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.pulsate.js deleted file mode 100644 index 9e2b1533ce..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.pulsate.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * jQuery UI Effects Pulsate 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.pulsate = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'show'); - times = ((o.options.times || 5) * 2) - 1; - duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2, - isVisible = elem.is(':visible'), - animateTo = 0; - - if (!isVisible) { - elem.css('opacity', 0).show(); - animateTo = 1; - } - - if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { - times--; - } - - for (var i = 0; i < times; i++) { - elem.animate({ opacity: animateTo }, duration, o.options.easing); - animateTo = (animateTo + 1) % 2; - } - - elem.animate({ opacity: animateTo }, duration, o.options.easing, function() { - if (animateTo == 0) { - elem.hide(); - } - (o.callback && o.callback.apply(this, arguments)); - }); - - elem - .queue('fx', function() { elem.dequeue(); }) - .dequeue(); - }); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.scale.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.scale.js deleted file mode 100644 index dec1f13ee3..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.scale.js +++ /dev/null @@ -1,178 +0,0 @@ -/* - * jQuery UI Effects Scale 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Scale - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.puff = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'), - percent = parseInt(o.options.percent, 10) || 150, - factor = percent / 100, - original = { height: elem.height(), width: elem.width() }; - - $.extend(o.options, { - fade: true, - mode: mode, - percent: mode == 'hide' ? percent : 100, - from: mode == 'hide' - ? original - : { - height: original.height * factor, - width: original.width * factor - } - }); - - elem.effect('scale', o.options, o.duration, o.callback); - elem.dequeue(); - }); -}; - -$.effects.scale = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this); - - // Set options - var options = $.extend(true, {}, o.options); - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent - var direction = o.options.direction || 'both'; // Set default axis - var origin = o.options.origin; // The origin of the scaling - if (mode != 'effect') { // Set default origin and restore for show/hide - options.origin = origin || ['middle','center']; - options.restore = true; - } - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state - - // Adjust - var factor = { // Set scaling factor - y: direction != 'horizontal' ? (percent / 100) : 1, - x: direction != 'vertical' ? (percent / 100) : 1 - }; - el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state - - if (o.options.fade) { // Fade option to support puff - if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; - if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; - }; - - // Animation - options.from = el.from; options.to = el.to; options.mode = mode; - - // Animate - el.effect('size', options, o.duration, o.callback); - el.dequeue(); - }); - -}; - -$.effects.size = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity']; - var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore - var props2 = ['width','height','overflow']; // Copy for children - var cProps = ['fontSize']; - var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; - var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var restore = o.options.restore || false; // Default restore - var scale = o.options.scale || 'both'; // Default scale mode - var origin = o.options.origin; // The origin of the sizing - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || original; // Default from state - el.to = o.options.to || original; // Default to state - // Adjust - if (origin) { // Calculate baseline shifts - var baseline = $.effects.getBaseline(origin, original); - el.from.top = (original.height - el.from.height) * baseline.y; - el.from.left = (original.width - el.from.width) * baseline.x; - el.to.top = (original.height - el.to.height) * baseline.y; - el.to.left = (original.width - el.to.width) * baseline.x; - }; - var factor = { // Set scaling factor - from: {y: el.from.height / original.height, x: el.from.width / original.width}, - to: {y: el.to.height / original.height, x: el.to.width / original.width} - }; - if (scale == 'box' || scale == 'both') { // Scale the css box - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(vProps); - el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - props = props.concat(hProps); - el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); - el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); - }; - }; - if (scale == 'content' || scale == 'both') { // Scale the content - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(cProps); - el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); - }; - }; - $.effects.save(el, restore ? props : props1); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - el.css('overflow','hidden').css(el.from); // Shift - - // Animate - if (scale == 'content' || scale == 'both') { // Scale the children - vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size - hProps = hProps.concat(['marginLeft','marginRight']); // Add margins - props2 = props.concat(vProps).concat(hProps); // Concat - el.find("*[width]").each(function(){ - child = $(this); - if (restore) $.effects.save(child, props2); - var c_original = {height: child.height(), width: child.width()}; // Save original - child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; - child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; - if (factor.from.y != factor.to.y) { // Vertical props scaling - child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); - child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); - child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); - }; - child.css(child.from); // Shift children - child.animate(child.to, o.duration, o.options.easing, function(){ - if (restore) $.effects.restore(child, props2); // Restore children - }); // Animate children - }); - }; - - // Animate - el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if (el.to.opacity === 0) { - el.css('opacity', el.from.opacity); - } - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.shake.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.shake.js deleted file mode 100644 index fef174f309..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.shake.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * jQuery UI Effects Shake 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Shake - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.shake = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'left'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 3; // Default # of times - var speed = o.duration || o.options.duration || 140; // Default speed per shake - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - - // Animation - var animation = {}, animation1 = {}, animation2 = {}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; - animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; - - // Animate - el.animate(animation, speed, o.options.easing); - for (var i = 1; i < times; i++) { // Shakes - el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); - }; - el.animate(animation1, speed, o.options.easing). - animate(animation, speed / 2, o.options.easing, function(){ // Last shake - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.slide.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.slide.js deleted file mode 100644 index 2179dbfb25..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.slide.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * jQuery UI Effects Slide 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Slide - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.slide = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); - if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift - - // Animation - var animation = {}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.transfer.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.transfer.js deleted file mode 100644 index 875ef1022a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.effects.transfer.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * jQuery UI Effects Transfer 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Transfer - * - * Depends: - * jquery.effects.core.js - */ -(function( $, undefined ) { - -$.effects.transfer = function(o) { - return this.queue(function() { - var elem = $(this), - target = $(o.options.to), - endPosition = target.offset(), - animation = { - top: endPosition.top, - left: endPosition.left, - height: target.innerHeight(), - width: target.innerWidth() - }, - startPosition = elem.offset(), - transfer = $('
      ') - .appendTo(document.body) - .addClass(o.options.className) - .css({ - top: startPosition.top, - left: startPosition.left, - height: elem.innerHeight(), - width: elem.innerWidth(), - position: 'absolute' - }) - .animate(animation, o.duration, o.options.easing, function() { - transfer.remove(); - (o.callback && o.callback.apply(elem[0], arguments)); - elem.dequeue(); - }); - }); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.accordion.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.accordion.js deleted file mode 100644 index b1a967404f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.accordion.js +++ /dev/null @@ -1,611 +0,0 @@ -/* - * jQuery UI Accordion 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget( "ui.accordion", { - options: { - active: 0, - animated: "slide", - autoHeight: true, - clearStyle: false, - collapsible: false, - event: "click", - fillSpace: false, - header: "> li > :first-child,> :not(li):even", - icons: { - header: "ui-icon-triangle-1-e", - headerSelected: "ui-icon-triangle-1-s" - }, - navigation: false, - navigationFilter: function() { - return this.href.toLowerCase() === location.href.toLowerCase(); - } - }, - - _create: function() { - var self = this, - options = self.options; - - self.running = 0; - - self.element - .addClass( "ui-accordion ui-widget ui-helper-reset" ) - // in lack of child-selectors in CSS - // we need to mark top-LIs in a UL-accordion for some IE-fix - .children( "li" ) - .addClass( "ui-accordion-li-fix" ); - - self.headers = self.element.find( options.header ) - .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) - .bind( "mouseenter.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-hover" ); - }) - .bind( "mouseleave.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( "ui-state-hover" ); - }) - .bind( "focus.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-focus" ); - }) - .bind( "blur.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( "ui-state-focus" ); - }); - - self.headers.next() - .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); - - if ( options.navigation ) { - var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); - if ( current.length ) { - var header = current.closest( ".ui-accordion-header" ); - if ( header.length ) { - // anchor within header - self.active = header; - } else { - // anchor within content - self.active = current.closest( ".ui-accordion-content" ).prev(); - } - } - } - - self.active = self._findActive( self.active || options.active ) - .addClass( "ui-state-default ui-state-active" ) - .toggleClass( "ui-corner-all" ) - .toggleClass( "ui-corner-top" ); - self.active.next().addClass( "ui-accordion-content-active" ); - - self._createIcons(); - self.resize(); - - // ARIA - self.element.attr( "role", "tablist" ); - - self.headers - .attr( "role", "tab" ) - .bind( "keydown.accordion", function( event ) { - return self._keydown( event ); - }) - .next() - .attr( "role", "tabpanel" ); - - self.headers - .not( self.active || "" ) - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 - }) - .next() - .hide(); - - // make sure at least one header is in the tab order - if ( !self.active.length ) { - self.headers.eq( 0 ).attr( "tabIndex", 0 ); - } else { - self.active - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }); - } - - // only need links in tab order for Safari - if ( !$.browser.safari ) { - self.headers.find( "a" ).attr( "tabIndex", -1 ); - } - - if ( options.event ) { - self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { - self._clickHandler.call( self, event, this ); - event.preventDefault(); - }); - } - }, - - _createIcons: function() { - var options = this.options; - if ( options.icons ) { - $( "" ) - .addClass( "ui-icon " + options.icons.header ) - .prependTo( this.headers ); - this.active.children( ".ui-icon" ) - .toggleClass(options.icons.header) - .toggleClass(options.icons.headerSelected); - this.element.addClass( "ui-accordion-icons" ); - } - }, - - _destroyIcons: function() { - this.headers.children( ".ui-icon" ).remove(); - this.element.removeClass( "ui-accordion-icons" ); - }, - - destroy: function() { - var options = this.options; - - this.element - .removeClass( "ui-accordion ui-widget ui-helper-reset" ) - .removeAttr( "role" ); - - this.headers - .unbind( ".accordion" ) - .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) - .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-selected" ) - .removeAttr( "tabIndex" ); - - this.headers.find( "a" ).removeAttr( "tabIndex" ); - this._destroyIcons(); - var contents = this.headers.next() - .css( "display", "" ) - .removeAttr( "role" ) - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); - if ( options.autoHeight || options.fillHeight ) { - contents.css( "height", "" ); - } - - return $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - - if ( key == "active" ) { - this.activate( value ); - } - if ( key == "icons" ) { - this._destroyIcons(); - if ( value ) { - this._createIcons(); - } - } - // #5332 - opacity doesn't cascade to positioned elements in IE - // so we need to add the disabled class to the headers and panels - if ( key == "disabled" ) { - this.headers.add(this.headers.next()) - [ value ? "addClass" : "removeClass" ]( - "ui-accordion-disabled ui-state-disabled" ); - } - }, - - _keydown: function( event ) { - if ( this.options.disabled || event.altKey || event.ctrlKey ) { - return; - } - - var keyCode = $.ui.keyCode, - length = this.headers.length, - currentIndex = this.headers.index( event.target ), - toFocus = false; - - switch ( event.keyCode ) { - case keyCode.RIGHT: - case keyCode.DOWN: - toFocus = this.headers[ ( currentIndex + 1 ) % length ]; - break; - case keyCode.LEFT: - case keyCode.UP: - toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; - break; - case keyCode.SPACE: - case keyCode.ENTER: - this._clickHandler( { target: event.target }, event.target ); - event.preventDefault(); - } - - if ( toFocus ) { - $( event.target ).attr( "tabIndex", -1 ); - $( toFocus ).attr( "tabIndex", 0 ); - toFocus.focus(); - return false; - } - - return true; - }, - - resize: function() { - var options = this.options, - maxHeight; - - if ( options.fillSpace ) { - if ( $.browser.msie ) { - var defOverflow = this.element.parent().css( "overflow" ); - this.element.parent().css( "overflow", "hidden"); - } - maxHeight = this.element.parent().height(); - if ($.browser.msie) { - this.element.parent().css( "overflow", defOverflow ); - } - - this.headers.each(function() { - maxHeight -= $( this ).outerHeight( true ); - }); - - this.headers.next() - .each(function() { - $( this ).height( Math.max( 0, maxHeight - - $( this ).innerHeight() + $( this ).height() ) ); - }) - .css( "overflow", "auto" ); - } else if ( options.autoHeight ) { - maxHeight = 0; - this.headers.next() - .each(function() { - maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); - }) - .height( maxHeight ); - } - - return this; - }, - - activate: function( index ) { - // TODO this gets called on init, changing the option without an explicit call for that - this.options.active = index; - // call clickHandler with custom event - var active = this._findActive( index )[ 0 ]; - this._clickHandler( { target: active }, active ); - - return this; - }, - - _findActive: function( selector ) { - return selector - ? typeof selector === "number" - ? this.headers.filter( ":eq(" + selector + ")" ) - : this.headers.not( this.headers.not( selector ) ) - : selector === false - ? $( [] ) - : this.headers.filter( ":eq(0)" ); - }, - - // TODO isn't event.target enough? why the separate target argument? - _clickHandler: function( event, target ) { - var options = this.options; - if ( options.disabled ) { - return; - } - - // called only when using activate(false) to close all parts programmatically - if ( !event.target ) { - if ( !options.collapsible ) { - return; - } - this.active - .removeClass( "ui-state-active ui-corner-top" ) - .addClass( "ui-state-default ui-corner-all" ) - .children( ".ui-icon" ) - .removeClass( options.icons.headerSelected ) - .addClass( options.icons.header ); - this.active.next().addClass( "ui-accordion-content-active" ); - var toHide = this.active.next(), - data = { - options: options, - newHeader: $( [] ), - oldHeader: options.active, - newContent: $( [] ), - oldContent: toHide - }, - toShow = ( this.active = $( [] ) ); - this._toggle( toShow, toHide, data ); - return; - } - - // get the click target - var clicked = $( event.currentTarget || target ), - clickedIsActive = clicked[0] === this.active[0]; - - // TODO the option is changed, is that correct? - // TODO if it is correct, shouldn't that happen after determining that the click is valid? - options.active = options.collapsible && clickedIsActive ? - false : - this.headers.index( clicked ); - - // if animations are still active, or the active header is the target, ignore click - if ( this.running || ( !options.collapsible && clickedIsActive ) ) { - return; - } - - // find elements to show and hide - var active = this.active, - toShow = clicked.next(), - toHide = this.active.next(), - data = { - options: options, - newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, - oldHeader: this.active, - newContent: clickedIsActive && options.collapsible ? $([]) : toShow, - oldContent: toHide - }, - down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); - - // when the call to ._toggle() comes after the class changes - // it causes a very odd bug in IE 8 (see #6720) - this.active = clickedIsActive ? $([]) : clicked; - this._toggle( toShow, toHide, data, clickedIsActive, down ); - - // switch classes - active - .removeClass( "ui-state-active ui-corner-top" ) - .addClass( "ui-state-default ui-corner-all" ) - .children( ".ui-icon" ) - .removeClass( options.icons.headerSelected ) - .addClass( options.icons.header ); - if ( !clickedIsActive ) { - clicked - .removeClass( "ui-state-default ui-corner-all" ) - .addClass( "ui-state-active ui-corner-top" ) - .children( ".ui-icon" ) - .removeClass( options.icons.header ) - .addClass( options.icons.headerSelected ); - clicked - .next() - .addClass( "ui-accordion-content-active" ); - } - - return; - }, - - _toggle: function( toShow, toHide, data, clickedIsActive, down ) { - var self = this, - options = self.options; - - self.toShow = toShow; - self.toHide = toHide; - self.data = data; - - var complete = function() { - if ( !self ) { - return; - } - return self._completed.apply( self, arguments ); - }; - - // trigger changestart event - self._trigger( "changestart", null, self.data ); - - // count elements to animate - self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); - - if ( options.animated ) { - var animOptions = {}; - - if ( options.collapsible && clickedIsActive ) { - animOptions = { - toShow: $( [] ), - toHide: toHide, - complete: complete, - down: down, - autoHeight: options.autoHeight || options.fillSpace - }; - } else { - animOptions = { - toShow: toShow, - toHide: toHide, - complete: complete, - down: down, - autoHeight: options.autoHeight || options.fillSpace - }; - } - - if ( !options.proxied ) { - options.proxied = options.animated; - } - - if ( !options.proxiedDuration ) { - options.proxiedDuration = options.duration; - } - - options.animated = $.isFunction( options.proxied ) ? - options.proxied( animOptions ) : - options.proxied; - - options.duration = $.isFunction( options.proxiedDuration ) ? - options.proxiedDuration( animOptions ) : - options.proxiedDuration; - - var animations = $.ui.accordion.animations, - duration = options.duration, - easing = options.animated; - - if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { - easing = "slide"; - } - if ( !animations[ easing ] ) { - animations[ easing ] = function( options ) { - this.slide( options, { - easing: easing, - duration: duration || 700 - }); - }; - } - - animations[ easing ]( animOptions ); - } else { - if ( options.collapsible && clickedIsActive ) { - toShow.toggle(); - } else { - toHide.hide(); - toShow.show(); - } - - complete( true ); - } - - // TODO assert that the blur and focus triggers are really necessary, remove otherwise - toHide.prev() - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 - }) - .blur(); - toShow.prev() - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }) - .focus(); - }, - - _completed: function( cancel ) { - this.running = cancel ? 0 : --this.running; - if ( this.running ) { - return; - } - - if ( this.options.clearStyle ) { - this.toShow.add( this.toHide ).css({ - height: "", - overflow: "" - }); - } - - // other classes are removed before the animation; this one needs to stay until completed - this.toHide.removeClass( "ui-accordion-content-active" ); - // Work around for rendering bug in IE (#5421) - if ( this.toHide.length ) { - this.toHide.parent()[0].className = this.toHide.parent()[0].className; - } - - this._trigger( "change", null, this.data ); - } -}); - -$.extend( $.ui.accordion, { - version: "1.8.12", - animations: { - slide: function( options, additions ) { - options = $.extend({ - easing: "swing", - duration: 300 - }, options, additions ); - if ( !options.toHide.size() ) { - options.toShow.animate({ - height: "show", - paddingTop: "show", - paddingBottom: "show" - }, options ); - return; - } - if ( !options.toShow.size() ) { - options.toHide.animate({ - height: "hide", - paddingTop: "hide", - paddingBottom: "hide" - }, options ); - return; - } - var overflow = options.toShow.css( "overflow" ), - percentDone = 0, - showProps = {}, - hideProps = {}, - fxAttrs = [ "height", "paddingTop", "paddingBottom" ], - originalWidth; - // fix width before calculating height of hidden element - var s = options.toShow; - originalWidth = s[0].style.width; - s.width( parseInt( s.parent().width(), 10 ) - - parseInt( s.css( "paddingLeft" ), 10 ) - - parseInt( s.css( "paddingRight" ), 10 ) - - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) - - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) ); - - $.each( fxAttrs, function( i, prop ) { - hideProps[ prop ] = "hide"; - - var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); - showProps[ prop ] = { - value: parts[ 1 ], - unit: parts[ 2 ] || "px" - }; - }); - options.toShow.css({ height: 0, overflow: "hidden" }).show(); - options.toHide - .filter( ":hidden" ) - .each( options.complete ) - .end() - .filter( ":visible" ) - .animate( hideProps, { - step: function( now, settings ) { - // only calculate the percent when animating height - // IE gets very inconsistent results when animating elements - // with small values, which is common for padding - if ( settings.prop == "height" ) { - percentDone = ( settings.end - settings.start === 0 ) ? 0 : - ( settings.now - settings.start ) / ( settings.end - settings.start ); - } - - options.toShow[ 0 ].style[ settings.prop ] = - ( percentDone * showProps[ settings.prop ].value ) - + showProps[ settings.prop ].unit; - }, - duration: options.duration, - easing: options.easing, - complete: function() { - if ( !options.autoHeight ) { - options.toShow.css( "height", "" ); - } - options.toShow.css({ - width: originalWidth, - overflow: overflow - }); - options.complete(); - } - }); - }, - bounceslide: function( options ) { - this.slide( options, { - easing: options.down ? "easeOutBounce" : "swing", - duration: options.down ? 1000 : 200 - }); - } - } -}); - -})( jQuery ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.autocomplete.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.autocomplete.js deleted file mode 100644 index 63fd1193b5..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.autocomplete.js +++ /dev/null @@ -1,612 +0,0 @@ -/* - * jQuery UI Autocomplete 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function( $, undefined ) { - -// used to prevent race conditions with remote data sources -var requestIndex = 0; - -$.widget( "ui.autocomplete", { - options: { - appendTo: "body", - autoFocus: false, - delay: 300, - minLength: 1, - position: { - my: "left top", - at: "left bottom", - collision: "none" - }, - source: null - }, - - pending: 0, - - _create: function() { - var self = this, - doc = this.element[ 0 ].ownerDocument, - suppressKeyPress; - - this.element - .addClass( "ui-autocomplete-input" ) - .attr( "autocomplete", "off" ) - // TODO verify these actually work as intended - .attr({ - role: "textbox", - "aria-autocomplete": "list", - "aria-haspopup": "true" - }) - .bind( "keydown.autocomplete", function( event ) { - if ( self.options.disabled || self.element.attr( "readonly" ) ) { - return; - } - - suppressKeyPress = false; - var keyCode = $.ui.keyCode; - switch( event.keyCode ) { - case keyCode.PAGE_UP: - self._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - self._move( "nextPage", event ); - break; - case keyCode.UP: - self._move( "previous", event ); - // prevent moving cursor to beginning of text field in some browsers - event.preventDefault(); - break; - case keyCode.DOWN: - self._move( "next", event ); - // prevent moving cursor to end of text field in some browsers - event.preventDefault(); - break; - case keyCode.ENTER: - case keyCode.NUMPAD_ENTER: - // when menu is open and has focus - if ( self.menu.active ) { - // #6055 - Opera still allows the keypress to occur - // which causes forms to submit - suppressKeyPress = true; - event.preventDefault(); - } - //passthrough - ENTER and TAB both select the current element - case keyCode.TAB: - if ( !self.menu.active ) { - return; - } - self.menu.select( event ); - break; - case keyCode.ESCAPE: - self.element.val( self.term ); - self.close( event ); - break; - default: - // keypress is triggered before the input value is changed - clearTimeout( self.searching ); - self.searching = setTimeout(function() { - // only search if the value has changed - if ( self.term != self.element.val() ) { - self.selectedItem = null; - self.search( null, event ); - } - }, self.options.delay ); - break; - } - }) - .bind( "keypress.autocomplete", function( event ) { - if ( suppressKeyPress ) { - suppressKeyPress = false; - event.preventDefault(); - } - }) - .bind( "focus.autocomplete", function() { - if ( self.options.disabled ) { - return; - } - - self.selectedItem = null; - self.previous = self.element.val(); - }) - .bind( "blur.autocomplete", function( event ) { - if ( self.options.disabled ) { - return; - } - - clearTimeout( self.searching ); - // clicks on the menu (or a button to trigger a search) will cause a blur event - self.closing = setTimeout(function() { - self.close( event ); - self._change( event ); - }, 150 ); - }); - this._initSource(); - this.response = function() { - return self._response.apply( self, arguments ); - }; - this.menu = $( "
        " ) - .addClass( "ui-autocomplete" ) - .appendTo( $( this.options.appendTo || "body", doc )[0] ) - // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) - .mousedown(function( event ) { - // clicking on the scrollbar causes focus to shift to the body - // but we can't detect a mouseup or a click immediately afterward - // so we have to track the next mousedown and close the menu if - // the user clicks somewhere outside of the autocomplete - var menuElement = self.menu.element[ 0 ]; - if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { - setTimeout(function() { - $( document ).one( 'mousedown', function( event ) { - if ( event.target !== self.element[ 0 ] && - event.target !== menuElement && - !$.ui.contains( menuElement, event.target ) ) { - self.close(); - } - }); - }, 1 ); - } - - // use another timeout to make sure the blur-event-handler on the input was already triggered - setTimeout(function() { - clearTimeout( self.closing ); - }, 13); - }) - .menu({ - focus: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ); - if ( false !== self._trigger( "focus", event, { item: item } ) ) { - // use value to match what will end up in the input, if it was a key event - if ( /^key/.test(event.originalEvent.type) ) { - self.element.val( item.value ); - } - } - }, - selected: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ), - previous = self.previous; - - // only trigger when focus was lost (click on menu) - if ( self.element[0] !== doc.activeElement ) { - self.element.focus(); - self.previous = previous; - // #6109 - IE triggers two focus events and the second - // is asynchronous, so we need to reset the previous - // term synchronously and asynchronously :-( - setTimeout(function() { - self.previous = previous; - self.selectedItem = item; - }, 1); - } - - if ( false !== self._trigger( "select", event, { item: item } ) ) { - self.element.val( item.value ); - } - // reset the term after the select event - // this allows custom select handling to work properly - self.term = self.element.val(); - - self.close( event ); - self.selectedItem = item; - }, - blur: function( event, ui ) { - // don't set the value of the text field if it's already correct - // this prevents moving the cursor unnecessarily - if ( self.menu.element.is(":visible") && - ( self.element.val() !== self.term ) ) { - self.element.val( self.term ); - } - } - }) - .zIndex( this.element.zIndex() + 1 ) - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .hide() - .data( "menu" ); - if ( $.fn.bgiframe ) { - this.menu.element.bgiframe(); - } - }, - - destroy: function() { - this.element - .removeClass( "ui-autocomplete-input" ) - .removeAttr( "autocomplete" ) - .removeAttr( "role" ) - .removeAttr( "aria-autocomplete" ) - .removeAttr( "aria-haspopup" ); - this.menu.element.remove(); - $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - if ( key === "source" ) { - this._initSource(); - } - if ( key === "appendTo" ) { - this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) - } - if ( key === "disabled" && value && this.xhr ) { - this.xhr.abort(); - } - }, - - _initSource: function() { - var self = this, - array, - url; - if ( $.isArray(this.options.source) ) { - array = this.options.source; - this.source = function( request, response ) { - response( $.ui.autocomplete.filter(array, request.term) ); - }; - } else if ( typeof this.options.source === "string" ) { - url = this.options.source; - this.source = function( request, response ) { - if ( self.xhr ) { - self.xhr.abort(); - } - self.xhr = $.ajax({ - url: url, - data: request, - dataType: "json", - autocompleteRequest: ++requestIndex, - success: function( data, status ) { - if ( this.autocompleteRequest === requestIndex ) { - response( data ); - } - }, - error: function() { - if ( this.autocompleteRequest === requestIndex ) { - response( [] ); - } - } - }); - }; - } else { - this.source = this.options.source; - } - }, - - search: function( value, event ) { - value = value != null ? value : this.element.val(); - - // always save the actual value, not the one passed as an argument - this.term = this.element.val(); - - if ( value.length < this.options.minLength ) { - return this.close( event ); - } - - clearTimeout( this.closing ); - if ( this._trigger( "search", event ) === false ) { - return; - } - - return this._search( value ); - }, - - _search: function( value ) { - this.pending++; - this.element.addClass( "ui-autocomplete-loading" ); - - this.source( { term: value }, this.response ); - }, - - _response: function( content ) { - if ( !this.options.disabled && content && content.length ) { - content = this._normalize( content ); - this._suggest( content ); - this._trigger( "open" ); - } else { - this.close(); - } - this.pending--; - if ( !this.pending ) { - this.element.removeClass( "ui-autocomplete-loading" ); - } - }, - - close: function( event ) { - clearTimeout( this.closing ); - if ( this.menu.element.is(":visible") ) { - this.menu.element.hide(); - this.menu.deactivate(); - this._trigger( "close", event ); - } - }, - - _change: function( event ) { - if ( this.previous !== this.element.val() ) { - this._trigger( "change", event, { item: this.selectedItem } ); - } - }, - - _normalize: function( items ) { - // assume all items have the right format when the first item is complete - if ( items.length && items[0].label && items[0].value ) { - return items; - } - return $.map( items, function(item) { - if ( typeof item === "string" ) { - return { - label: item, - value: item - }; - } - return $.extend({ - label: item.label || item.value, - value: item.value || item.label - }, item ); - }); - }, - - _suggest: function( items ) { - var ul = this.menu.element - .empty() - .zIndex( this.element.zIndex() + 1 ); - this._renderMenu( ul, items ); - // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate - this.menu.deactivate(); - this.menu.refresh(); - - // size and position menu - ul.show(); - this._resizeMenu(); - ul.position( $.extend({ - of: this.element - }, this.options.position )); - - if ( this.options.autoFocus ) { - this.menu.next( new $.Event("mouseover") ); - } - }, - - _resizeMenu: function() { - var ul = this.menu.element; - ul.outerWidth( Math.max( - ul.width( "" ).outerWidth(), - this.element.outerWidth() - ) ); - }, - - _renderMenu: function( ul, items ) { - var self = this; - $.each( items, function( index, item ) { - self._renderItem( ul, item ); - }); - }, - - _renderItem: function( ul, item) { - return $( "
      • " ) - .data( "item.autocomplete", item ) - .append( $( "" ).text( item.label ) ) - .appendTo( ul ); - }, - - _move: function( direction, event ) { - if ( !this.menu.element.is(":visible") ) { - this.search( null, event ); - return; - } - if ( this.menu.first() && /^previous/.test(direction) || - this.menu.last() && /^next/.test(direction) ) { - this.element.val( this.term ); - this.menu.deactivate(); - return; - } - this.menu[ direction ]( event ); - }, - - widget: function() { - return this.menu.element; - } -}); - -$.extend( $.ui.autocomplete, { - escapeRegex: function( value ) { - return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }, - filter: function(array, term) { - var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); - return $.grep( array, function(value) { - return matcher.test( value.label || value.value || value ); - }); - } -}); - -}( jQuery )); - -/* - * jQuery UI Menu (not officially released) - * - * This widget isn't yet finished and the API is subject to change. We plan to finish - * it for the next release. You're welcome to give it a try anyway and give us feedback, - * as long as you're okay with migrating your code later on. We can help with that, too. - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function($) { - -$.widget("ui.menu", { - _create: function() { - var self = this; - this.element - .addClass("ui-menu ui-widget ui-widget-content ui-corner-all") - .attr({ - role: "listbox", - "aria-activedescendant": "ui-active-menuitem" - }) - .click(function( event ) { - if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) { - return; - } - // temporary - event.preventDefault(); - self.select( event ); - }); - this.refresh(); - }, - - refresh: function() { - var self = this; - - // don't refresh list items that are already adapted - var items = this.element.children("li:not(.ui-menu-item):has(a)") - .addClass("ui-menu-item") - .attr("role", "menuitem"); - - items.children("a") - .addClass("ui-corner-all") - .attr("tabindex", -1) - // mouseenter doesn't work with event delegation - .mouseenter(function( event ) { - self.activate( event, $(this).parent() ); - }) - .mouseleave(function() { - self.deactivate(); - }); - }, - - activate: function( event, item ) { - this.deactivate(); - if (this.hasScroll()) { - var offset = item.offset().top - this.element.offset().top, - scroll = this.element.attr("scrollTop"), - elementHeight = this.element.height(); - if (offset < 0) { - this.element.attr("scrollTop", scroll + offset); - } else if (offset >= elementHeight) { - this.element.attr("scrollTop", scroll + offset - elementHeight + item.height()); - } - } - this.active = item.eq(0) - .children("a") - .addClass("ui-state-hover") - .attr("id", "ui-active-menuitem") - .end(); - this._trigger("focus", event, { item: item }); - }, - - deactivate: function() { - if (!this.active) { return; } - - this.active.children("a") - .removeClass("ui-state-hover") - .removeAttr("id"); - this._trigger("blur"); - this.active = null; - }, - - next: function(event) { - this.move("next", ".ui-menu-item:first", event); - }, - - previous: function(event) { - this.move("prev", ".ui-menu-item:last", event); - }, - - first: function() { - return this.active && !this.active.prevAll(".ui-menu-item").length; - }, - - last: function() { - return this.active && !this.active.nextAll(".ui-menu-item").length; - }, - - move: function(direction, edge, event) { - if (!this.active) { - this.activate(event, this.element.children(edge)); - return; - } - var next = this.active[direction + "All"](".ui-menu-item").eq(0); - if (next.length) { - this.activate(event, next); - } else { - this.activate(event, this.element.children(edge)); - } - }, - - // TODO merge with previousPage - nextPage: function(event) { - if (this.hasScroll()) { - // TODO merge with no-scroll-else - if (!this.active || this.last()) { - this.activate(event, this.element.children(".ui-menu-item:first")); - return; - } - var base = this.active.offset().top, - height = this.element.height(), - result = this.element.children(".ui-menu-item").filter(function() { - var close = $(this).offset().top - base - height + $(this).height(); - // TODO improve approximation - return close < 10 && close > -10; - }); - - // TODO try to catch this earlier when scrollTop indicates the last page anyway - if (!result.length) { - result = this.element.children(".ui-menu-item:last"); - } - this.activate(event, result); - } else { - this.activate(event, this.element.children(".ui-menu-item") - .filter(!this.active || this.last() ? ":first" : ":last")); - } - }, - - // TODO merge with nextPage - previousPage: function(event) { - if (this.hasScroll()) { - // TODO merge with no-scroll-else - if (!this.active || this.first()) { - this.activate(event, this.element.children(".ui-menu-item:last")); - return; - } - - var base = this.active.offset().top, - height = this.element.height(); - result = this.element.children(".ui-menu-item").filter(function() { - var close = $(this).offset().top - base + height - $(this).height(); - // TODO improve approximation - return close < 10 && close > -10; - }); - - // TODO try to catch this earlier when scrollTop indicates the last page anyway - if (!result.length) { - result = this.element.children(".ui-menu-item:first"); - } - this.activate(event, result); - } else { - this.activate(event, this.element.children(".ui-menu-item") - .filter(!this.active || this.first() ? ":last" : ":first")); - } - }, - - hasScroll: function() { - return this.element.height() < this.element.attr("scrollHeight"); - }, - - select: function( event ) { - this._trigger("selected", event, { item: this.active }); - } -}); - -}(jQuery)); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.button.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.button.js deleted file mode 100644 index 27420185bb..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.button.js +++ /dev/null @@ -1,383 +0,0 @@ -/* - * jQuery UI Button 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -var lastActive, - baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - stateClasses = "ui-state-hover ui-state-active ", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", - formResetHandler = function( event ) { - $( ":ui-button", event.target.form ).each(function() { - var inst = $( this ).data( "button" ); - setTimeout(function() { - inst.refresh(); - }, 1 ); - }); - }, - radioGroup = function( radio ) { - var name = radio.name, - form = radio.form, - radios = $( [] ); - if ( name ) { - if ( form ) { - radios = $( form ).find( "[name='" + name + "']" ); - } else { - radios = $( "[name='" + name + "']", radio.ownerDocument ) - .filter(function() { - return !this.form; - }); - } - } - return radios; - }; - -$.widget( "ui.button", { - options: { - disabled: null, - text: true, - label: null, - icons: { - primary: null, - secondary: null - } - }, - _create: function() { - this.element.closest( "form" ) - .unbind( "reset.button" ) - .bind( "reset.button", formResetHandler ); - - if ( typeof this.options.disabled !== "boolean" ) { - this.options.disabled = this.element.attr( "disabled" ); - } - - this._determineButtonType(); - this.hasTitle = !!this.buttonElement.attr( "title" ); - - var self = this, - options = this.options, - toggleButton = this.type === "checkbox" || this.type === "radio", - hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), - focusClass = "ui-state-focus"; - - if ( options.label === null ) { - options.label = this.buttonElement.html(); - } - - if ( this.element.is( ":disabled" ) ) { - options.disabled = true; - } - - this.buttonElement - .addClass( baseClasses ) - .attr( "role", "button" ) - .bind( "mouseenter.button", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-hover" ); - if ( this === lastActive ) { - $( this ).addClass( "ui-state-active" ); - } - }) - .bind( "mouseleave.button", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( hoverClass ); - }) - .bind( "focus.button", function() { - // no need to check disabled, focus won't be triggered anyway - $( this ).addClass( focusClass ); - }) - .bind( "blur.button", function() { - $( this ).removeClass( focusClass ); - }); - - if ( toggleButton ) { - this.element.bind( "change.button", function() { - self.refresh(); - }); - } - - if ( this.type === "checkbox" ) { - this.buttonElement.bind( "click.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).toggleClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", self.element[0].checked ); - }); - } else if ( this.type === "radio" ) { - this.buttonElement.bind( "click.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).addClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", true ); - - var radio = self.element[ 0 ]; - radioGroup( radio ) - .not( radio ) - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); - }); - } else { - this.buttonElement - .bind( "mousedown.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).addClass( "ui-state-active" ); - lastActive = this; - $( document ).one( "mouseup", function() { - lastActive = null; - }); - }) - .bind( "mouseup.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).removeClass( "ui-state-active" ); - }) - .bind( "keydown.button", function(event) { - if ( options.disabled ) { - return false; - } - if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { - $( this ).addClass( "ui-state-active" ); - } - }) - .bind( "keyup.button", function() { - $( this ).removeClass( "ui-state-active" ); - }); - - if ( this.buttonElement.is("a") ) { - this.buttonElement.keyup(function(event) { - if ( event.keyCode === $.ui.keyCode.SPACE ) { - // TODO pass through original event correctly (just as 2nd argument doesn't work) - $( this ).click(); - } - }); - } - } - - // TODO: pull out $.Widget's handling for the disabled option into - // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can - // be overridden by individual plugins - this._setOption( "disabled", options.disabled ); - }, - - _determineButtonType: function() { - - if ( this.element.is(":checkbox") ) { - this.type = "checkbox"; - } else if ( this.element.is(":radio") ) { - this.type = "radio"; - } else if ( this.element.is("input") ) { - this.type = "input"; - } else { - this.type = "button"; - } - - if ( this.type === "checkbox" || this.type === "radio" ) { - // we don't search against the document in case the element - // is disconnected from the DOM - var ancestor = this.element.parents().filter(":last"), - labelSelector = "label[for=" + this.element.attr("id") + "]"; - this.buttonElement = ancestor.find( labelSelector ); - if ( !this.buttonElement.length ) { - ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); - this.buttonElement = ancestor.filter( labelSelector ); - if ( !this.buttonElement.length ) { - this.buttonElement = ancestor.find( labelSelector ); - } - } - this.element.addClass( "ui-helper-hidden-accessible" ); - - var checked = this.element.is( ":checked" ); - if ( checked ) { - this.buttonElement.addClass( "ui-state-active" ); - } - this.buttonElement.attr( "aria-pressed", checked ); - } else { - this.buttonElement = this.element; - } - }, - - widget: function() { - return this.buttonElement; - }, - - destroy: function() { - this.element - .removeClass( "ui-helper-hidden-accessible" ); - this.buttonElement - .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) - .removeAttr( "role" ) - .removeAttr( "aria-pressed" ) - .html( this.buttonElement.find(".ui-button-text").html() ); - - if ( !this.hasTitle ) { - this.buttonElement.removeAttr( "title" ); - } - - $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - if ( key === "disabled" ) { - if ( value ) { - this.element.attr( "disabled", true ); - } else { - this.element.removeAttr( "disabled" ); - } - } - this._resetButton(); - }, - - refresh: function() { - var isDisabled = this.element.is( ":disabled" ); - if ( isDisabled !== this.options.disabled ) { - this._setOption( "disabled", isDisabled ); - } - if ( this.type === "radio" ) { - radioGroup( this.element[0] ).each(function() { - if ( $( this ).is( ":checked" ) ) { - $( this ).button( "widget" ) - .addClass( "ui-state-active" ) - .attr( "aria-pressed", true ); - } else { - $( this ).button( "widget" ) - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); - } - }); - } else if ( this.type === "checkbox" ) { - if ( this.element.is( ":checked" ) ) { - this.buttonElement - .addClass( "ui-state-active" ) - .attr( "aria-pressed", true ); - } else { - this.buttonElement - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); - } - } - }, - - _resetButton: function() { - if ( this.type === "input" ) { - if ( this.options.label ) { - this.element.val( this.options.label ); - } - return; - } - var buttonElement = this.buttonElement.removeClass( typeClasses ), - buttonText = $( "" ) - .addClass( "ui-button-text" ) - .html( this.options.label ) - .appendTo( buttonElement.empty() ) - .text(), - icons = this.options.icons, - multipleIcons = icons.primary && icons.secondary, - buttonClasses = []; - - if ( icons.primary || icons.secondary ) { - if ( this.options.text ) { - buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); - } - - if ( icons.primary ) { - buttonElement.prepend( "" ); - } - - if ( icons.secondary ) { - buttonElement.append( "" ); - } - - if ( !this.options.text ) { - buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); - - if ( !this.hasTitle ) { - buttonElement.attr( "title", buttonText ); - } - } - } else { - buttonClasses.push( "ui-button-text-only" ); - } - buttonElement.addClass( buttonClasses.join( " " ) ); - } -}); - -$.widget( "ui.buttonset", { - options: { - items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" - }, - - _create: function() { - this.element.addClass( "ui-buttonset" ); - }, - - _init: function() { - this.refresh(); - }, - - _setOption: function( key, value ) { - if ( key === "disabled" ) { - this.buttons.button( "option", key, value ); - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - refresh: function() { - this.buttons = this.element.find( this.options.items ) - .filter( ":ui-button" ) - .button( "refresh" ) - .end() - .not( ":ui-button" ) - .button() - .end() - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) - .filter( ":first" ) - .addClass( "ui-corner-left" ) - .end() - .filter( ":last" ) - .addClass( "ui-corner-right" ) - .end() - .end(); - }, - - destroy: function() { - this.element.removeClass( "ui-buttonset" ); - this.buttons - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-corner-left ui-corner-right" ) - .end() - .button( "destroy" ); - - $.Widget.prototype.destroy.call( this ); - } -}); - -}( jQuery ) ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.core.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.core.js deleted file mode 100644 index abfa7e2d92..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.core.js +++ /dev/null @@ -1,308 +0,0 @@ -/*! - * jQuery UI 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function( $, undefined ) { - -// prevent duplicate loading -// this is only a problem because we proxy existing functions -// and we don't want to double proxy them -$.ui = $.ui || {}; -if ( $.ui.version ) { - return; -} - -$.extend( $.ui, { - version: "1.8.12", - - keyCode: { - ALT: 18, - BACKSPACE: 8, - CAPS_LOCK: 20, - COMMA: 188, - COMMAND: 91, - COMMAND_LEFT: 91, // COMMAND - COMMAND_RIGHT: 93, - CONTROL: 17, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - INSERT: 45, - LEFT: 37, - MENU: 93, // COMMAND_RIGHT - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SHIFT: 16, - SPACE: 32, - TAB: 9, - UP: 38, - WINDOWS: 91 // COMMAND - } -}); - -// plugins -$.fn.extend({ - _focus: $.fn.focus, - focus: function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - this._focus.apply( this, arguments ); - }, - - scrollParent: function() { - var scrollParent; - if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { - scrollParent = this.parents().filter(function() { - return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } else { - scrollParent = this.parents().filter(function() { - return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } - - return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
        - value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - }, - - disableSelection: function() { - return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + - ".ui-disableSelection", function( event ) { - event.preventDefault(); - }); - }, - - enableSelection: function() { - return this.unbind( ".ui-disableSelection" ); - } -}); - -$.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; - if ( border ) { - size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; -}); - -// selectors -function visible( element ) { - return !$( element ).parents().andSelf().filter(function() { - return $.curCSS( this, "visibility" ) === "hidden" || - $.expr.filters.hidden( this ); - }).length; -} - -$.extend( $.expr[ ":" ], { - data: function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - var nodeName = element.nodeName.toLowerCase(), - tabIndex = $.attr( element, "tabindex" ); - if ( "area" === nodeName ) { - var map = element.parentNode, - mapName = map.name, - img; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap=#" + mapName + "]" )[0]; - return !!img && visible( img ); - } - return ( /input|select|textarea|button|object/.test( nodeName ) - ? !element.disabled - : "a" == nodeName - ? element.href || !isNaN( tabIndex ) - : !isNaN( tabIndex )) - // the element and all of its ancestors must be visible - && visible( element ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ); - return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" ); - } -}); - -// support -$(function() { - var body = document.body, - div = body.appendChild( div = document.createElement( "div" ) ); - - $.extend( div.style, { - minHeight: "100px", - height: "auto", - padding: 0, - borderWidth: 0 - }); - - $.support.minHeight = div.offsetHeight === 100; - $.support.selectstart = "onselectstart" in div; - - // set display to none to avoid a layout bug in IE - // http://dev.jquery.com/ticket/4014 - body.removeChild( div ).style.display = "none"; -}); - - - - - -// deprecated -$.extend( $.ui, { - // $.ui.plugin is deprecated. Use the proxy pattern instead. - plugin: { - add: function( module, option, set ) { - var proto = $.ui[ module ].prototype; - for ( var i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args ) { - var set = instance.plugins[ name ]; - if ( !set || !instance.element[ 0 ].parentNode ) { - return; - } - - for ( var i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } - }, - - // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() - contains: function( a, b ) { - return document.compareDocumentPosition ? - a.compareDocumentPosition( b ) & 16 : - a !== b && a.contains( b ); - }, - - // only used by resizable - hasScroll: function( el, a ) { - - //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ( $( el ).css( "overflow" ) === "hidden") { - return false; - } - - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", - has = false; - - if ( el[ scroll ] > 0 ) { - return true; - } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; - return has; - }, - - // these are odd functions, fix the API or move into individual plugins - isOverAxis: function( x, reference, size ) { - //Determines when x coordinate is over "b" element axis - return ( x > reference ) && ( x < ( reference + size ) ); - }, - isOver: function( y, x, top, left, height, width ) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); - } -}); - -})( jQuery ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.datepicker.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.datepicker.js deleted file mode 100644 index 1cfbdddd43..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.datepicker.js +++ /dev/null @@ -1,1775 +0,0 @@ -/* - * jQuery UI Datepicker 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker - * - * Depends: - * jquery.ui.core.js - */ -(function( $, undefined ) { - -$.extend($.ui, { datepicker: { version: "1.8.12" } }); - -var PROP_NAME = 'datepicker'; -var dpuuid = new Date().getTime(); - -/* Date picker manager. - Use the singleton instance of this class, $.datepicker, to interact with the date picker. - Settings for (groups of) date pickers are maintained in an instance object, - allowing multiple different settings on the same page. */ - -function Datepicker() { - this.debug = false; // Change this to true to start debugging - this._curInst = null; // The current instance in use - this._keyEvent = false; // If the last event was a key event - this._disabledInputs = []; // List of date picker inputs that have been disabled - this._datepickerShowing = false; // True if the popup picker is showing , false if not - this._inDialog = false; // True if showing within a "dialog", false if not - this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division - this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class - this._appendClass = 'ui-datepicker-append'; // The name of the append marker class - this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class - this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class - this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class - this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class - this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class - this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class - this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - closeText: 'Done', // Display text for close link - prevText: 'Prev', // Display text for previous month link - nextText: 'Next', // Display text for next month link - currentText: 'Today', // Display text for current month link - monthNames: ['January','February','March','April','May','June', - 'July','August','September','October','November','December'], // Names of months for drop-down and formatting - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting - dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday - weekHeader: 'Wk', // Column header for week of the year - dateFormat: 'mm/dd/yy', // See format options on parseDate - firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... - isRTL: false, // True if right-to-left language, false if left-to-right - showMonthAfterYear: false, // True if the year select precedes month, false for month then year - yearSuffix: '' // Additional text to append to the year in the month headers - }; - this._defaults = { // Global defaults for all the date picker instances - showOn: 'focus', // 'focus' for popup on focus, - // 'button' for trigger button, or 'both' for either - showAnim: 'fadeIn', // Name of jQuery animation for popup - showOptions: {}, // Options for enhanced animations - defaultDate: null, // Used when field is blank: actual date, - // +/-number for offset from today, null for today - appendText: '', // Display text following the input box, e.g. showing the format - buttonText: '...', // Text for trigger button - buttonImage: '', // URL for trigger button image - buttonImageOnly: false, // True if the image appears alone, false if it appears on a button - hideIfNoPrevNext: false, // True to hide next/previous month links - // if not applicable, false to just disable them - navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links - gotoCurrent: false, // True if today link goes back to current selection instead - changeMonth: false, // True if month can be selected directly, false if only prev/next - changeYear: false, // True if year can be selected directly, false if only prev/next - yearRange: 'c-10:c+10', // Range of years to display in drop-down, - // either relative to today's year (-nn:+nn), relative to currently displayed year - // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) - showOtherMonths: false, // True to show dates in other months, false to leave blank - selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable - showWeek: false, // True to show week of the year, false to not show it - calculateWeek: this.iso8601Week, // How to calculate the week of the year, - // takes a Date and returns the number of the week for it - shortYearCutoff: '+10', // Short year values < this are in the current century, - // > this are in the previous century, - // string value starting with '+' for current year + value - minDate: null, // The earliest selectable date, or null for no limit - maxDate: null, // The latest selectable date, or null for no limit - duration: 'fast', // Duration of display/closure - beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', - // [2] = cell title (optional), e.g. $.datepicker.noWeekends - beforeShow: null, // Function that takes an input field and - // returns a set of custom settings for the date picker - onSelect: null, // Define a callback function when a date is selected - onChangeMonthYear: null, // Define a callback function when the month or year is changed - onClose: null, // Define a callback function when the datepicker is closed - numberOfMonths: 1, // Number of months to show at a time - showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) - stepMonths: 1, // Number of months to step back/forward - stepBigMonths: 12, // Number of months to step back/forward for the big links - altField: '', // Selector for an alternate field to store selected dates into - altFormat: '', // The date format to use for the alternate field - constrainInput: true, // The input is constrained by the current date format - showButtonPanel: false, // True to show button panel, false to not show it - autoSize: false // True to size the input for the date format, false to leave as is - }; - $.extend(this._defaults, this.regional['']); - this.dpDiv = $('
        '); -} - -$.extend(Datepicker.prototype, { - /* Class name added to elements to indicate already configured with a date picker. */ - markerClassName: 'hasDatepicker', - - /* Debug logging (if enabled). */ - log: function () { - if (this.debug) - console.log.apply('', arguments); - }, - - // TODO rename to "widget" when switching to widget factory - _widgetDatepicker: function() { - return this.dpDiv; - }, - - /* Override the default settings for all instances of the date picker. - @param settings object - the new settings to use as defaults (anonymous object) - @return the manager object */ - setDefaults: function(settings) { - extendRemove(this._defaults, settings || {}); - return this; - }, - - /* Attach the date picker to a jQuery selection. - @param target element - the target input field or division or span - @param settings object - the new settings to use for this date picker instance (anonymous) */ - _attachDatepicker: function(target, settings) { - // check for settings on the control itself - in namespace 'date:' - var inlineSettings = null; - for (var attrName in this._defaults) { - var attrValue = target.getAttribute('date:' + attrName); - if (attrValue) { - inlineSettings = inlineSettings || {}; - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - var nodeName = target.nodeName.toLowerCase(); - var inline = (nodeName == 'div' || nodeName == 'span'); - if (!target.id) { - this.uuid += 1; - target.id = 'dp' + this.uuid; - } - var inst = this._newInst($(target), inline); - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); - if (nodeName == 'input') { - this._connectDatepicker(target, inst); - } else if (inline) { - this._inlineDatepicker(target, inst); - } - }, - - /* Create a new instance object. */ - _newInst: function(target, inline) { - var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars - return {id: id, input: target, // associated target - selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection - drawMonth: 0, drawYear: 0, // month being drawn - inline: inline, // is datepicker inline or not - dpDiv: (!inline ? this.dpDiv : // presentation div - $('
        '))}; - }, - - /* Attach the date picker to an input field. */ - _connectDatepicker: function(target, inst) { - var input = $(target); - inst.append = $([]); - inst.trigger = $([]); - if (input.hasClass(this.markerClassName)) - return; - this._attachments(input, inst); - input.addClass(this.markerClassName).keydown(this._doKeyDown). - keypress(this._doKeyPress).keyup(this._doKeyUp). - bind("setData.datepicker", function(event, key, value) { - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key) { - return this._get(inst, key); - }); - this._autoSize(inst); - $.data(target, PROP_NAME, inst); - }, - - /* Make attachments based on settings. */ - _attachments: function(input, inst) { - var appendText = this._get(inst, 'appendText'); - var isRTL = this._get(inst, 'isRTL'); - if (inst.append) - inst.append.remove(); - if (appendText) { - inst.append = $('' + appendText + ''); - input[isRTL ? 'before' : 'after'](inst.append); - } - input.unbind('focus', this._showDatepicker); - if (inst.trigger) - inst.trigger.remove(); - var showOn = this._get(inst, 'showOn'); - if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field - input.focus(this._showDatepicker); - if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked - var buttonText = this._get(inst, 'buttonText'); - var buttonImage = this._get(inst, 'buttonImage'); - inst.trigger = $(this._get(inst, 'buttonImageOnly') ? - $('').addClass(this._triggerClass). - attr({ src: buttonImage, alt: buttonText, title: buttonText }) : - $('').addClass(this._triggerClass). - html(buttonImage == '' ? buttonText : $('').attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? 'before' : 'after'](inst.trigger); - inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) - $.datepicker._hideDatepicker(); - else - $.datepicker._showDatepicker(input[0]); - return false; - }); - } - }, - - /* Apply the maximum length for the date format. */ - _autoSize: function(inst) { - if (this._get(inst, 'autoSize') && !inst.inline) { - var date = new Date(2009, 12 - 1, 20); // Ensure double digits - var dateFormat = this._get(inst, 'dateFormat'); - if (dateFormat.match(/[DM]/)) { - var findMax = function(names) { - var max = 0; - var maxI = 0; - for (var i = 0; i < names.length; i++) { - if (names[i].length > max) { - max = names[i].length; - maxI = i; - } - } - return maxI; - }; - date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? - 'monthNames' : 'monthNamesShort')))); - date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? - 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); - } - inst.input.attr('size', this._formatDate(inst, date).length); - } - }, - - /* Attach an inline date picker to a div. */ - _inlineDatepicker: function(target, inst) { - var divSpan = $(target); - if (divSpan.hasClass(this.markerClassName)) - return; - divSpan.addClass(this.markerClassName).append(inst.dpDiv). - bind("setData.datepicker", function(event, key, value){ - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key){ - return this._get(inst, key); - }); - $.data(target, PROP_NAME, inst); - this._setDate(inst, this._getDefaultDate(inst), true); - this._updateDatepicker(inst); - this._updateAlternate(inst); - inst.dpDiv.show(); - }, - - /* Pop-up the date picker in a "dialog" box. - @param input element - ignored - @param date string or Date - the initial date to display - @param onSelect function - the function to call when a date is selected - @param settings object - update the dialog date picker instance's settings (anonymous object) - @param pos int[2] - coordinates for the dialog's position within the screen or - event - with x/y coordinates or - leave empty for default (screen centre) - @return the manager object */ - _dialogDatepicker: function(input, date, onSelect, settings, pos) { - var inst = this._dialogInst; // internal instance - if (!inst) { - this.uuid += 1; - var id = 'dp' + this.uuid; - this._dialogInput = $(''); - this._dialogInput.keydown(this._doKeyDown); - $('body').append(this._dialogInput); - inst = this._dialogInst = this._newInst(this._dialogInput, false); - inst.settings = {}; - $.data(this._dialogInput[0], PROP_NAME, inst); - } - extendRemove(inst.settings, settings || {}); - date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); - this._dialogInput.val(date); - - this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); - if (!this._pos) { - var browserWidth = document.documentElement.clientWidth; - var browserHeight = document.documentElement.clientHeight; - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; - var scrollY = document.documentElement.scrollTop || document.body.scrollTop; - this._pos = // should use actual width/height below - [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; - } - - // move input on screen for focus, but hidden behind dialog - this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); - inst.settings.onSelect = onSelect; - this._inDialog = true; - this.dpDiv.addClass(this._dialogClass); - this._showDatepicker(this._dialogInput[0]); - if ($.blockUI) - $.blockUI(this.dpDiv); - $.data(this._dialogInput[0], PROP_NAME, inst); - return this; - }, - - /* Detach a datepicker from its control. - @param target element - the target input field or division or span */ - _destroyDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - $.removeData(target, PROP_NAME); - if (nodeName == 'input') { - inst.append.remove(); - inst.trigger.remove(); - $target.removeClass(this.markerClassName). - unbind('focus', this._showDatepicker). - unbind('keydown', this._doKeyDown). - unbind('keypress', this._doKeyPress). - unbind('keyup', this._doKeyUp); - } else if (nodeName == 'div' || nodeName == 'span') - $target.removeClass(this.markerClassName).empty(); - }, - - /* Enable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _enableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = false; - inst.trigger.filter('button'). - each(function() { this.disabled = false; }).end(). - filter('img').css({opacity: '1.0', cursor: ''}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().removeClass('ui-state-disabled'); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - }, - - /* Disable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _disableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = true; - inst.trigger.filter('button'). - each(function() { this.disabled = true; }).end(). - filter('img').css({opacity: '0.5', cursor: 'default'}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().addClass('ui-state-disabled'); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - this._disabledInputs[this._disabledInputs.length] = target; - }, - - /* Is the first field in a jQuery collection disabled as a datepicker? - @param target element - the target input field or division or span - @return boolean - true if disabled, false if enabled */ - _isDisabledDatepicker: function(target) { - if (!target) { - return false; - } - for (var i = 0; i < this._disabledInputs.length; i++) { - if (this._disabledInputs[i] == target) - return true; - } - return false; - }, - - /* Retrieve the instance data for the target control. - @param target element - the target input field or division or span - @return object - the associated instance data - @throws error if a jQuery problem getting data */ - _getInst: function(target) { - try { - return $.data(target, PROP_NAME); - } - catch (err) { - throw 'Missing instance data for this datepicker'; - } - }, - - /* Update or retrieve the settings for a date picker attached to an input field or division. - @param target element - the target input field or division or span - @param name object - the new settings to update or - string - the name of the setting to change or retrieve, - when retrieving also 'all' for all instance settings or - 'defaults' for all global defaults - @param value any - the new value for the setting - (omit if above is an object or to retrieve a value) */ - _optionDatepicker: function(target, name, value) { - var inst = this._getInst(target); - if (arguments.length == 2 && typeof name == 'string') { - return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : - (inst ? (name == 'all' ? $.extend({}, inst.settings) : - this._get(inst, name)) : null)); - } - var settings = name || {}; - if (typeof name == 'string') { - settings = {}; - settings[name] = value; - } - if (inst) { - if (this._curInst == inst) { - this._hideDatepicker(); - } - var date = this._getDateDatepicker(target, true); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - extendRemove(inst.settings, settings); - // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided - if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) - inst.settings.minDate = this._formatDate(inst, minDate); - if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) - inst.settings.maxDate = this._formatDate(inst, maxDate); - this._attachments($(target), inst); - this._autoSize(inst); - this._setDateDatepicker(target, date); - this._updateDatepicker(inst); - } - }, - - // change method deprecated - _changeDatepicker: function(target, name, value) { - this._optionDatepicker(target, name, value); - }, - - /* Redraw the date picker attached to an input field or division. - @param target element - the target input field or division or span */ - _refreshDatepicker: function(target) { - var inst = this._getInst(target); - if (inst) { - this._updateDatepicker(inst); - } - }, - - /* Set the dates for a jQuery selection. - @param target element - the target input field or division or span - @param date Date - the new date */ - _setDateDatepicker: function(target, date) { - var inst = this._getInst(target); - if (inst) { - this._setDate(inst, date); - this._updateDatepicker(inst); - this._updateAlternate(inst); - } - }, - - /* Get the date(s) for the first entry in a jQuery selection. - @param target element - the target input field or division or span - @param noDefault boolean - true if no default date is to be used - @return Date - the current date */ - _getDateDatepicker: function(target, noDefault) { - var inst = this._getInst(target); - if (inst && !inst.inline) - this._setDateFromField(inst, noDefault); - return (inst ? this._getDate(inst) : null); - }, - - /* Handle keystrokes. */ - _doKeyDown: function(event) { - var inst = $.datepicker._getInst(event.target); - var handled = true; - var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); - inst._keyEvent = true; - if ($.datepicker._datepickerShowing) - switch (event.keyCode) { - case 9: $.datepicker._hideDatepicker(); - handled = false; - break; // hide on tab out - case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + - $.datepicker._currentClass + ')', inst.dpDiv); - if (sel[0]) - $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); - else - $.datepicker._hideDatepicker(); - return false; // don't submit the form - break; // select the value on enter - case 27: $.datepicker._hideDatepicker(); - break; // hide on escape - case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // previous month/year on page up/+ ctrl - case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // next month/year on page down/+ ctrl - case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); - handled = event.ctrlKey || event.metaKey; - break; // clear on ctrl or command +end - case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); - handled = event.ctrlKey || event.metaKey; - break; // current on ctrl or command +home - case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); - handled = event.ctrlKey || event.metaKey; - // -1 day on ctrl or command +left - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +left on Mac - break; - case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // -1 week on ctrl or command +up - case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); - handled = event.ctrlKey || event.metaKey; - // +1 day on ctrl or command +right - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +right - break; - case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // +1 week on ctrl or command +down - default: handled = false; - } - else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home - $.datepicker._showDatepicker(this); - else { - handled = false; - } - if (handled) { - event.preventDefault(); - event.stopPropagation(); - } - }, - - /* Filter entered characters - based on date format. */ - _doKeyPress: function(event) { - var inst = $.datepicker._getInst(event.target); - if ($.datepicker._get(inst, 'constrainInput')) { - var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); - var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); - return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); - } - }, - - /* Synchronise manual entry and field/alternate field. */ - _doKeyUp: function(event) { - var inst = $.datepicker._getInst(event.target); - if (inst.input.val() != inst.lastVal) { - try { - var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - (inst.input ? inst.input.val() : null), - $.datepicker._getFormatConfig(inst)); - if (date) { // only if valid - $.datepicker._setDateFromField(inst); - $.datepicker._updateAlternate(inst); - $.datepicker._updateDatepicker(inst); - } - } - catch (event) { - $.datepicker.log(event); - } - } - return true; - }, - - /* Pop-up the date picker for a given input field. - @param input element - the input field attached to the date picker or - event - if triggered by focus */ - _showDatepicker: function(input) { - input = input.target || input; - if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger - input = $('input', input.parentNode)[0]; - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here - return; - var inst = $.datepicker._getInst(input); - if ($.datepicker._curInst && $.datepicker._curInst != inst) { - $.datepicker._curInst.dpDiv.stop(true, true); - } - var beforeShow = $.datepicker._get(inst, 'beforeShow'); - extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); - inst.lastVal = null; - $.datepicker._lastInput = input; - $.datepicker._setDateFromField(inst); - if ($.datepicker._inDialog) // hide cursor - input.value = ''; - if (!$.datepicker._pos) { // position below input - $.datepicker._pos = $.datepicker._findPos(input); - $.datepicker._pos[1] += input.offsetHeight; // add the height - } - var isFixed = false; - $(input).parents().each(function() { - isFixed |= $(this).css('position') == 'fixed'; - return !isFixed; - }); - if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled - $.datepicker._pos[0] -= document.documentElement.scrollLeft; - $.datepicker._pos[1] -= document.documentElement.scrollTop; - } - var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; - $.datepicker._pos = null; - //to avoid flashes on Firefox - inst.dpDiv.empty(); - // determine sizing offscreen - inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); - $.datepicker._updateDatepicker(inst); - // fix width for dynamic number of date pickers - // and adjust position before showing - offset = $.datepicker._checkOffset(inst, offset, isFixed); - inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? - 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', - left: offset.left + 'px', top: offset.top + 'px'}); - if (!inst.inline) { - var showAnim = $.datepicker._get(inst, 'showAnim'); - var duration = $.datepicker._get(inst, 'duration'); - var postProcess = function() { - $.datepicker._datepickerShowing = true; - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !! cover.length ){ - var borders = $.datepicker._getBorders(inst.dpDiv); - cover.css({left: -borders[0], top: -borders[1], - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); - } - }; - inst.dpDiv.zIndex($(input).zIndex()+1); - if ($.effects && $.effects[showAnim]) - inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); - if (!showAnim || !duration) - postProcess(); - if (inst.input.is(':visible') && !inst.input.is(':disabled')) - inst.input.focus(); - $.datepicker._curInst = inst; - } - }, - - /* Generate the date picker content. */ - _updateDatepicker: function(inst) { - var self = this; - var borders = $.datepicker._getBorders(inst.dpDiv); - inst.dpDiv.empty().append(this._generateHTML(inst)); - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 - cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) - } - inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') - .bind('mouseout', function(){ - $(this).removeClass('ui-state-hover'); - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); - }) - .bind('mouseover', function(){ - if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { - $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - $(this).addClass('ui-state-hover'); - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); - } - }) - .end() - .find('.' + this._dayOverClass + ' a') - .trigger('mouseover') - .end(); - var numMonths = this._getNumberOfMonths(inst); - var cols = numMonths[1]; - var width = 17; - if (cols > 1) - inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); - else - inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); - inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + - 'Class']('ui-datepicker-multi'); - inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + - 'Class']('ui-datepicker-rtl'); - if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && - // #6694 - don't focus the input if it's already focused - // this breaks the change event in IE - inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) - inst.input.focus(); - // deffered render of the years select (to avoid flashes on Firefox) - if( inst.yearshtml ){ - var origyearshtml = inst.yearshtml; - setTimeout(function(){ - //assure that inst.yearshtml didn't change. - if( origyearshtml === inst.yearshtml ){ - inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); - } - origyearshtml = inst.yearshtml = null; - }, 0); - } - }, - - /* Retrieve the size of left and top borders for an element. - @param elem (jQuery object) the element of interest - @return (number[2]) the left and top borders */ - _getBorders: function(elem) { - var convert = function(value) { - return {thin: 1, medium: 2, thick: 3}[value] || value; - }; - return [parseFloat(convert(elem.css('border-left-width'))), - parseFloat(convert(elem.css('border-top-width')))]; - }, - - /* Check positioning to remain on screen. */ - _checkOffset: function(inst, offset, isFixed) { - var dpWidth = inst.dpDiv.outerWidth(); - var dpHeight = inst.dpDiv.outerHeight(); - var inputWidth = inst.input ? inst.input.outerWidth() : 0; - var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); - var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); - - offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); - offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; - offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; - - // now check if datepicker is showing outside window viewport - move to a better place if so. - offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? - Math.abs(offset.left + dpWidth - viewWidth) : 0); - offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? - Math.abs(dpHeight + inputHeight) : 0); - - return offset; - }, - - /* Find an object's position on the screen. */ - _findPos: function(obj) { - var inst = this._getInst(obj); - var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; - } - var position = $(obj).offset(); - return [position.left, position.top]; - }, - - /* Hide the date picker from view. - @param input element - the input field attached to the date picker */ - _hideDatepicker: function(input) { - var inst = this._curInst; - if (!inst || (input && inst != $.data(input, PROP_NAME))) - return; - if (this._datepickerShowing) { - var showAnim = this._get(inst, 'showAnim'); - var duration = this._get(inst, 'duration'); - var postProcess = function() { - $.datepicker._tidyDialog(inst); - this._curInst = null; - }; - if ($.effects && $.effects[showAnim]) - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : - (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); - if (!showAnim) - postProcess(); - var onClose = this._get(inst, 'onClose'); - if (onClose) - onClose.apply((inst.input ? inst.input[0] : null), - [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback - this._datepickerShowing = false; - this._lastInput = null; - if (this._inDialog) { - this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); - if ($.blockUI) { - $.unblockUI(); - $('body').append(this.dpDiv); - } - } - this._inDialog = false; - } - }, - - /* Tidy up after a dialog display. */ - _tidyDialog: function(inst) { - inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); - }, - - /* Close date picker if clicked elsewhere. */ - _checkExternalClick: function(event) { - if (!$.datepicker._curInst) - return; - var $target = $(event.target); - if ($target[0].id != $.datepicker._mainDivId && - $target.parents('#' + $.datepicker._mainDivId).length == 0 && - !$target.hasClass($.datepicker.markerClassName) && - !$target.hasClass($.datepicker._triggerClass) && - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) - $.datepicker._hideDatepicker(); - }, - - /* Adjust one of the date sub-fields. */ - _adjustDate: function(id, offset, period) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._isDisabledDatepicker(target[0])) { - return; - } - this._adjustInstDate(inst, offset + - (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning - period); - this._updateDatepicker(inst); - }, - - /* Action for current link. */ - _gotoToday: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._get(inst, 'gotoCurrent') && inst.currentDay) { - inst.selectedDay = inst.currentDay; - inst.drawMonth = inst.selectedMonth = inst.currentMonth; - inst.drawYear = inst.selectedYear = inst.currentYear; - } - else { - var date = new Date(); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - } - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a new month/year. */ - _selectMonthYear: function(id, select, period) { - var target = $(id); - var inst = this._getInst(target[0]); - inst._selectingMonthYear = false; - inst['selected' + (period == 'M' ? 'Month' : 'Year')] = - inst['draw' + (period == 'M' ? 'Month' : 'Year')] = - parseInt(select.options[select.selectedIndex].value,10); - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Restore input focus after not changing month/year. */ - _clickMonthYear: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (inst.input && inst._selectingMonthYear) { - setTimeout(function() { - inst.input.focus(); - }, 0); - } - inst._selectingMonthYear = !inst._selectingMonthYear; - }, - - /* Action for selecting a day. */ - _selectDay: function(id, month, year, td) { - var target = $(id); - if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { - return; - } - var inst = this._getInst(target[0]); - inst.selectedDay = inst.currentDay = $('a', td).html(); - inst.selectedMonth = inst.currentMonth = month; - inst.selectedYear = inst.currentYear = year; - this._selectDate(id, this._formatDate(inst, - inst.currentDay, inst.currentMonth, inst.currentYear)); - }, - - /* Erase the input field and hide the date picker. */ - _clearDate: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - this._selectDate(target, ''); - }, - - /* Update the input field with the selected date. */ - _selectDate: function(id, dateStr) { - var target = $(id); - var inst = this._getInst(target[0]); - dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); - if (inst.input) - inst.input.val(dateStr); - this._updateAlternate(inst); - var onSelect = this._get(inst, 'onSelect'); - if (onSelect) - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback - else if (inst.input) - inst.input.trigger('change'); // fire the change event - if (inst.inline) - this._updateDatepicker(inst); - else { - this._hideDatepicker(); - this._lastInput = inst.input[0]; - if (typeof(inst.input[0]) != 'object') - inst.input.focus(); // restore focus - this._lastInput = null; - } - }, - - /* Update any alternate field to synchronise with the main field. */ - _updateAlternate: function(inst) { - var altField = this._get(inst, 'altField'); - if (altField) { // update alternate field too - var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); - var date = this._getDate(inst); - var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); - $(altField).each(function() { $(this).val(dateStr); }); - } - }, - - /* Set as beforeShowDay function to prevent selection of weekends. - @param date Date - the date to customise - @return [boolean, string] - is this date selectable?, what is its CSS class? */ - noWeekends: function(date) { - var day = date.getDay(); - return [(day > 0 && day < 6), '']; - }, - - /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. - @param date Date - the date to get the week for - @return number - the number of the week within the year that contains this date */ - iso8601Week: function(date) { - var checkDate = new Date(date.getTime()); - // Find Thursday of this week starting on Monday - checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - var time = checkDate.getTime(); - checkDate.setMonth(0); // Compare with Jan 1 - checkDate.setDate(1); - return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; - }, - - /* Parse a string value into a date object. - See formatDate below for the possible formats. - - @param format string - the expected format of the date - @param value string - the date in the above format - @param settings Object - attributes include: - shortYearCutoff number - the cutoff year for determining the century (optional) - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return Date - the extracted date value or null if value is blank */ - parseDate: function (format, value, settings) { - if (format == null || value == null) - throw 'Invalid arguments'; - value = (typeof value == 'object' ? value.toString() : value + ''); - if (value == '') - return null; - var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - var year = -1; - var month = -1; - var day = -1; - var doy = -1; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Extract a number from the string value - var getNumber = function(match) { - var isDoubled = lookAhead(match); - var size = (match == '@' ? 14 : (match == '!' ? 20 : - (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); - var digits = new RegExp('^\\d{1,' + size + '}'); - var num = value.substring(iValue).match(digits); - if (!num) - throw 'Missing number at position ' + iValue; - iValue += num[0].length; - return parseInt(num[0], 10); - }; - // Extract a name from the string value and convert to an index - var getName = function(match, shortNames, longNames) { - var names = (lookAhead(match) ? longNames : shortNames); - for (var i = 0; i < names.length; i++) { - if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) { - iValue += names[i].length; - return i + 1; - } - } - throw 'Unknown name at position ' + iValue; - }; - // Confirm that a literal character matches the string value - var checkLiteral = function() { - if (value.charAt(iValue) != format.charAt(iFormat)) - throw 'Unexpected literal at position ' + iValue; - iValue++; - }; - var iValue = 0; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - checkLiteral(); - else - switch (format.charAt(iFormat)) { - case 'd': - day = getNumber('d'); - break; - case 'D': - getName('D', dayNamesShort, dayNames); - break; - case 'o': - doy = getNumber('o'); - break; - case 'm': - month = getNumber('m'); - break; - case 'M': - month = getName('M', monthNamesShort, monthNames); - break; - case 'y': - year = getNumber('y'); - break; - case '@': - var date = new Date(getNumber('@')); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case '!': - var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "'": - if (lookAhead("'")) - checkLiteral(); - else - literal = true; - break; - default: - checkLiteral(); - } - } - if (year == -1) - year = new Date().getFullYear(); - else if (year < 100) - year += new Date().getFullYear() - new Date().getFullYear() % 100 + - (year <= shortYearCutoff ? 0 : -100); - if (doy > -1) { - month = 1; - day = doy; - do { - var dim = this._getDaysInMonth(year, month - 1); - if (day <= dim) - break; - month++; - day -= dim; - } while (true); - } - var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) - throw 'Invalid date'; // E.g. 31/02/00 - return date; - }, - - /* Standard date formats. */ - ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) - COOKIE: 'D, dd M yy', - ISO_8601: 'yy-mm-dd', - RFC_822: 'D, d M y', - RFC_850: 'DD, dd-M-y', - RFC_1036: 'D, d M y', - RFC_1123: 'D, d M yy', - RFC_2822: 'D, d M yy', - RSS: 'D, d M y', // RFC 822 - TICKS: '!', - TIMESTAMP: '@', - W3C: 'yy-mm-dd', // ISO 8601 - - _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + - Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), - - /* Format a date object into a string value. - The format can be combinations of the following: - d - day of month (no leading zero) - dd - day of month (two digit) - o - day of year (no leading zeros) - oo - day of year (three digit) - D - day name short - DD - day name long - m - month of year (no leading zero) - mm - month of year (two digit) - M - month name short - MM - month name long - y - year (two digit) - yy - year (four digit) - @ - Unix timestamp (ms since 01/01/1970) - ! - Windows ticks (100ns since 01/01/0001) - '...' - literal text - '' - single quote - - @param format string - the desired format of the date - @param date Date - the date value to format - @param settings Object - attributes include: - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return string - the date in the above format */ - formatDate: function (format, date, settings) { - if (!date) - return ''; - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Format a number, with leading zero if necessary - var formatNumber = function(match, value, len) { - var num = '' + value; - if (lookAhead(match)) - while (num.length < len) - num = '0' + num; - return num; - }; - // Format a name, short or long as requested - var formatName = function(match, value, shortNames, longNames) { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }; - var output = ''; - var literal = false; - if (date) - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - output += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': - output += formatNumber('d', date.getDate(), 2); - break; - case 'D': - output += formatName('D', date.getDay(), dayNamesShort, dayNames); - break; - case 'o': - output += formatNumber('o', - (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3); - break; - case 'm': - output += formatNumber('m', date.getMonth() + 1, 2); - break; - case 'M': - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); - break; - case 'y': - output += (lookAhead('y') ? date.getFullYear() : - (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); - break; - case '@': - output += date.getTime(); - break; - case '!': - output += date.getTime() * 10000 + this._ticksTo1970; - break; - case "'": - if (lookAhead("'")) - output += "'"; - else - literal = true; - break; - default: - output += format.charAt(iFormat); - } - } - return output; - }, - - /* Extract all possible characters from the date format. */ - _possibleChars: function (format) { - var chars = ''; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - for (var iFormat = 0; iFormat < format.length; iFormat++) - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - chars += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': case 'm': case 'y': case '@': - chars += '0123456789'; - break; - case 'D': case 'M': - return null; // Accept anything - case "'": - if (lookAhead("'")) - chars += "'"; - else - literal = true; - break; - default: - chars += format.charAt(iFormat); - } - return chars; - }, - - /* Get a setting value, defaulting if necessary. */ - _get: function(inst, name) { - return inst.settings[name] !== undefined ? - inst.settings[name] : this._defaults[name]; - }, - - /* Parse existing date and initialise date picker. */ - _setDateFromField: function(inst, noDefault) { - if (inst.input.val() == inst.lastVal) { - return; - } - var dateFormat = this._get(inst, 'dateFormat'); - var dates = inst.lastVal = inst.input ? inst.input.val() : null; - var date, defaultDate; - date = defaultDate = this._getDefaultDate(inst); - var settings = this._getFormatConfig(inst); - try { - date = this.parseDate(dateFormat, dates, settings) || defaultDate; - } catch (event) { - this.log(event); - dates = (noDefault ? '' : dates); - } - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - inst.currentDay = (dates ? date.getDate() : 0); - inst.currentMonth = (dates ? date.getMonth() : 0); - inst.currentYear = (dates ? date.getFullYear() : 0); - this._adjustInstDate(inst); - }, - - /* Retrieve the default date shown on opening. */ - _getDefaultDate: function(inst) { - return this._restrictMinMax(inst, - this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); - }, - - /* A date may be specified as an exact value or a relative one. */ - _determineDate: function(inst, date, defaultDate) { - var offsetNumeric = function(offset) { - var date = new Date(); - date.setDate(date.getDate() + offset); - return date; - }; - var offsetString = function(offset) { - try { - return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - offset, $.datepicker._getFormatConfig(inst)); - } - catch (e) { - // Ignore - } - var date = (offset.toLowerCase().match(/^c/) ? - $.datepicker._getDate(inst) : null) || new Date(); - var year = date.getFullYear(); - var month = date.getMonth(); - var day = date.getDate(); - var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; - var matches = pattern.exec(offset); - while (matches) { - switch (matches[2] || 'd') { - case 'd' : case 'D' : - day += parseInt(matches[1],10); break; - case 'w' : case 'W' : - day += parseInt(matches[1],10) * 7; break; - case 'm' : case 'M' : - month += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - case 'y': case 'Y' : - year += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - } - matches = pattern.exec(offset); - } - return new Date(year, month, day); - }; - var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); - newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); - if (newDate) { - newDate.setHours(0); - newDate.setMinutes(0); - newDate.setSeconds(0); - newDate.setMilliseconds(0); - } - return this._daylightSavingAdjust(newDate); - }, - - /* Handle switch to/from daylight saving. - Hours may be non-zero on daylight saving cut-over: - > 12 when midnight changeover, but then cannot generate - midnight datetime, so jump to 1AM, otherwise reset. - @param date (Date) the date to check - @return (Date) the corrected date */ - _daylightSavingAdjust: function(date) { - if (!date) return null; - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - return date; - }, - - /* Set the date(s) directly. */ - _setDate: function(inst, date, noChange) { - var clear = !date; - var origMonth = inst.selectedMonth; - var origYear = inst.selectedYear; - var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); - inst.selectedDay = inst.currentDay = newDate.getDate(); - inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); - inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); - if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) - this._notifyChange(inst); - this._adjustInstDate(inst); - if (inst.input) { - inst.input.val(clear ? '' : this._formatDate(inst)); - } - }, - - /* Retrieve the date(s) directly. */ - _getDate: function(inst) { - var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : - this._daylightSavingAdjust(new Date( - inst.currentYear, inst.currentMonth, inst.currentDay))); - return startDate; - }, - - /* Generate the HTML for the current state of the date picker. */ - _generateHTML: function(inst) { - var today = new Date(); - today = this._daylightSavingAdjust( - new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time - var isRTL = this._get(inst, 'isRTL'); - var showButtonPanel = this._get(inst, 'showButtonPanel'); - var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); - var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); - var numMonths = this._getNumberOfMonths(inst); - var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); - var stepMonths = this._get(inst, 'stepMonths'); - var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); - var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var drawMonth = inst.drawMonth - showCurrentAtPos; - var drawYear = inst.drawYear; - if (drawMonth < 0) { - drawMonth += 12; - drawYear--; - } - if (maxDate) { - var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), - maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); - maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); - while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { - drawMonth--; - if (drawMonth < 0) { - drawMonth = 11; - drawYear--; - } - } - } - inst.drawMonth = drawMonth; - inst.drawYear = drawYear; - var prevText = this._get(inst, 'prevText'); - prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), - this._getFormatConfig(inst))); - var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '' + prevText + '' : - (hideIfNoPrevNext ? '' : '' + prevText + '')); - var nextText = this._get(inst, 'nextText'); - nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), - this._getFormatConfig(inst))); - var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '' + nextText + '' : - (hideIfNoPrevNext ? '' : '' + nextText + '')); - var currentText = this._get(inst, 'currentText'); - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); - currentText = (!navigationAsDateFormat ? currentText : - this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '' : ''); - var buttonPanel = (showButtonPanel) ? '
        ' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
        ' : ''; - var firstDay = parseInt(this._get(inst, 'firstDay'),10); - firstDay = (isNaN(firstDay) ? 0 : firstDay); - var showWeek = this._get(inst, 'showWeek'); - var dayNames = this._get(inst, 'dayNames'); - var dayNamesShort = this._get(inst, 'dayNamesShort'); - var dayNamesMin = this._get(inst, 'dayNamesMin'); - var monthNames = this._get(inst, 'monthNames'); - var monthNamesShort = this._get(inst, 'monthNamesShort'); - var beforeShowDay = this._get(inst, 'beforeShowDay'); - var showOtherMonths = this._get(inst, 'showOtherMonths'); - var selectOtherMonths = this._get(inst, 'selectOtherMonths'); - var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; - var defaultDate = this._getDefaultDate(inst); - var html = ''; - for (var row = 0; row < numMonths[0]; row++) { - var group = ''; - for (var col = 0; col < numMonths[1]; col++) { - var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); - var cornerClass = ' ui-corner-all'; - var calender = ''; - if (isMultiMonth) { - calender += '
        '; - } - calender += '
        ' + - (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + - (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + - this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, - row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers - '
        ' + - ''; - var thead = (showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // days of the week - var day = (dow + firstDay) % 7; - thead += '= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + - '' + dayNamesMin[day] + ''; - } - calender += thead + ''; - var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); - if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) - inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); - var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate - var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows - calender += ''; - var tbody = (!showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // create date picker days - var daySettings = (beforeShowDay ? - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); - var otherMonth = (printDate.getMonth() != drawMonth); - var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || - (minDate && printDate < minDate) || (maxDate && printDate > maxDate); - tbody += ''; // display selectable date - printDate.setDate(printDate.getDate() + 1); - printDate = this._daylightSavingAdjust(printDate); - } - calender += tbody + ''; - } - drawMonth++; - if (drawMonth > 11) { - drawMonth = 0; - drawYear++; - } - calender += '
        ' + this._get(inst, 'weekHeader') + '
        ' + - this._get(inst, 'calculateWeek')(printDate) + '' + // actions - (otherMonth && !showOtherMonths ? ' ' : // display for other months - (unselectable ? '' + printDate.getDate() + '' : '' + printDate.getDate() + '')) + '
        ' + (isMultiMonth ? '
        ' + - ((numMonths[0] > 0 && col == numMonths[1]-1) ? '
        ' : '') : ''); - group += calender; - } - html += group; - } - html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? - '' : ''); - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '
        '; - var monthHtml = ''; - // month selection - if (secondary || !changeMonth) - monthHtml += '' + monthNames[drawMonth] + ''; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += ''; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); - // year selection - if ( !inst.yearshtml ) { - inst.yearshtml = ''; - if (secondary || !changeYear) - html += '' + drawYear + ''; - else { - // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ''; - //when showing there is no need for later update - if( ! $.browser.mozilla ){ - html += inst.yearshtml; - inst.yearshtml = null; - } else { - // will be replaced later with inst.yearshtml - html += ''; - } - } - } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '
        '; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') - this._notifyChange(inst); - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var newDate = (minDate && date < minDate ? minDate : date); - newDate = (maxDate && newDate > maxDate ? maxDate : newDate); - return newDate; - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day == 'object' ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); - } -}); - -/* jQuery extend now ignores nulls! */ -function extendRemove(target, props) { - $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) - target[name] = props[name]; - return target; -}; - -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - -/* Invoke the datepicker functionality. - @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality - @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Verify an empty collection wasn't passed - Fixes #6976 */ - if ( !this.length ) { - return this; - } - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); - $.datepicker.initialized = true; - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.12"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.dialog.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.dialog.js deleted file mode 100644 index b0ecd4ca57..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.dialog.js +++ /dev/null @@ -1,878 +0,0 @@ -/* - * jQuery UI Dialog 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.button.js - * jquery.ui.draggable.js - * jquery.ui.mouse.js - * jquery.ui.position.js - * jquery.ui.resizable.js - */ -(function( $, undefined ) { - -var uiDialogClasses = - 'ui-dialog ' + - 'ui-widget ' + - 'ui-widget-content ' + - 'ui-corner-all ', - sizeRelatedOptions = { - buttons: true, - height: true, - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true, - width: true - }, - resizableRelatedOptions = { - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true - }, - // support for jQuery 1.3.2 - handle common attrFn methods for dialog - attrFn = $.attrFn || { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true, - click: true - }; - -$.widget("ui.dialog", { - options: { - autoOpen: true, - buttons: {}, - closeOnEscape: true, - closeText: 'close', - dialogClass: '', - draggable: true, - hide: null, - height: 'auto', - maxHeight: false, - maxWidth: false, - minHeight: 150, - minWidth: 150, - modal: false, - position: { - my: 'center', - at: 'center', - collision: 'fit', - // ensure that the titlebar is never outside the document - using: function(pos) { - var topOffset = $(this).css(pos).offset().top; - if (topOffset < 0) { - $(this).css('top', pos.top - topOffset); - } - } - }, - resizable: true, - show: null, - stack: true, - title: '', - width: 300, - zIndex: 1000 - }, - - _create: function() { - this.originalTitle = this.element.attr('title'); - // #5742 - .attr() might return a DOMElement - if ( typeof this.originalTitle !== "string" ) { - this.originalTitle = ""; - } - - this.options.title = this.options.title || this.originalTitle; - var self = this, - options = self.options, - - title = options.title || ' ', - titleId = $.ui.dialog.getTitleId(self.element), - - uiDialog = (self.uiDialog = $('
        ')) - .appendTo(document.body) - .hide() - .addClass(uiDialogClasses + options.dialogClass) - .css({ - zIndex: options.zIndex - }) - // setting tabIndex makes the div focusable - // setting outline to 0 prevents a border on focus in Mozilla - .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { - if (options.closeOnEscape && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - self.close(event); - event.preventDefault(); - } - }) - .attr({ - role: 'dialog', - 'aria-labelledby': titleId - }) - .mousedown(function(event) { - self.moveToTop(false, event); - }), - - uiDialogContent = self.element - .show() - .removeAttr('title') - .addClass( - 'ui-dialog-content ' + - 'ui-widget-content') - .appendTo(uiDialog), - - uiDialogTitlebar = (self.uiDialogTitlebar = $('
        ')) - .addClass( - 'ui-dialog-titlebar ' + - 'ui-widget-header ' + - 'ui-corner-all ' + - 'ui-helper-clearfix' - ) - .prependTo(uiDialog), - - uiDialogTitlebarClose = $('') - .addClass( - 'ui-dialog-titlebar-close ' + - 'ui-corner-all' - ) - .attr('role', 'button') - .hover( - function() { - uiDialogTitlebarClose.addClass('ui-state-hover'); - }, - function() { - uiDialogTitlebarClose.removeClass('ui-state-hover'); - } - ) - .focus(function() { - uiDialogTitlebarClose.addClass('ui-state-focus'); - }) - .blur(function() { - uiDialogTitlebarClose.removeClass('ui-state-focus'); - }) - .click(function(event) { - self.close(event); - return false; - }) - .appendTo(uiDialogTitlebar), - - uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('')) - .addClass( - 'ui-icon ' + - 'ui-icon-closethick' - ) - .text(options.closeText) - .appendTo(uiDialogTitlebarClose), - - uiDialogTitle = $('') - .addClass('ui-dialog-title') - .attr('id', titleId) - .html(title) - .prependTo(uiDialogTitlebar); - - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { - options.beforeClose = options.beforeclose; - } - - uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); - - if (options.draggable && $.fn.draggable) { - self._makeDraggable(); - } - if (options.resizable && $.fn.resizable) { - self._makeResizable(); - } - - self._createButtons(options.buttons); - self._isOpen = false; - - if ($.fn.bgiframe) { - uiDialog.bgiframe(); - } - }, - - _init: function() { - if ( this.options.autoOpen ) { - this.open(); - } - }, - - destroy: function() { - var self = this; - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.hide(); - self.element - .unbind('.dialog') - .removeData('dialog') - .removeClass('ui-dialog-content ui-widget-content') - .hide().appendTo('body'); - self.uiDialog.remove(); - - if (self.originalTitle) { - self.element.attr('title', self.originalTitle); - } - - return self; - }, - - widget: function() { - return this.uiDialog; - }, - - close: function(event) { - var self = this, - maxZ, thisZ; - - if (false === self._trigger('beforeClose', event)) { - return; - } - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.unbind('keypress.ui-dialog'); - - self._isOpen = false; - - if (self.options.hide) { - self.uiDialog.hide(self.options.hide, function() { - self._trigger('close', event); - }); - } else { - self.uiDialog.hide(); - self._trigger('close', event); - } - - $.ui.dialog.overlay.resize(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - if (self.options.modal) { - maxZ = 0; - $('.ui-dialog').each(function() { - if (this !== self.uiDialog[0]) { - thisZ = $(this).css('z-index'); - if(!isNaN(thisZ)) { - maxZ = Math.max(maxZ, thisZ); - } - } - }); - $.ui.dialog.maxZ = maxZ; - } - - return self; - }, - - isOpen: function() { - return this._isOpen; - }, - - // the force parameter allows us to move modal dialogs to their correct - // position on open - moveToTop: function(force, event) { - var self = this, - options = self.options, - saveScroll; - - if ((options.modal && !force) || - (!options.stack && !options.modal)) { - return self._trigger('focus', event); - } - - if (options.zIndex > $.ui.dialog.maxZ) { - $.ui.dialog.maxZ = options.zIndex; - } - if (self.overlay) { - $.ui.dialog.maxZ += 1; - self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); - } - - //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. - // http://ui.jquery.com/bugs/ticket/3193 - saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') }; - $.ui.dialog.maxZ += 1; - self.uiDialog.css('z-index', $.ui.dialog.maxZ); - self.element.attr(saveScroll); - self._trigger('focus', event); - - return self; - }, - - open: function() { - if (this._isOpen) { return; } - - var self = this, - options = self.options, - uiDialog = self.uiDialog; - - self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; - self._size(); - self._position(options.position); - uiDialog.show(options.show); - self.moveToTop(true); - - // prevent tabbing out of modal dialogs - if (options.modal) { - uiDialog.bind('keypress.ui-dialog', function(event) { - if (event.keyCode !== $.ui.keyCode.TAB) { - return; - } - - var tabbables = $(':tabbable', this), - first = tabbables.filter(':first'), - last = tabbables.filter(':last'); - - if (event.target === last[0] && !event.shiftKey) { - first.focus(1); - return false; - } else if (event.target === first[0] && event.shiftKey) { - last.focus(1); - return false; - } - }); - } - - // set focus to the first tabbable element in the content area or the first button - // if there are no tabbable elements, set focus on the dialog itself - $(self.element.find(':tabbable').get().concat( - uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( - uiDialog.get()))).eq(0).focus(); - - self._isOpen = true; - self._trigger('open'); - - return self; - }, - - _createButtons: function(buttons) { - var self = this, - hasButtons = false, - uiDialogButtonPane = $('
        ') - .addClass( - 'ui-dialog-buttonpane ' + - 'ui-widget-content ' + - 'ui-helper-clearfix' - ), - uiButtonSet = $( "
        " ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); - - // if we already have a button pane, remove it - self.uiDialog.find('.ui-dialog-buttonpane').remove(); - - if (typeof buttons === 'object' && buttons !== null) { - $.each(buttons, function() { - return !(hasButtons = true); - }); - } - if (hasButtons) { - $.each(buttons, function(name, props) { - props = $.isFunction( props ) ? - { click: props, text: name } : - props; - var button = $('') - .click(function() { - props.click.apply(self.element[0], arguments); - }) - .appendTo(uiButtonSet); - // can't use .attr( props, true ) with jQuery 1.3.2. - $.each( props, function( key, value ) { - if ( key === "click" ) { - return; - } - if ( key in attrFn ) { - button[ key ]( value ); - } else { - button.attr( key, value ); - } - }); - if ($.fn.button) { - button.button(); - } - }); - uiDialogButtonPane.appendTo(self.uiDialog); - } - }, - - _makeDraggable: function() { - var self = this, - options = self.options, - doc = $(document), - heightBeforeDrag; - - function filteredUi(ui) { - return { - position: ui.position, - offset: ui.offset - }; - } - - self.uiDialog.draggable({ - cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', - handle: '.ui-dialog-titlebar', - containment: 'document', - start: function(event, ui) { - heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); - $(this).height($(this).height()).addClass("ui-dialog-dragging"); - self._trigger('dragStart', event, filteredUi(ui)); - }, - drag: function(event, ui) { - self._trigger('drag', event, filteredUi(ui)); - }, - stop: function(event, ui) { - options.position = [ui.position.left - doc.scrollLeft(), - ui.position.top - doc.scrollTop()]; - $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); - self._trigger('dragStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }); - }, - - _makeResizable: function(handles) { - handles = (handles === undefined ? this.options.resizable : handles); - var self = this, - options = self.options, - // .ui-resizable has position: relative defined in the stylesheet - // but dialogs have to use absolute or fixed positioning - position = self.uiDialog.css('position'), - resizeHandles = (typeof handles === 'string' ? - handles : - 'n,e,s,w,se,sw,ne,nw' - ); - - function filteredUi(ui) { - return { - originalPosition: ui.originalPosition, - originalSize: ui.originalSize, - position: ui.position, - size: ui.size - }; - } - - self.uiDialog.resizable({ - cancel: '.ui-dialog-content', - containment: 'document', - alsoResize: self.element, - maxWidth: options.maxWidth, - maxHeight: options.maxHeight, - minWidth: options.minWidth, - minHeight: self._minHeight(), - handles: resizeHandles, - start: function(event, ui) { - $(this).addClass("ui-dialog-resizing"); - self._trigger('resizeStart', event, filteredUi(ui)); - }, - resize: function(event, ui) { - self._trigger('resize', event, filteredUi(ui)); - }, - stop: function(event, ui) { - $(this).removeClass("ui-dialog-resizing"); - options.height = $(this).height(); - options.width = $(this).width(); - self._trigger('resizeStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }) - .css('position', position) - .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); - }, - - _minHeight: function() { - var options = this.options; - - if (options.height === 'auto') { - return options.minHeight; - } else { - return Math.min(options.minHeight, options.height); - } - }, - - _position: function(position) { - var myAt = [], - offset = [0, 0], - isVisible; - - if (position) { - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( - // if (typeof position == 'string' || $.isArray(position)) { - // myAt = $.isArray(position) ? position : position.split(' '); - - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length === 1) { - myAt[1] = myAt[0]; - } - - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] === myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; - } - }); - - position = { - my: myAt.join(" "), - at: myAt.join(" "), - offset: offset.join(" ") - }; - } - - position = $.extend({}, $.ui.dialog.prototype.options.position, position); - } else { - position = $.ui.dialog.prototype.options.position; - } - - // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is(':visible'); - if (!isVisible) { - this.uiDialog.show(); - } - this.uiDialog - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .position($.extend({ of: window }, position)); - if (!isVisible) { - this.uiDialog.hide(); - } - }, - - _setOptions: function( options ) { - var self = this, - resizableOptions = {}, - resize = false; - - $.each( options, function( key, value ) { - self._setOption( key, value ); - - if ( key in sizeRelatedOptions ) { - resize = true; - } - if ( key in resizableRelatedOptions ) { - resizableOptions[ key ] = value; - } - }); - - if ( resize ) { - this._size(); - } - if ( this.uiDialog.is( ":data(resizable)" ) ) { - this.uiDialog.resizable( "option", resizableOptions ); - } - }, - - _setOption: function(key, value){ - var self = this, - uiDialog = self.uiDialog; - - switch (key) { - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - case "beforeclose": - key = "beforeClose"; - break; - case "buttons": - self._createButtons(value); - break; - case "closeText": - // ensure that we always pass a string - self.uiDialogTitlebarCloseText.text("" + value); - break; - case "dialogClass": - uiDialog - .removeClass(self.options.dialogClass) - .addClass(uiDialogClasses + value); - break; - case "disabled": - if (value) { - uiDialog.addClass('ui-dialog-disabled'); - } else { - uiDialog.removeClass('ui-dialog-disabled'); - } - break; - case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); - if ( isDraggable && !value ) { - uiDialog.draggable( "destroy" ); - } - - if ( !isDraggable && value ) { - self._makeDraggable(); - } - break; - case "position": - self._position(value); - break; - case "resizable": - // currently resizable, becoming non-resizable - var isResizable = uiDialog.is( ":data(resizable)" ); - if (isResizable && !value) { - uiDialog.resizable('destroy'); - } - - // currently resizable, changing handles - if (isResizable && typeof value === 'string') { - uiDialog.resizable('option', 'handles', value); - } - - // currently non-resizable, becoming resizable - if (!isResizable && value !== false) { - self._makeResizable(value); - } - break; - case "title": - // convert whatever was passed in o a string, for html() to not throw up - $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); - break; - } - - $.Widget.prototype._setOption.apply(self, arguments); - }, - - _size: function() { - /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content - * divs will both have width and height set, so we need to reset them - */ - var options = this.options, - nonContentHeight, - minContentHeight, - isVisible = this.uiDialog.is( ":visible" ); - - // reset content sizing - this.element.show().css({ - width: 'auto', - minHeight: 0, - height: 0 - }); - - if (options.minWidth > options.width) { - options.width = options.minWidth; - } - - // reset wrapper sizing - // determine the height of all the non-content elements - nonContentHeight = this.uiDialog.css({ - height: 'auto', - width: options.width - }) - .height(); - minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); - - if ( options.height === "auto" ) { - // only needed for IE6 support - if ( $.support.minHeight ) { - this.element.css({ - minHeight: minContentHeight, - height: "auto" - }); - } else { - this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); - if ( !isVisible ) { - this.uiDialog.hide(); - } - this.element.height( Math.max( autoHeight, minContentHeight ) ); - } - } else { - this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); - } - - if (this.uiDialog.is(':data(resizable)')) { - this.uiDialog.resizable('option', 'minHeight', this._minHeight()); - } - } -}); - -$.extend($.ui.dialog, { - version: "1.8.12", - - uuid: 0, - maxZ: 0, - - getTitleId: function($el) { - var id = $el.attr('id'); - if (!id) { - this.uuid += 1; - id = this.uuid; - } - return 'ui-dialog-title-' + id; - }, - - overlay: function(dialog) { - this.$el = $.ui.dialog.overlay.create(dialog); - } -}); - -$.extend($.ui.dialog.overlay, { - instances: [], - // reuse old instances due to IE memory leak with alpha transparency (see #5185) - oldInstances: [], - maxZ: 0, - events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), - function(event) { return event + '.dialog-overlay'; }).join(' '), - create: function(dialog) { - if (this.instances.length === 0) { - // prevent use of anchors and inputs - // we use a setTimeout in case the overlay is created from an - // event that we're going to be cancelling (see #2804) - setTimeout(function() { - // handle $(el).dialog().dialog('close') (see #4065) - if ($.ui.dialog.overlay.instances.length) { - $(document).bind($.ui.dialog.overlay.events, function(event) { - // stop events if the z-index of the target is < the z-index of the overlay - // we cannot return true when we don't want to cancel the event (#3523) - if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { - return false; - } - }); - } - }, 1); - - // allow closing by pressing the escape key - $(document).bind('keydown.dialog-overlay', function(event) { - if (dialog.options.closeOnEscape && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - dialog.close(event); - event.preventDefault(); - } - }); - - // handle window resize - $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); - } - - var $el = (this.oldInstances.pop() || $('
        ').addClass('ui-widget-overlay')) - .appendTo(document.body) - .css({ - width: this.width(), - height: this.height() - }); - - if ($.fn.bgiframe) { - $el.bgiframe(); - } - - this.instances.push($el); - return $el; - }, - - destroy: function($el) { - var indexOf = $.inArray($el, this.instances); - if (indexOf != -1){ - this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); - } - - if (this.instances.length === 0) { - $([document, window]).unbind('.dialog-overlay'); - } - - $el.remove(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - var maxZ = 0; - $.each(this.instances, function() { - maxZ = Math.max(maxZ, this.css('z-index')); - }); - this.maxZ = maxZ; - }, - - height: function() { - var scrollHeight, - offsetHeight; - // handle IE 6 - if ($.browser.msie && $.browser.version < 7) { - scrollHeight = Math.max( - document.documentElement.scrollHeight, - document.body.scrollHeight - ); - offsetHeight = Math.max( - document.documentElement.offsetHeight, - document.body.offsetHeight - ); - - if (scrollHeight < offsetHeight) { - return $(window).height() + 'px'; - } else { - return scrollHeight + 'px'; - } - // handle "good" browsers - } else { - return $(document).height() + 'px'; - } - }, - - width: function() { - var scrollWidth, - offsetWidth; - // handle IE 6 - if ($.browser.msie && $.browser.version < 7) { - scrollWidth = Math.max( - document.documentElement.scrollWidth, - document.body.scrollWidth - ); - offsetWidth = Math.max( - document.documentElement.offsetWidth, - document.body.offsetWidth - ); - - if (scrollWidth < offsetWidth) { - return $(window).width() + 'px'; - } else { - return scrollWidth + 'px'; - } - // handle "good" browsers - } else { - return $(document).width() + 'px'; - } - }, - - resize: function() { - /* If the dialog is draggable and the user drags it past the - * right edge of the window, the document becomes wider so we - * need to stretch the overlay. If the user then drags the - * dialog back to the left, the document will become narrower, - * so we need to shrink the overlay to the appropriate size. - * This is handled by shrinking the overlay before setting it - * to the full document size. - */ - var $overlays = $([]); - $.each($.ui.dialog.overlay.instances, function() { - $overlays = $overlays.add(this); - }); - - $overlays.css({ - width: 0, - height: 0 - }).css({ - width: $.ui.dialog.overlay.width(), - height: $.ui.dialog.overlay.height() - }); - } -}); - -$.extend($.ui.dialog.overlay.prototype, { - destroy: function() { - $.ui.dialog.overlay.destroy(this.$el); - } -}); - -}(jQuery)); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.draggable.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.draggable.js deleted file mode 100644 index 0287bce4df..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.draggable.js +++ /dev/null @@ -1,799 +0,0 @@ -/* - * jQuery UI Draggable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Draggables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget("ui.draggable", $.ui.mouse, { - widgetEventPrefix: "drag", - options: { - addClasses: true, - appendTo: "parent", - axis: false, - connectToSortable: false, - containment: false, - cursor: "auto", - cursorAt: false, - grid: false, - handle: false, - helper: "original", - iframeFix: false, - opacity: false, - refreshPositions: false, - revert: false, - revertDuration: 500, - scope: "default", - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - snap: false, - snapMode: "both", - snapTolerance: 20, - stack: false, - zIndex: false - }, - _create: function() { - - if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) - this.element[0].style.position = 'relative'; - - (this.options.addClasses && this.element.addClass("ui-draggable")); - (this.options.disabled && this.element.addClass("ui-draggable-disabled")); - - this._mouseInit(); - - }, - - destroy: function() { - if(!this.element.data('draggable')) return; - this.element - .removeData("draggable") - .unbind(".draggable") - .removeClass("ui-draggable" - + " ui-draggable-dragging" - + " ui-draggable-disabled"); - this._mouseDestroy(); - - return this; - }, - - _mouseCapture: function(event) { - - var o = this.options; - - // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) - return false; - - //Quit if we're not on a valid handle - this.handle = this._getHandle(event); - if (!this.handle) - return false; - - return true; - - }, - - _mouseStart: function(event) { - - var o = this.options; - - //Create and append the visible helper - this.helper = this._createHelper(event); - - //Cache the helper size - this._cacheHelperProportions(); - - //If ddmanager is used for droppables, set the global draggable - if($.ui.ddmanager) - $.ui.ddmanager.current = this; - - /* - * - Position generation - - * This block generates everything position related - it's the core of draggables. - */ - - //Cache the margins of the original element - this._cacheMargins(); - - //Store the helper's css position - this.cssPosition = this.helper.css("position"); - this.scrollParent = this.helper.scrollParent(); - - //The element's absolute position on the page minus margins - this.offset = this.positionAbs = this.element.offset(); - this.offset = { - top: this.offset.top - this.margins.top, - left: this.offset.left - this.margins.left - }; - - $.extend(this.offset, { - click: { //Where the click happened, relative to the element - left: event.pageX - this.offset.left, - top: event.pageY - this.offset.top - }, - parent: this._getParentOffset(), - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper - }); - - //Generate the original position - this.originalPosition = this.position = this._generatePosition(event); - this.originalPageX = event.pageX; - this.originalPageY = event.pageY; - - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); - - //Set a containment if given in the options - if(o.containment) - this._setContainment(); - - //Trigger event + callbacks - if(this._trigger("start", event) === false) { - this._clear(); - return false; - } - - //Recache the helper size - this._cacheHelperProportions(); - - //Prepare the droppable offsets - if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - - this.helper.addClass("ui-draggable-dragging"); - this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position - return true; - }, - - _mouseDrag: function(event, noPropagation) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - //Call plugins and callbacks and use the resulting position if something is returned - if (!noPropagation) { - var ui = this._uiHash(); - if(this._trigger('drag', event, ui) === false) { - this._mouseUp({}); - return false; - } - this.position = ui.position; - } - - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - return false; - }, - - _mouseStop: function(event) { - - //If we are using droppables, inform the manager about the drop - var dropped = false; - if ($.ui.ddmanager && !this.options.dropBehaviour) - dropped = $.ui.ddmanager.drop(this, event); - - //if a drop comes from outside (a sortable) - if(this.dropped) { - dropped = this.dropped; - this.dropped = false; - } - - //if the original element is removed, don't bother to continue if helper is set to "original" - if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") - return false; - - if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { - var self = this; - $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - if(self._trigger("stop", event) !== false) { - self._clear(); - } - }); - } else { - if(this._trigger("stop", event) !== false) { - this._clear(); - } - } - - return false; - }, - - cancel: function() { - - if(this.helper.is(".ui-draggable-dragging")) { - this._mouseUp({}); - } else { - this._clear(); - } - - return this; - - }, - - _getHandle: function(event) { - - var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; - $(this.options.handle, this.element) - .find("*") - .andSelf() - .each(function() { - if(this == event.target) handle = true; - }); - - return handle; - - }, - - _createHelper: function(event) { - - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element); - - if(!helper.parents('body').length) - helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); - - if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) - helper.css("position", "absolute"); - - return helper; - - }, - - _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); - } - if ($.isArray(obj)) { - obj = {left: +obj[0], top: +obj[1] || 0}; - } - if ('left' in obj) { - this.offset.click.left = obj.left + this.margins.left; - } - if ('right' in obj) { - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; - } - if ('top' in obj) { - this.offset.click.top = obj.top + this.margins.top; - } - if ('bottom' in obj) { - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; - } - }, - - _getParentOffset: function() { - - //Get the offsetParent and cache its position - this.offsetParent = this.helper.offsetParent(); - var po = this.offsetParent.offset(); - - // This is a special case where we need to modify a offset calculated on start, since the following happened: - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { - po.left += this.scrollParent.scrollLeft(); - po.top += this.scrollParent.scrollTop(); - } - - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix - po = { top: 0, left: 0 }; - - return { - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) - }; - - }, - - _getRelativeOffset: function() { - - if(this.cssPosition == "relative") { - var p = this.element.position(); - return { - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() - }; - } else { - return { top: 0, left: 0 }; - } - - }, - - _cacheMargins: function() { - this.margins = { - left: (parseInt(this.element.css("marginLeft"),10) || 0), - top: (parseInt(this.element.css("marginTop"),10) || 0), - right: (parseInt(this.element.css("marginRight"),10) || 0), - bottom: (parseInt(this.element.css("marginBottom"),10) || 0) - }; - }, - - _cacheHelperProportions: function() { - this.helperProportions = { - width: this.helper.outerWidth(), - height: this.helper.outerHeight() - }; - }, - - _setContainment: function() { - - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left, - (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top, - (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; - - if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { - var ce = $(o.containment)[0]; if(!ce) return; - var co = $(o.containment).offset(); - var over = ($(ce).css("overflow") != 'hidden'); - - this.containment = [ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), - co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, - co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom - ]; - } else if(o.containment.constructor == Array) { - this.containment = o.containment; - } - - }, - - _convertPositionTo: function(d, pos) { - - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - return { - top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) - ), - left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) - ) - }; - - }, - - _generatePosition: function(event) { - - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - var pageX = event.pageX; - var pageY = event.pageY; - - /* - * - Position constraining - - * Constrain the position to a mix of grid, containment. - */ - - if(this.originalPosition) { //If we are not dragging yet, we won't check for options - - if(this.containment) { - if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; - } - - if(o.grid) { - var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; - pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - - var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; - pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; - } - - } - - return { - top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) - ), - left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) - ) - }; - - }, - - _clear: function() { - this.helper.removeClass("ui-draggable-dragging"); - if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); - //if($.ui.ddmanager) $.ui.ddmanager.current = null; - this.helper = null; - this.cancelHelperRemoval = false; - }, - - // From now on bulk stuff - mainly helpers - - _trigger: function(type, event, ui) { - ui = ui || this._uiHash(); - $.ui.plugin.call(this, type, [event, ui]); - if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins - return $.Widget.prototype._trigger.call(this, type, event, ui); - }, - - plugins: {}, - - _uiHash: function(event) { - return { - helper: this.helper, - position: this.position, - originalPosition: this.originalPosition, - offset: this.positionAbs - }; - } - -}); - -$.extend($.ui.draggable, { - version: "1.8.12" -}); - -$.ui.plugin.add("draggable", "connectToSortable", { - start: function(event, ui) { - - var inst = $(this).data("draggable"), o = inst.options, - uiSortable = $.extend({}, ui, { item: inst.element }); - inst.sortables = []; - $(o.connectToSortable).each(function() { - var sortable = $.data(this, 'sortable'); - if (sortable && !sortable.options.disabled) { - inst.sortables.push({ - instance: sortable, - shouldRevert: sortable.options.revert - }); - sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). - sortable._trigger("activate", event, uiSortable); - } - }); - - }, - stop: function(event, ui) { - - //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper - var inst = $(this).data("draggable"), - uiSortable = $.extend({}, ui, { item: inst.element }); - - $.each(inst.sortables, function() { - if(this.instance.isOver) { - - this.instance.isOver = 0; - - inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance - this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) - - //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' - if(this.shouldRevert) this.instance.options.revert = true; - - //Trigger the stop of the sortable - this.instance._mouseStop(event); - - this.instance.options.helper = this.instance.options._helper; - - //If the helper has been the original item, restore properties in the sortable - if(inst.options.helper == 'original') - this.instance.currentItem.css({ top: 'auto', left: 'auto' }); - - } else { - this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance - this.instance._trigger("deactivate", event, uiSortable); - } - - }); - - }, - drag: function(event, ui) { - - var inst = $(this).data("draggable"), self = this; - - var checkPos = function(o) { - var dyClick = this.offset.click.top, dxClick = this.offset.click.left; - var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; - var itemHeight = o.height, itemWidth = o.width; - var itemTop = o.top, itemLeft = o.left; - - return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); - }; - - $.each(inst.sortables, function(i) { - - //Copy over some variables to allow calling the sortable's native _intersectsWith - this.instance.positionAbs = inst.positionAbs; - this.instance.helperProportions = inst.helperProportions; - this.instance.offset.click = inst.offset.click; - - if(this.instance._intersectsWith(this.instance.containerCache)) { - - //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once - if(!this.instance.isOver) { - - this.instance.isOver = 1; - //Now we fake the start of dragging for the sortable instance, - //by cloning the list group item, appending it to the sortable and using it as inst.currentItem - //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) - this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true); - this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it - this.instance.options.helper = function() { return ui.helper[0]; }; - - event.target = this.instance.currentItem[0]; - this.instance._mouseCapture(event, true); - this.instance._mouseStart(event, true, true); - - //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes - this.instance.offset.click.top = inst.offset.click.top; - this.instance.offset.click.left = inst.offset.click.left; - this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; - this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; - - inst._trigger("toSortable", event); - inst.dropped = this.instance.element; //draggable revert needs that - //hack so receive/update callbacks work (mostly) - inst.currentItem = inst.element; - this.instance.fromOutside = inst; - - } - - //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable - if(this.instance.currentItem) this.instance._mouseDrag(event); - - } else { - - //If it doesn't intersect with the sortable, and it intersected before, - //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval - if(this.instance.isOver) { - - this.instance.isOver = 0; - this.instance.cancelHelperRemoval = true; - - //Prevent reverting on this forced stop - this.instance.options.revert = false; - - // The out event needs to be triggered independently - this.instance._trigger('out', event, this.instance._uiHash(this.instance)); - - this.instance._mouseStop(event, true); - this.instance.options.helper = this.instance.options._helper; - - //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size - this.instance.currentItem.remove(); - if(this.instance.placeholder) this.instance.placeholder.remove(); - - inst._trigger("fromSortable", event); - inst.dropped = false; //draggable revert needs that - } - - }; - - }); - - } -}); - -$.ui.plugin.add("draggable", "cursor", { - start: function(event, ui) { - var t = $('body'), o = $(this).data('draggable').options; - if (t.css("cursor")) o._cursor = t.css("cursor"); - t.css("cursor", o.cursor); - }, - stop: function(event, ui) { - var o = $(this).data('draggable').options; - if (o._cursor) $('body').css("cursor", o._cursor); - } -}); - -$.ui.plugin.add("draggable", "iframeFix", { - start: function(event, ui) { - var o = $(this).data('draggable').options; - $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { - $('
        ') - .css({ - width: this.offsetWidth+"px", height: this.offsetHeight+"px", - position: "absolute", opacity: "0.001", zIndex: 1000 - }) - .css($(this).offset()) - .appendTo("body"); - }); - }, - stop: function(event, ui) { - $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers - } -}); - -$.ui.plugin.add("draggable", "opacity", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data('draggable').options; - if(t.css("opacity")) o._opacity = t.css("opacity"); - t.css('opacity', o.opacity); - }, - stop: function(event, ui) { - var o = $(this).data('draggable').options; - if(o._opacity) $(ui.helper).css('opacity', o._opacity); - } -}); - -$.ui.plugin.add("draggable", "scroll", { - start: function(event, ui) { - var i = $(this).data("draggable"); - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); - }, - drag: function(event, ui) { - - var i = $(this).data("draggable"), o = i.options, scrolled = false; - - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { - - if(!o.axis || o.axis != 'x') { - if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; - } - - if(!o.axis || o.axis != 'y') { - if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; - } - - } else { - - if(!o.axis || o.axis != 'x') { - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - } - - if(!o.axis || o.axis != 'y') { - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - } - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(i, event); - - } -}); - -$.ui.plugin.add("draggable", "snap", { - start: function(event, ui) { - - var i = $(this).data("draggable"), o = i.options; - i.snapElements = []; - - $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { - var $t = $(this); var $o = $t.offset(); - if(this != i.element[0]) i.snapElements.push({ - item: this, - width: $t.outerWidth(), height: $t.outerHeight(), - top: $o.top, left: $o.left - }); - }); - - }, - drag: function(event, ui) { - - var inst = $(this).data("draggable"), o = inst.options; - var d = o.snapTolerance; - - var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, - y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; - - for (var i = inst.snapElements.length - 1; i >= 0; i--){ - - var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, - t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; - - //Yes, I know, this is insane ;) - if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { - if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - inst.snapElements[i].snapping = false; - continue; - } - - if(o.snapMode != 'inner') { - var ts = Math.abs(t - y2) <= d; - var bs = Math.abs(b - y1) <= d; - var ls = Math.abs(l - x2) <= d; - var rs = Math.abs(r - x1) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; - } - - var first = (ts || bs || ls || rs); - - if(o.snapMode != 'outer') { - var ts = Math.abs(t - y1) <= d; - var bs = Math.abs(b - y2) <= d; - var ls = Math.abs(l - x1) <= d; - var rs = Math.abs(r - x2) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; - } - - if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) - (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - inst.snapElements[i].snapping = (ts || bs || ls || rs || first); - - }; - - } -}); - -$.ui.plugin.add("draggable", "stack", { - start: function(event, ui) { - - var o = $(this).data("draggable").options; - - var group = $.makeArray($(o.stack)).sort(function(a,b) { - return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); - }); - if (!group.length) { return; } - - var min = parseInt(group[0].style.zIndex) || 0; - $(group).each(function(i) { - this.style.zIndex = min + i; - }); - - this[0].style.zIndex = min + group.length; - - } -}); - -$.ui.plugin.add("draggable", "zIndex", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data("draggable").options; - if(t.css("zIndex")) o._zIndex = t.css("zIndex"); - t.css('zIndex', o.zIndex); - }, - stop: function(event, ui) { - var o = $(this).data("draggable").options; - if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); - } -}); - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.droppable.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.droppable.js deleted file mode 100644 index 75b903058a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.droppable.js +++ /dev/null @@ -1,285 +0,0 @@ -/* - * jQuery UI Droppable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Droppables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.mouse.js - * jquery.ui.draggable.js - */ -(function( $, undefined ) { - -$.widget("ui.droppable", { - widgetEventPrefix: "drop", - options: { - accept: '*', - activeClass: false, - addClasses: true, - greedy: false, - hoverClass: false, - scope: 'default', - tolerance: 'intersect' - }, - _create: function() { - - var o = this.options, accept = o.accept; - this.isover = 0; this.isout = 1; - - this.accept = $.isFunction(accept) ? accept : function(d) { - return d.is(accept); - }; - - //Store the droppable's proportions - this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; - - // Add the reference and positions to the manager - $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; - $.ui.ddmanager.droppables[o.scope].push(this); - - (o.addClasses && this.element.addClass("ui-droppable")); - - }, - - destroy: function() { - var drop = $.ui.ddmanager.droppables[this.options.scope]; - for ( var i = 0; i < drop.length; i++ ) - if ( drop[i] == this ) - drop.splice(i, 1); - - this.element - .removeClass("ui-droppable ui-droppable-disabled") - .removeData("droppable") - .unbind(".droppable"); - - return this; - }, - - _setOption: function(key, value) { - - if(key == 'accept') { - this.accept = $.isFunction(value) ? value : function(d) { - return d.is(value); - }; - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - _activate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.addClass(this.options.activeClass); - (draggable && this._trigger('activate', event, this.ui(draggable))); - }, - - _deactivate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - (draggable && this._trigger('deactivate', event, this.ui(draggable))); - }, - - _over: function(event) { - - var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); - this._trigger('over', event, this.ui(draggable)); - } - - }, - - _out: function(event) { - - var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('out', event, this.ui(draggable)); - } - - }, - - _drop: function(event,custom) { - - var draggable = custom || $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element - - var childrenIntersection = false; - this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { - var inst = $.data(this, 'droppable'); - if( - inst.options.greedy - && !inst.options.disabled - && inst.options.scope == draggable.options.scope - && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) - && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) - ) { childrenIntersection = true; return false; } - }); - if(childrenIntersection) return false; - - if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('drop', event, this.ui(draggable)); - return this.element; - } - - return false; - - }, - - ui: function(c) { - return { - draggable: (c.currentItem || c.element), - helper: c.helper, - position: c.position, - offset: c.positionAbs - }; - } - -}); - -$.extend($.ui.droppable, { - version: "1.8.12" -}); - -$.ui.intersect = function(draggable, droppable, toleranceMode) { - - if (!droppable.offset) return false; - - var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, - y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; - var l = droppable.offset.left, r = l + droppable.proportions.width, - t = droppable.offset.top, b = t + droppable.proportions.height; - - switch (toleranceMode) { - case 'fit': - return (l <= x1 && x2 <= r - && t <= y1 && y2 <= b); - break; - case 'intersect': - return (l < x1 + (draggable.helperProportions.width / 2) // Right Half - && x2 - (draggable.helperProportions.width / 2) < r // Left Half - && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half - && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - break; - case 'pointer': - var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), - draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), - isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); - return isOver; - break; - case 'touch': - return ( - (y1 >= t && y1 <= b) || // Top edge touching - (y2 >= t && y2 <= b) || // Bottom edge touching - (y1 < t && y2 > b) // Surrounded vertically - ) && ( - (x1 >= l && x1 <= r) || // Left edge touching - (x2 >= l && x2 <= r) || // Right edge touching - (x1 < l && x2 > r) // Surrounded horizontally - ); - break; - default: - return false; - break; - } - -}; - -/* - This manager tracks offsets of draggables and droppables -*/ -$.ui.ddmanager = { - current: null, - droppables: { 'default': [] }, - prepareOffsets: function(t, event) { - - var m = $.ui.ddmanager.droppables[t.options.scope] || []; - var type = event ? event.type : null; // workaround for #2317 - var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); - - droppablesLoop: for (var i = 0; i < m.length; i++) { - - if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted - for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item - m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue - - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables - - m[i].offset = m[i].element.offset(); - m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; - - } - - }, - drop: function(draggable, event) { - - var dropped = false; - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - - if(!this.options) return; - if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) - dropped = dropped || this._drop.call(this, event); - - if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - this.isout = 1; this.isover = 0; - this._deactivate.call(this, event); - } - - }); - return dropped; - - }, - drag: function(draggable, event) { - - //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. - if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); - - //Run through all droppables and check their positions based on specific tolerance options - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - - if(this.options.disabled || this.greedyChild || !this.visible) return; - var intersects = $.ui.intersect(draggable, this, this.options.tolerance); - - var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); - if(!c) return; - - var parentInstance; - if (this.options.greedy) { - var parent = this.element.parents(':data(droppable):eq(0)'); - if (parent.length) { - parentInstance = $.data(parent[0], 'droppable'); - parentInstance.greedyChild = (c == 'isover' ? 1 : 0); - } - } - - // we just moved into a greedy child - if (parentInstance && c == 'isover') { - parentInstance['isover'] = 0; - parentInstance['isout'] = 1; - parentInstance._out.call(parentInstance, event); - } - - this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; - this[c == "isover" ? "_over" : "_out"].call(this, event); - - // we just moved out of a greedy child - if (parentInstance && c == 'isout') { - parentInstance['isout'] = 0; - parentInstance['isover'] = 1; - parentInstance._over.call(parentInstance, event); - } - }); - - } -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.mouse.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.mouse.js deleted file mode 100644 index 368da12c79..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.mouse.js +++ /dev/null @@ -1,156 +0,0 @@ -/*! - * jQuery UI Mouse 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Mouse - * - * Depends: - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget("ui.mouse", { - options: { - cancel: ':input,option', - distance: 1, - delay: 0 - }, - _mouseInit: function() { - var self = this; - - this.element - .bind('mousedown.'+this.widgetName, function(event) { - return self._mouseDown(event); - }) - .bind('click.'+this.widgetName, function(event) { - if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { - $.removeData(event.target, self.widgetName + '.preventClickEvent'); - event.stopImmediatePropagation(); - return false; - } - }); - - this.started = false; - }, - - // TODO: make sure destroying one instance of mouse doesn't mess with - // other instances of mouse - _mouseDestroy: function() { - this.element.unbind('.'+this.widgetName); - }, - - _mouseDown: function(event) { - // don't let more than one widget handle mouseStart - // TODO: figure out why we have to use originalEvent - event.originalEvent = event.originalEvent || {}; - if (event.originalEvent.mouseHandled) { return; } - - // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(event)); - - this._mouseDownEvent = event; - - var self = this, - btnIsLeft = (event.which == 1), - elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { - return true; - } - - this.mouseDelayMet = !this.options.delay; - if (!this.mouseDelayMet) { - this._mouseDelayTimer = setTimeout(function() { - self.mouseDelayMet = true; - }, this.options.delay); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = (this._mouseStart(event) !== false); - if (!this._mouseStarted) { - event.preventDefault(); - return true; - } - } - - // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { - $.removeData(event.target, this.widgetName + '.preventClickEvent'); - } - - // these delegates are required to keep context - this._mouseMoveDelegate = function(event) { - return self._mouseMove(event); - }; - this._mouseUpDelegate = function(event) { - return self._mouseUp(event); - }; - $(document) - .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); - - event.preventDefault(); - event.originalEvent.mouseHandled = true; - return true; - }, - - _mouseMove: function(event) { - // IE mouseup check - mouseup happened when mouse was out of window - if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { - return this._mouseUp(event); - } - - if (this._mouseStarted) { - this._mouseDrag(event); - return event.preventDefault(); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, event) !== false); - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); - } - - return !this._mouseStarted; - }, - - _mouseUp: function(event) { - $(document) - .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); - - if (this._mouseStarted) { - this._mouseStarted = false; - - if (event.target == this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + '.preventClickEvent', true); - } - - this._mouseStop(event); - } - - return false; - }, - - _mouseDistanceMet: function(event) { - return (Math.max( - Math.abs(this._mouseDownEvent.pageX - event.pageX), - Math.abs(this._mouseDownEvent.pageY - event.pageY) - ) >= this.options.distance - ); - }, - - _mouseDelayMet: function(event) { - return this.mouseDelayMet; - }, - - // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(event) {}, - _mouseDrag: function(event) {}, - _mouseStop: function(event) {}, - _mouseCapture: function(event) { return true; } -}); - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.position.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.position.js deleted file mode 100644 index ff817bed64..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.position.js +++ /dev/null @@ -1,252 +0,0 @@ -/* - * jQuery UI Position 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function( $, undefined ) { - -$.ui = $.ui || {}; - -var horizontalPositions = /left|center|right/, - verticalPositions = /top|center|bottom/, - center = "center", - _position = $.fn.position, - _offset = $.fn.offset; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var target = $( options.of ), - targetElem = target[0], - collision = ( options.collision || "flip" ).split( " " ), - offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], - targetWidth, - targetHeight, - basePosition; - - if ( targetElem.nodeType === 9 ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: 0, left: 0 }; - // TODO: use $.isWindow() in 1.9 - } else if ( targetElem.setTimeout ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; - } else if ( targetElem.preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - targetWidth = targetHeight = 0; - basePosition = { top: options.of.pageY, left: options.of.pageX }; - } else { - targetWidth = target.outerWidth(); - targetHeight = target.outerHeight(); - basePosition = target.offset(); - } - - // force my and at to have valid horizontal and veritcal positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[this] || "" ).split( " " ); - if ( pos.length === 1) { - pos = horizontalPositions.test( pos[0] ) ? - pos.concat( [center] ) : - verticalPositions.test( pos[0] ) ? - [ center ].concat( pos ) : - [ center, center ]; - } - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; - options[ this ] = pos; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - // normalize offset option - offset[ 0 ] = parseInt( offset[0], 10 ) || 0; - if ( offset.length === 1 ) { - offset[ 1 ] = offset[ 0 ]; - } - offset[ 1 ] = parseInt( offset[1], 10 ) || 0; - - if ( options.at[0] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[0] === center ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[1] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[1] === center ) { - basePosition.top += targetHeight / 2; - } - - basePosition.left += offset[ 0 ]; - basePosition.top += offset[ 1 ]; - - return this.each(function() { - var elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, - marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, - collisionWidth = elemWidth + marginLeft + - ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ), - collisionHeight = elemHeight + marginTop + - ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), - position = $.extend( {}, basePosition ), - collisionPosition; - - if ( options.my[0] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[0] === center ) { - position.left -= elemWidth / 2; - } - - if ( options.my[1] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[1] === center ) { - position.top -= elemHeight / 2; - } - - // prevent fractions (see #5280) - position.left = Math.round( position.left ); - position.top = Math.round( position.top ); - - collisionPosition = { - left: position.left - marginLeft, - top: position.top - marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[i] ] ) { - $.ui.position[ collision[i] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: offset, - my: options.my, - at: options.at - }); - } - }); - - if ( $.fn.bgiframe ) { - elem.bgiframe(); - } - elem.offset( $.extend( position, { using: options.using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); - position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); - }, - top: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); - position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); - } - }, - - flip: { - left: function( position, data ) { - if ( data.at[0] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - -data.targetWidth, - offset = -2 * data.offset[ 0 ]; - position.left += data.collisionPosition.left < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - }, - top: function( position, data ) { - if ( data.at[1] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), - myOffset = data.my[ 1 ] === "top" ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - -data.targetHeight, - offset = -2 * data.offset[ 1 ]; - position.top += data.collisionPosition.top < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - } - } -}; - -// offset setter from jQuery 1.4 -if ( !$.offset.setOffset ) { - $.offset.setOffset = function( elem, options ) { - // set position first, in-case top/left are set even on static elem - if ( /static/.test( $.curCSS( elem, "position" ) ) ) { - elem.style.position = "relative"; - } - var curElem = $( elem ), - curOffset = curElem.offset(), - curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0, - curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0, - props = { - top: (options.top - curOffset.top) + curTop, - left: (options.left - curOffset.left) + curLeft - }; - - if ( 'using' in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - }; - - $.fn.offset = function( options ) { - var elem = this[ 0 ]; - if ( !elem || !elem.ownerDocument ) { return null; } - if ( options ) { - return this.each(function() { - $.offset.setOffset( this, options ); - }); - } - return _offset.call( this ); - }; -} - -}( jQuery )); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.progressbar.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.progressbar.js deleted file mode 100644 index 9a67ea5e74..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.progressbar.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * jQuery UI Progressbar 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget( "ui.progressbar", { - options: { - value: 0, - max: 100 - }, - - min: 0, - - _create: function() { - this.element - .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .attr({ - role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() - }); - - this.valueDiv = $( "
        " ) - .appendTo( this.element ); - - this.oldValue = this._value(); - this._refreshValue(); - }, - - destroy: function() { - this.element - .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .removeAttr( "role" ) - .removeAttr( "aria-valuemin" ) - .removeAttr( "aria-valuemax" ) - .removeAttr( "aria-valuenow" ); - - this.valueDiv.remove(); - - $.Widget.prototype.destroy.apply( this, arguments ); - }, - - value: function( newValue ) { - if ( newValue === undefined ) { - return this._value(); - } - - this._setOption( "value", newValue ); - return this; - }, - - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; - } - return Math.min( this.options.max, Math.max( this.min, val ) ); - }, - - _percentage: function() { - return 100 * this._value() / this.options.max; - }, - - _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); - - if ( this.oldValue !== value ) { - this.oldValue = value; - this._trigger( "change" ); - } - - this.valueDiv - .toggle( value > this.min ) - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); - } -}); - -$.extend( $.ui.progressbar, { - version: "1.8.12" -}); - -})( jQuery ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.resizable.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.resizable.js deleted file mode 100644 index 1e3883f685..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.resizable.js +++ /dev/null @@ -1,812 +0,0 @@ -/* - * jQuery UI Resizable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget("ui.resizable", $.ui.mouse, { - widgetEventPrefix: "resize", - options: { - alsoResize: false, - animate: false, - animateDuration: "slow", - animateEasing: "swing", - aspectRatio: false, - autoHide: false, - containment: false, - ghost: false, - grid: false, - handles: "e,s,se", - helper: false, - maxHeight: null, - maxWidth: null, - minHeight: 10, - minWidth: 10, - zIndex: 1000 - }, - _create: function() { - - var self = this, o = this.options; - this.element.addClass("ui-resizable"); - - $.extend(this, { - _aspectRatio: !!(o.aspectRatio), - aspectRatio: o.aspectRatio, - originalElement: this.element, - _proportionallyResizeElements: [], - _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null - }); - - //Wrap the element if it cannot hold child nodes - if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { - - //Opera fix for relative positioning - if (/relative/.test(this.element.css('position')) && $.browser.opera) - this.element.css({ position: 'relative', top: 'auto', left: 'auto' }); - - //Create a wrapper element and set the wrapper to the new current internal element - this.element.wrap( - $('
        ').css({ - position: this.element.css('position'), - width: this.element.outerWidth(), - height: this.element.outerHeight(), - top: this.element.css('top'), - left: this.element.css('left') - }) - ); - - //Overwrite the original this.element - this.element = this.element.parent().data( - "resizable", this.element.data('resizable') - ); - - this.elementIsWrapper = true; - - //Move margins to the wrapper - this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); - this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); - - //Prevent Safari textarea resize - this.originalResizeStyle = this.originalElement.css('resize'); - this.originalElement.css('resize', 'none'); - - //Push the actual element to our proportionallyResize internal array - this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); - - // avoid IE jump (hard set the margin) - this.originalElement.css({ margin: this.originalElement.css('margin') }); - - // fix handlers offset - this._proportionallyResize(); - - } - - this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); - if(this.handles.constructor == String) { - - if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; - var n = this.handles.split(","); this.handles = {}; - - for(var i = 0; i < n.length; i++) { - - var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; - var axis = $('
        '); - - // increase zIndex of sw, se, ne, nw axis - //TODO : this modifies original option - if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex }); - - //TODO : What's going on here? - if ('se' == handle) { - axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); - }; - - //Insert into internal handles object and append to element - this.handles[handle] = '.ui-resizable-'+handle; - this.element.append(axis); - } - - } - - this._renderAxis = function(target) { - - target = target || this.element; - - for(var i in this.handles) { - - if(this.handles[i].constructor == String) - this.handles[i] = $(this.handles[i], this.element).show(); - - //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) - if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { - - var axis = $(this.handles[i], this.element), padWrapper = 0; - - //Checking the correct pad and border - padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); - - //The padding type i have to apply... - var padPos = [ 'padding', - /ne|nw|n/.test(i) ? 'Top' : - /se|sw|s/.test(i) ? 'Bottom' : - /^e$/.test(i) ? 'Right' : 'Left' ].join(""); - - target.css(padPos, padWrapper); - - this._proportionallyResize(); - - } - - //TODO: What's that good for? There's not anything to be executed left - if(!$(this.handles[i]).length) - continue; - - } - }; - - //TODO: make renderAxis a prototype function - this._renderAxis(this.element); - - this._handles = $('.ui-resizable-handle', this.element) - .disableSelection(); - - //Matching axis name - this._handles.mouseover(function() { - if (!self.resizing) { - if (this.className) - var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); - //Axis, default = se - self.axis = axis && axis[1] ? axis[1] : 'se'; - } - }); - - //If we want to auto hide the elements - if (o.autoHide) { - this._handles.hide(); - $(this.element) - .addClass("ui-resizable-autohide") - .hover(function() { - $(this).removeClass("ui-resizable-autohide"); - self._handles.show(); - }, - function(){ - if (!self.resizing) { - $(this).addClass("ui-resizable-autohide"); - self._handles.hide(); - } - }); - } - - //Initialize the mouse interaction - this._mouseInit(); - - }, - - destroy: function() { - - this._mouseDestroy(); - - var _destroy = function(exp) { - $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") - .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); - }; - - //TODO: Unwrap at same DOM position - if (this.elementIsWrapper) { - _destroy(this.element); - var wrapper = this.element; - wrapper.after( - this.originalElement.css({ - position: wrapper.css('position'), - width: wrapper.outerWidth(), - height: wrapper.outerHeight(), - top: wrapper.css('top'), - left: wrapper.css('left') - }) - ).remove(); - } - - this.originalElement.css('resize', this.originalResizeStyle); - _destroy(this.originalElement); - - return this; - }, - - _mouseCapture: function(event) { - var handle = false; - for (var i in this.handles) { - if ($(this.handles[i])[0] == event.target) { - handle = true; - } - } - - return !this.options.disabled && handle; - }, - - _mouseStart: function(event) { - - var o = this.options, iniPos = this.element.position(), el = this.element; - - this.resizing = true; - this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; - - // bugfix for http://dev.jquery.com/ticket/1749 - if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { - el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); - } - - //Opera fixing relative position - if ($.browser.opera && (/relative/).test(el.css('position'))) - el.css({ position: 'relative', top: 'auto', left: 'auto' }); - - this._renderProxy(); - - var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); - - if (o.containment) { - curleft += $(o.containment).scrollLeft() || 0; - curtop += $(o.containment).scrollTop() || 0; - } - - //Store needed variables - this.offset = this.helper.offset(); - this.position = { left: curleft, top: curtop }; - this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; - this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; - this.originalPosition = { left: curleft, top: curtop }; - this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; - this.originalMousePosition = { left: event.pageX, top: event.pageY }; - - //Aspect Ratio - this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); - - var cursor = $('.ui-resizable-' + this.axis).css('cursor'); - $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); - - el.addClass("ui-resizable-resizing"); - this._propagate("start", event); - return true; - }, - - _mouseDrag: function(event) { - - //Increase performance, avoid regex - var el = this.helper, o = this.options, props = {}, - self = this, smp = this.originalMousePosition, a = this.axis; - - var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; - var trigger = this._change[a]; - if (!trigger) return false; - - // Calculate the attrs that will be change - var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; - - if (this._aspectRatio || event.shiftKey) - data = this._updateRatio(data, event); - - data = this._respectSize(data, event); - - // plugins callbacks need to be called first - this._propagate("resize", event); - - el.css({ - top: this.position.top + "px", left: this.position.left + "px", - width: this.size.width + "px", height: this.size.height + "px" - }); - - if (!this._helper && this._proportionallyResizeElements.length) - this._proportionallyResize(); - - this._updateCache(data); - - // calling the user callback at the end - this._trigger('resize', event, this.ui()); - - return false; - }, - - _mouseStop: function(event) { - - this.resizing = false; - var o = this.options, self = this; - - if(this._helper) { - var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, - soffsetw = ista ? 0 : self.sizeDiff.width; - - var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, - left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, - top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; - - if (!o.animate) - this.element.css($.extend(s, { top: top, left: left })); - - self.helper.height(self.size.height); - self.helper.width(self.size.width); - - if (this._helper && !o.animate) this._proportionallyResize(); - } - - $('body').css('cursor', 'auto'); - - this.element.removeClass("ui-resizable-resizing"); - - this._propagate("stop", event); - - if (this._helper) this.helper.remove(); - return false; - - }, - - _updateCache: function(data) { - var o = this.options; - this.offset = this.helper.offset(); - if (isNumber(data.left)) this.position.left = data.left; - if (isNumber(data.top)) this.position.top = data.top; - if (isNumber(data.height)) this.size.height = data.height; - if (isNumber(data.width)) this.size.width = data.width; - }, - - _updateRatio: function(data, event) { - - var o = this.options, cpos = this.position, csize = this.size, a = this.axis; - - if (data.height) data.width = (csize.height * this.aspectRatio); - else if (data.width) data.height = (csize.width / this.aspectRatio); - - if (a == 'sw') { - data.left = cpos.left + (csize.width - data.width); - data.top = null; - } - if (a == 'nw') { - data.top = cpos.top + (csize.height - data.height); - data.left = cpos.left + (csize.width - data.width); - } - - return data; - }, - - _respectSize: function(data, event) { - - var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, - ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), - isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); - - if (isminw) data.width = o.minWidth; - if (isminh) data.height = o.minHeight; - if (ismaxw) data.width = o.maxWidth; - if (ismaxh) data.height = o.maxHeight; - - var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; - var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); - - if (isminw && cw) data.left = dw - o.minWidth; - if (ismaxw && cw) data.left = dw - o.maxWidth; - if (isminh && ch) data.top = dh - o.minHeight; - if (ismaxh && ch) data.top = dh - o.maxHeight; - - // fixing jump error on top/left - bug #2330 - var isNotwh = !data.width && !data.height; - if (isNotwh && !data.left && data.top) data.top = null; - else if (isNotwh && !data.top && data.left) data.left = null; - - return data; - }, - - _proportionallyResize: function() { - - var o = this.options; - if (!this._proportionallyResizeElements.length) return; - var element = this.helper || this.element; - - for (var i=0; i < this._proportionallyResizeElements.length; i++) { - - var prel = this._proportionallyResizeElements[i]; - - if (!this.borderDif) { - var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], - p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; - - this.borderDif = $.map(b, function(v, i) { - var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; - return border + padding; - }); - } - - if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) - continue; - - prel.css({ - height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, - width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 - }); - - }; - - }, - - _renderProxy: function() { - - var el = this.element, o = this.options; - this.elementOffset = el.offset(); - - if(this._helper) { - - this.helper = this.helper || $('
        '); - - // fix ie6 offset TODO: This seems broken - var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), - pxyoffset = ( ie6 ? 2 : -1 ); - - this.helper.addClass(this._helper).css({ - width: this.element.outerWidth() + pxyoffset, - height: this.element.outerHeight() + pxyoffset, - position: 'absolute', - left: this.elementOffset.left - ie6offset +'px', - top: this.elementOffset.top - ie6offset +'px', - zIndex: ++o.zIndex //TODO: Don't modify option - }); - - this.helper - .appendTo("body") - .disableSelection(); - - } else { - this.helper = this.element; - } - - }, - - _change: { - e: function(event, dx, dy) { - return { width: this.originalSize.width + dx }; - }, - w: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; - return { left: sp.left + dx, width: cs.width - dx }; - }, - n: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; - return { top: sp.top + dy, height: cs.height - dy }; - }, - s: function(event, dx, dy) { - return { height: this.originalSize.height + dy }; - }, - se: function(event, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); - }, - sw: function(event, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); - }, - ne: function(event, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); - }, - nw: function(event, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); - } - }, - - _propagate: function(n, event) { - $.ui.plugin.call(this, n, [event, this.ui()]); - (n != "resize" && this._trigger(n, event, this.ui())); - }, - - plugins: {}, - - ui: function() { - return { - originalElement: this.originalElement, - element: this.element, - helper: this.helper, - position: this.position, - size: this.size, - originalSize: this.originalSize, - originalPosition: this.originalPosition - }; - } - -}); - -$.extend($.ui.resizable, { - version: "1.8.12" -}); - -/* - * Resizable Extensions - */ - -$.ui.plugin.add("resizable", "alsoResize", { - - start: function (event, ui) { - var self = $(this).data("resizable"), o = self.options; - - var _store = function (exp) { - $(exp).each(function() { - var el = $(this); - el.data("resizable-alsoresize", { - width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), - left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10), - position: el.css('position') // to reset Opera on stop() - }); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } - else { $.each(o.alsoResize, function (exp) { _store(exp); }); } - }else{ - _store(o.alsoResize); - } - }, - - resize: function (event, ui) { - var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; - - var delta = { - height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, - top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 - }, - - _alsoResize = function (exp, c) { - $(exp).each(function() { - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, - css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; - - $.each(css, function (i, prop) { - var sum = (start[prop]||0) + (delta[prop]||0); - if (sum && sum >= 0) - style[prop] = sum || null; - }); - - // Opera fixing relative position - if ($.browser.opera && /relative/.test(el.css('position'))) { - self._revertToRelativePosition = true; - el.css({ position: 'absolute', top: 'auto', left: 'auto' }); - } - - el.css(style); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); - }else{ - _alsoResize(o.alsoResize); - } - }, - - stop: function (event, ui) { - var self = $(this).data("resizable"), o = self.options; - - var _reset = function (exp) { - $(exp).each(function() { - var el = $(this); - // reset position for Opera - no need to verify it was changed - el.css({ position: el.data("resizable-alsoresize").position }); - }); - }; - - if (self._revertToRelativePosition) { - self._revertToRelativePosition = false; - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function (exp) { _reset(exp); }); - }else{ - _reset(o.alsoResize); - } - } - - $(this).removeData("resizable-alsoresize"); - } -}); - -$.ui.plugin.add("resizable", "animate", { - - stop: function(event, ui) { - var self = $(this).data("resizable"), o = self.options; - - var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, - soffsetw = ista ? 0 : self.sizeDiff.width; - - var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, - left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, - top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; - - self.element.animate( - $.extend(style, top && left ? { top: top, left: left } : {}), { - duration: o.animateDuration, - easing: o.animateEasing, - step: function() { - - var data = { - width: parseInt(self.element.css('width'), 10), - height: parseInt(self.element.css('height'), 10), - top: parseInt(self.element.css('top'), 10), - left: parseInt(self.element.css('left'), 10) - }; - - if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); - - // propagating resize, and updating values for each animation step - self._updateCache(data); - self._propagate("resize", event); - - } - } - ); - } - -}); - -$.ui.plugin.add("resizable", "containment", { - - start: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, el = self.element; - var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; - if (!ce) return; - - self.containerElement = $(ce); - - if (/document/.test(oc) || oc == document) { - self.containerOffset = { left: 0, top: 0 }; - self.containerPosition = { left: 0, top: 0 }; - - self.parentData = { - element: $(document), left: 0, top: 0, - width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight - }; - } - - // i'm a node, so compute top, left, right, bottom - else { - var element = $(ce), p = []; - $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); - - self.containerOffset = element.offset(); - self.containerPosition = element.position(); - self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; - - var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, - width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); - - self.parentData = { - element: ce, left: co.left, top: co.top, width: width, height: height - }; - } - }, - - resize: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, - ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, - pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; - - if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; - - if (cp.left < (self._helper ? co.left : 0)) { - self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); - if (pRatio) self.size.height = self.size.width / o.aspectRatio; - self.position.left = o.helper ? co.left : 0; - } - - if (cp.top < (self._helper ? co.top : 0)) { - self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); - if (pRatio) self.size.width = self.size.height * o.aspectRatio; - self.position.top = self._helper ? co.top : 0; - } - - self.offset.left = self.parentData.left+self.position.left; - self.offset.top = self.parentData.top+self.position.top; - - var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), - hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); - - var isParent = self.containerElement.get(0) == self.element.parent().get(0), - isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); - - if(isParent && isOffsetRelative) woset -= self.parentData.left; - - if (woset + self.size.width >= self.parentData.width) { - self.size.width = self.parentData.width - woset; - if (pRatio) self.size.height = self.size.width / self.aspectRatio; - } - - if (hoset + self.size.height >= self.parentData.height) { - self.size.height = self.parentData.height - hoset; - if (pRatio) self.size.width = self.size.height * self.aspectRatio; - } - }, - - stop: function(event, ui){ - var self = $(this).data("resizable"), o = self.options, cp = self.position, - co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; - - var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; - - if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) - $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); - - if (self._helper && !o.animate && (/static/).test(ce.css('position'))) - $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); - - } -}); - -$.ui.plugin.add("resizable", "ghost", { - - start: function(event, ui) { - - var self = $(this).data("resizable"), o = self.options, cs = self.size; - - self.ghost = self.originalElement.clone(); - self.ghost - .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) - .addClass('ui-resizable-ghost') - .addClass(typeof o.ghost == 'string' ? o.ghost : ''); - - self.ghost.appendTo(self.helper); - - }, - - resize: function(event, ui){ - var self = $(this).data("resizable"), o = self.options; - if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); - }, - - stop: function(event, ui){ - var self = $(this).data("resizable"), o = self.options; - if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); - } - -}); - -$.ui.plugin.add("resizable", "grid", { - - resize: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; - o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; - var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); - - if (/^(se|s|e)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - } - else if (/^(ne)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.top = op.top - oy; - } - else if (/^(sw)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.left = op.left - ox; - } - else { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.top = op.top - oy; - self.position.left = op.left - ox; - } - } - -}); - -var num = function(v) { - return parseInt(v, 10) || 0; -}; - -var isNumber = function(value) { - return !isNaN(parseInt(value, 10)); -}; - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.selectable.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.selectable.js deleted file mode 100644 index f250c7b87a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.selectable.js +++ /dev/null @@ -1,266 +0,0 @@ -/* - * jQuery UI Selectable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget("ui.selectable", $.ui.mouse, { - options: { - appendTo: 'body', - autoRefresh: true, - distance: 0, - filter: '*', - tolerance: 'touch' - }, - _create: function() { - var self = this; - - this.element.addClass("ui-selectable"); - - this.dragged = false; - - // cache selectee children based on filter - var selectees; - this.refresh = function() { - selectees = $(self.options.filter, self.element[0]); - selectees.each(function() { - var $this = $(this); - var pos = $this.offset(); - $.data(this, "selectable-item", { - element: this, - $element: $this, - left: pos.left, - top: pos.top, - right: pos.left + $this.outerWidth(), - bottom: pos.top + $this.outerHeight(), - startselected: false, - selected: $this.hasClass('ui-selected'), - selecting: $this.hasClass('ui-selecting'), - unselecting: $this.hasClass('ui-unselecting') - }); - }); - }; - this.refresh(); - - this.selectees = selectees.addClass("ui-selectee"); - - this._mouseInit(); - - this.helper = $("
        "); - }, - - destroy: function() { - this.selectees - .removeClass("ui-selectee") - .removeData("selectable-item"); - this.element - .removeClass("ui-selectable ui-selectable-disabled") - .removeData("selectable") - .unbind(".selectable"); - this._mouseDestroy(); - - return this; - }, - - _mouseStart: function(event) { - var self = this; - - this.opos = [event.pageX, event.pageY]; - - if (this.options.disabled) - return; - - var options = this.options; - - this.selectees = $(options.filter, this.element[0]); - - this._trigger("start", event); - - $(options.appendTo).append(this.helper); - // position helper (lasso) - this.helper.css({ - "left": event.clientX, - "top": event.clientY, - "width": 0, - "height": 0 - }); - - if (options.autoRefresh) { - this.refresh(); - } - - this.selectees.filter('.ui-selected').each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.startselected = true; - if (!event.metaKey) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - }); - - $(event.target).parents().andSelf().each(function() { - var selectee = $.data(this, "selectable-item"); - if (selectee) { - var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected'); - selectee.$element - .removeClass(doSelect ? "ui-unselecting" : "ui-selected") - .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); - selectee.unselecting = !doSelect; - selectee.selecting = doSelect; - selectee.selected = doSelect; - // selectable (UN)SELECTING callback - if (doSelect) { - self._trigger("selecting", event, { - selecting: selectee.element - }); - } else { - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - return false; - } - }); - - }, - - _mouseDrag: function(event) { - var self = this; - this.dragged = true; - - if (this.options.disabled) - return; - - var options = this.options; - - var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; - if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } - if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } - this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); - - this.selectees.each(function() { - var selectee = $.data(this, "selectable-item"); - //prevent helper from being selected if appendTo: selectable - if (!selectee || selectee.element == self.element[0]) - return; - var hit = false; - if (options.tolerance == 'touch') { - hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); - } else if (options.tolerance == 'fit') { - hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); - } - - if (hit) { - // SELECT - if (selectee.selected) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - } - if (selectee.unselecting) { - selectee.$element.removeClass('ui-unselecting'); - selectee.unselecting = false; - } - if (!selectee.selecting) { - selectee.$element.addClass('ui-selecting'); - selectee.selecting = true; - // selectable SELECTING callback - self._trigger("selecting", event, { - selecting: selectee.element - }); - } - } else { - // UNSELECT - if (selectee.selecting) { - if (event.metaKey && selectee.startselected) { - selectee.$element.removeClass('ui-selecting'); - selectee.selecting = false; - selectee.$element.addClass('ui-selected'); - selectee.selected = true; - } else { - selectee.$element.removeClass('ui-selecting'); - selectee.selecting = false; - if (selectee.startselected) { - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - } - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - } - if (selectee.selected) { - if (!event.metaKey && !selectee.startselected) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - } - } - }); - - return false; - }, - - _mouseStop: function(event) { - var self = this; - - this.dragged = false; - - var options = this.options; - - $('.ui-unselecting', this.element[0]).each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-unselecting'); - selectee.unselecting = false; - selectee.startselected = false; - self._trigger("unselected", event, { - unselected: selectee.element - }); - }); - $('.ui-selecting', this.element[0]).each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); - selectee.selecting = false; - selectee.selected = true; - selectee.startselected = true; - self._trigger("selected", event, { - selected: selectee.element - }); - }); - this._trigger("stop", event); - - this.helper.remove(); - - return false; - } - -}); - -$.extend($.ui.selectable, { - version: "1.8.12" -}); - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.slider.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.slider.js deleted file mode 100644 index 3dd7d7aa09..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.slider.js +++ /dev/null @@ -1,684 +0,0 @@ -/* - * jQuery UI Slider 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -// number of pages in a slider -// (how many times can you page up/down to go through the whole range) -var numPages = 5; - -$.widget( "ui.slider", $.ui.mouse, { - - widgetEventPrefix: "slide", - - options: { - animate: false, - distance: 0, - max: 100, - min: 0, - orientation: "horizontal", - range: false, - step: 1, - value: 0, - values: null - }, - - _create: function() { - var self = this, - o = this.options; - - this._keySliding = false; - this._mouseSliding = false; - this._animateOff = true; - this._handleIndex = null; - this._detectOrientation(); - this._mouseInit(); - - this.element - .addClass( "ui-slider" + - " ui-slider-" + this.orientation + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" ); - - if ( o.disabled ) { - this.element.addClass( "ui-slider-disabled ui-disabled" ); - } - - this.range = $([]); - - if ( o.range ) { - if ( o.range === true ) { - this.range = $( "
        " ); - if ( !o.values ) { - o.values = [ this._valueMin(), this._valueMin() ]; - } - if ( o.values.length && o.values.length !== 2 ) { - o.values = [ o.values[0], o.values[0] ]; - } - } else { - this.range = $( "
        " ); - } - - this.range - .appendTo( this.element ) - .addClass( "ui-slider-range" ); - - if ( o.range === "min" || o.range === "max" ) { - this.range.addClass( "ui-slider-range-" + o.range ); - } - - // note: this isn't the most fittingly semantic framework class for this element, - // but worked best visually with a variety of themes - this.range.addClass( "ui-widget-header" ); - } - - if ( $( ".ui-slider-handle", this.element ).length === 0 ) { - $( "" ) - .appendTo( this.element ) - .addClass( "ui-slider-handle" ); - } - - if ( o.values && o.values.length ) { - while ( $(".ui-slider-handle", this.element).length < o.values.length ) { - $( "" ) - .appendTo( this.element ) - .addClass( "ui-slider-handle" ); - } - } - - this.handles = $( ".ui-slider-handle", this.element ) - .addClass( "ui-state-default" + - " ui-corner-all" ); - - this.handle = this.handles.eq( 0 ); - - this.handles.add( this.range ).filter( "a" ) - .click(function( event ) { - event.preventDefault(); - }) - .hover(function() { - if ( !o.disabled ) { - $( this ).addClass( "ui-state-hover" ); - } - }, function() { - $( this ).removeClass( "ui-state-hover" ); - }) - .focus(function() { - if ( !o.disabled ) { - $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); - $( this ).addClass( "ui-state-focus" ); - } else { - $( this ).blur(); - } - }) - .blur(function() { - $( this ).removeClass( "ui-state-focus" ); - }); - - this.handles.each(function( i ) { - $( this ).data( "index.ui-slider-handle", i ); - }); - - this.handles - .keydown(function( event ) { - var ret = true, - index = $( this ).data( "index.ui-slider-handle" ), - allowed, - curVal, - newVal, - step; - - if ( self.options.disabled ) { - return; - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - case $.ui.keyCode.END: - case $.ui.keyCode.PAGE_UP: - case $.ui.keyCode.PAGE_DOWN: - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - ret = false; - if ( !self._keySliding ) { - self._keySliding = true; - $( this ).addClass( "ui-state-active" ); - allowed = self._start( event, index ); - if ( allowed === false ) { - return; - } - } - break; - } - - step = self.options.step; - if ( self.options.values && self.options.values.length ) { - curVal = newVal = self.values( index ); - } else { - curVal = newVal = self.value(); - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - newVal = self._valueMin(); - break; - case $.ui.keyCode.END: - newVal = self._valueMax(); - break; - case $.ui.keyCode.PAGE_UP: - newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.PAGE_DOWN: - newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - if ( curVal === self._valueMax() ) { - return; - } - newVal = self._trimAlignValue( curVal + step ); - break; - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - if ( curVal === self._valueMin() ) { - return; - } - newVal = self._trimAlignValue( curVal - step ); - break; - } - - self._slide( event, index, newVal ); - - return ret; - - }) - .keyup(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ); - - if ( self._keySliding ) { - self._keySliding = false; - self._stop( event, index ); - self._change( event, index ); - $( this ).removeClass( "ui-state-active" ); - } - - }); - - this._refreshValue(); - - this._animateOff = false; - }, - - destroy: function() { - this.handles.remove(); - this.range.remove(); - - this.element - .removeClass( "ui-slider" + - " ui-slider-horizontal" + - " ui-slider-vertical" + - " ui-slider-disabled" + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" ) - .removeData( "slider" ) - .unbind( ".slider" ); - - this._mouseDestroy(); - - return this; - }, - - _mouseCapture: function( event ) { - var o = this.options, - position, - normValue, - distance, - closestHandle, - self, - index, - allowed, - offset, - mouseOverHandle; - - if ( o.disabled ) { - return false; - } - - this.elementSize = { - width: this.element.outerWidth(), - height: this.element.outerHeight() - }; - this.elementOffset = this.element.offset(); - - position = { x: event.pageX, y: event.pageY }; - normValue = this._normValueFromMouse( position ); - distance = this._valueMax() - this._valueMin() + 1; - self = this; - this.handles.each(function( i ) { - var thisDistance = Math.abs( normValue - self.values(i) ); - if ( distance > thisDistance ) { - distance = thisDistance; - closestHandle = $( this ); - index = i; - } - }); - - // workaround for bug #3736 (if both handles of a range are at 0, - // the first is always used as the one with least distance, - // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { - index += 1; - closestHandle = $( this.handles[index] ); - } - - allowed = this._start( event, index ); - if ( allowed === false ) { - return false; - } - this._mouseSliding = true; - - self._handleIndex = index; - - closestHandle - .addClass( "ui-state-active" ) - .focus(); - - offset = closestHandle.offset(); - mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); - this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { - left: event.pageX - offset.left - ( closestHandle.width() / 2 ), - top: event.pageY - offset.top - - ( closestHandle.height() / 2 ) - - ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - - ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + - ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) - }; - - if ( !this.handles.hasClass( "ui-state-hover" ) ) { - this._slide( event, index, normValue ); - } - this._animateOff = true; - return true; - }, - - _mouseStart: function( event ) { - return true; - }, - - _mouseDrag: function( event ) { - var position = { x: event.pageX, y: event.pageY }, - normValue = this._normValueFromMouse( position ); - - this._slide( event, this._handleIndex, normValue ); - - return false; - }, - - _mouseStop: function( event ) { - this.handles.removeClass( "ui-state-active" ); - this._mouseSliding = false; - - this._stop( event, this._handleIndex ); - this._change( event, this._handleIndex ); - - this._handleIndex = null; - this._clickOffset = null; - this._animateOff = false; - - return false; - }, - - _detectOrientation: function() { - this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; - }, - - _normValueFromMouse: function( position ) { - var pixelTotal, - pixelMouse, - percentMouse, - valueTotal, - valueMouse; - - if ( this.orientation === "horizontal" ) { - pixelTotal = this.elementSize.width; - pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); - } else { - pixelTotal = this.elementSize.height; - pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); - } - - percentMouse = ( pixelMouse / pixelTotal ); - if ( percentMouse > 1 ) { - percentMouse = 1; - } - if ( percentMouse < 0 ) { - percentMouse = 0; - } - if ( this.orientation === "vertical" ) { - percentMouse = 1 - percentMouse; - } - - valueTotal = this._valueMax() - this._valueMin(); - valueMouse = this._valueMin() + percentMouse * valueTotal; - - return this._trimAlignValue( valueMouse ); - }, - - _start: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - return this._trigger( "start", event, uiHash ); - }, - - _slide: function( event, index, newVal ) { - var otherVal, - newValues, - allowed; - - if ( this.options.values && this.options.values.length ) { - otherVal = this.values( index ? 0 : 1 ); - - if ( ( this.options.values.length === 2 && this.options.range === true ) && - ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) - ) { - newVal = otherVal; - } - - if ( newVal !== this.values( index ) ) { - newValues = this.values(); - newValues[ index ] = newVal; - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal, - values: newValues - } ); - otherVal = this.values( index ? 0 : 1 ); - if ( allowed !== false ) { - this.values( index, newVal, true ); - } - } - } else { - if ( newVal !== this.value() ) { - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal - } ); - if ( allowed !== false ) { - this.value( newVal ); - } - } - } - }, - - _stop: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "stop", event, uiHash ); - }, - - _change: function( event, index ) { - if ( !this._keySliding && !this._mouseSliding ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "change", event, uiHash ); - } - }, - - value: function( newValue ) { - if ( arguments.length ) { - this.options.value = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, 0 ); - return; - } - - return this._value(); - }, - - values: function( index, newValue ) { - var vals, - newValues, - i; - - if ( arguments.length > 1 ) { - this.options.values[ index ] = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, index ); - return; - } - - if ( arguments.length ) { - if ( $.isArray( arguments[ 0 ] ) ) { - vals = this.options.values; - newValues = arguments[ 0 ]; - for ( i = 0; i < vals.length; i += 1 ) { - vals[ i ] = this._trimAlignValue( newValues[ i ] ); - this._change( null, i ); - } - this._refreshValue(); - } else { - if ( this.options.values && this.options.values.length ) { - return this._values( index ); - } else { - return this.value(); - } - } - } else { - return this._values(); - } - }, - - _setOption: function( key, value ) { - var i, - valsLength = 0; - - if ( $.isArray( this.options.values ) ) { - valsLength = this.options.values.length; - } - - $.Widget.prototype._setOption.apply( this, arguments ); - - switch ( key ) { - case "disabled": - if ( value ) { - this.handles.filter( ".ui-state-focus" ).blur(); - this.handles.removeClass( "ui-state-hover" ); - this.handles.attr( "disabled", "disabled" ); - this.element.addClass( "ui-disabled" ); - } else { - this.handles.removeAttr( "disabled" ); - this.element.removeClass( "ui-disabled" ); - } - break; - case "orientation": - this._detectOrientation(); - this.element - .removeClass( "ui-slider-horizontal ui-slider-vertical" ) - .addClass( "ui-slider-" + this.orientation ); - this._refreshValue(); - break; - case "value": - this._animateOff = true; - this._refreshValue(); - this._change( null, 0 ); - this._animateOff = false; - break; - case "values": - this._animateOff = true; - this._refreshValue(); - for ( i = 0; i < valsLength; i += 1 ) { - this._change( null, i ); - } - this._animateOff = false; - break; - } - }, - - //internal value getter - // _value() returns value trimmed by min and max, aligned by step - _value: function() { - var val = this.options.value; - val = this._trimAlignValue( val ); - - return val; - }, - - //internal values getter - // _values() returns array of values trimmed by min and max, aligned by step - // _values( index ) returns single value trimmed by min and max, aligned by step - _values: function( index ) { - var val, - vals, - i; - - if ( arguments.length ) { - val = this.options.values[ index ]; - val = this._trimAlignValue( val ); - - return val; - } else { - // .slice() creates a copy of the array - // this copy gets trimmed by min and max and then returned - vals = this.options.values.slice(); - for ( i = 0; i < vals.length; i+= 1) { - vals[ i ] = this._trimAlignValue( vals[ i ] ); - } - - return vals; - } - }, - - // returns the step-aligned value that val is closest to, between (inclusive) min and max - _trimAlignValue: function( val ) { - if ( val <= this._valueMin() ) { - return this._valueMin(); - } - if ( val >= this._valueMax() ) { - return this._valueMax(); - } - var step = ( this.options.step > 0 ) ? this.options.step : 1, - valModStep = (val - this._valueMin()) % step; - alignValue = val - valModStep; - - if ( Math.abs(valModStep) * 2 >= step ) { - alignValue += ( valModStep > 0 ) ? step : ( -step ); - } - - // Since JavaScript has problems with large floats, round - // the final value to 5 digits after the decimal point (see #4124) - return parseFloat( alignValue.toFixed(5) ); - }, - - _valueMin: function() { - return this.options.min; - }, - - _valueMax: function() { - return this.options.max; - }, - - _refreshValue: function() { - var oRange = this.options.range, - o = this.options, - self = this, - animate = ( !this._animateOff ) ? o.animate : false, - valPercent, - _set = {}, - lastValPercent, - value, - valueMin, - valueMax; - - if ( this.options.values && this.options.values.length ) { - this.handles.each(function( i, j ) { - valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - if ( self.options.range === true ) { - if ( self.orientation === "horizontal" ) { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } else { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - lastValPercent = valPercent; - }); - } else { - value = this.value(); - valueMin = this._valueMin(); - valueMax = this._valueMax(); - valPercent = ( valueMax !== valueMin ) ? - ( value - valueMin ) / ( valueMax - valueMin ) * 100 : - 0; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - - if ( oRange === "min" && this.orientation === "horizontal" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "horizontal" ) { - this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - if ( oRange === "min" && this.orientation === "vertical" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "vertical" ) { - this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - -}); - -$.extend( $.ui.slider, { - version: "1.8.12" -}); - -}(jQuery)); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.sortable.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.sortable.js deleted file mode 100644 index bad29b539e..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.sortable.js +++ /dev/null @@ -1,1077 +0,0 @@ -/* - * jQuery UI Sortable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Sortables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget("ui.sortable", $.ui.mouse, { - widgetEventPrefix: "sort", - options: { - appendTo: "parent", - axis: false, - connectWith: false, - containment: false, - cursor: 'auto', - cursorAt: false, - dropOnEmpty: true, - forcePlaceholderSize: false, - forceHelperSize: false, - grid: false, - handle: false, - helper: "original", - items: '> *', - opacity: false, - placeholder: false, - revert: false, - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - scope: "default", - tolerance: "intersect", - zIndex: 1000 - }, - _create: function() { - - var o = this.options; - this.containerCache = {}; - this.element.addClass("ui-sortable"); - - //Get the items - this.refresh(); - - //Let's determine if the items are being displayed horizontally - this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; - - //Let's determine the parent's offset - this.offset = this.element.offset(); - - //Initialize mouse events for interaction - this._mouseInit(); - - }, - - destroy: function() { - this.element - .removeClass("ui-sortable ui-sortable-disabled") - .removeData("sortable") - .unbind(".sortable"); - this._mouseDestroy(); - - for ( var i = this.items.length - 1; i >= 0; i-- ) - this.items[i].item.removeData("sortable-item"); - - return this; - }, - - _setOption: function(key, value){ - if ( key === "disabled" ) { - this.options[ key ] = value; - - this.widget() - [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" ); - } else { - // Don't call widget base _setOption for disable as it adds ui-state-disabled class - $.Widget.prototype._setOption.apply(this, arguments); - } - }, - - _mouseCapture: function(event, overrideHandle) { - - if (this.reverting) { - return false; - } - - if(this.options.disabled || this.options.type == 'static') return false; - - //We have to refresh the items data once first - this._refreshItems(event); - - //Find out if the clicked node (or one of its parents) is a actual item in this.items - var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { - if($.data(this, 'sortable-item') == self) { - currentItem = $(this); - return false; - } - }); - if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target); - - if(!currentItem) return false; - if(this.options.handle && !overrideHandle) { - var validHandle = false; - - $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); - if(!validHandle) return false; - } - - this.currentItem = currentItem; - this._removeCurrentsFromItems(); - return true; - - }, - - _mouseStart: function(event, overrideHandle, noActivation) { - - var o = this.options, self = this; - this.currentContainer = this; - - //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture - this.refreshPositions(); - - //Create and append the visible helper - this.helper = this._createHelper(event); - - //Cache the helper size - this._cacheHelperProportions(); - - /* - * - Position generation - - * This block generates everything position related - it's the core of draggables. - */ - - //Cache the margins of the original element - this._cacheMargins(); - - //Get the next scrolling parent - this.scrollParent = this.helper.scrollParent(); - - //The element's absolute position on the page minus margins - this.offset = this.currentItem.offset(); - this.offset = { - top: this.offset.top - this.margins.top, - left: this.offset.left - this.margins.left - }; - - // Only after we got the offset, we can change the helper's position to absolute - // TODO: Still need to figure out a way to make relative sorting possible - this.helper.css("position", "absolute"); - this.cssPosition = this.helper.css("position"); - - $.extend(this.offset, { - click: { //Where the click happened, relative to the element - left: event.pageX - this.offset.left, - top: event.pageY - this.offset.top - }, - parent: this._getParentOffset(), - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper - }); - - //Generate the original position - this.originalPosition = this._generatePosition(event); - this.originalPageX = event.pageX; - this.originalPageY = event.pageY; - - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); - - //Cache the former DOM position - this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; - - //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way - if(this.helper[0] != this.currentItem[0]) { - this.currentItem.hide(); - } - - //Create the placeholder - this._createPlaceholder(); - - //Set a containment if given in the options - if(o.containment) - this._setContainment(); - - if(o.cursor) { // cursor option - if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); - $('body').css("cursor", o.cursor); - } - - if(o.opacity) { // opacity option - if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); - this.helper.css("opacity", o.opacity); - } - - if(o.zIndex) { // zIndex option - if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); - this.helper.css("zIndex", o.zIndex); - } - - //Prepare scrolling - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') - this.overflowOffset = this.scrollParent.offset(); - - //Call callbacks - this._trigger("start", event, this._uiHash()); - - //Recache the helper size - if(!this._preserveHelperProportions) - this._cacheHelperProportions(); - - - //Post 'activate' events to possible containers - if(!noActivation) { - for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); } - } - - //Prepare possible droppables - if($.ui.ddmanager) - $.ui.ddmanager.current = this; - - if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - - this.dragging = true; - - this.helper.addClass("ui-sortable-helper"); - this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position - return true; - - }, - - _mouseDrag: function(event) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - if (!this.lastPositionAbs) { - this.lastPositionAbs = this.positionAbs; - } - - //Do scrolling - if(this.options.scroll) { - var o = this.options, scrolled = false; - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { - - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; - - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; - - } else { - - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - } - - //Regenerate the absolute position used for position checks - this.positionAbs = this._convertPositionTo("absolute"); - - //Set the helper position - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - - //Rearrange - for (var i = this.items.length - 1; i >= 0; i--) { - - //Cache variables and intersection, continue if no intersection - var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); - if (!intersection) continue; - - if(itemElement != this.currentItem[0] //cannot intersect with itself - && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before - && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked - && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) - //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container - ) { - - this.direction = intersection == 1 ? "down" : "up"; - - if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { - this._rearrange(event, item); - } else { - break; - } - - this._trigger("change", event, this._uiHash()); - break; - } - } - - //Post events to containers - this._contactContainers(event); - - //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - //Call callbacks - this._trigger('sort', event, this._uiHash()); - - this.lastPositionAbs = this.positionAbs; - return false; - - }, - - _mouseStop: function(event, noPropagation) { - - if(!event) return; - - //If we are using droppables, inform the manager about the drop - if ($.ui.ddmanager && !this.options.dropBehaviour) - $.ui.ddmanager.drop(this, event); - - if(this.options.revert) { - var self = this; - var cur = self.placeholder.offset(); - - self.reverting = true; - - $(this.helper).animate({ - left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), - top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) - }, parseInt(this.options.revert, 10) || 500, function() { - self._clear(event); - }); - } else { - this._clear(event, noPropagation); - } - - return false; - - }, - - cancel: function() { - - var self = this; - - if(this.dragging) { - - this._mouseUp({ target: null }); - - if(this.options.helper == "original") - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); - else - this.currentItem.show(); - - //Post deactivating events to containers - for (var i = this.containers.length - 1; i >= 0; i--){ - this.containers[i]._trigger("deactivate", null, self._uiHash(this)); - if(this.containers[i].containerCache.over) { - this.containers[i]._trigger("out", null, self._uiHash(this)); - this.containers[i].containerCache.over = 0; - } - } - - } - - if (this.placeholder) { - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - - $.extend(this, { - helper: null, - dragging: false, - reverting: false, - _noFinalSort: null - }); - - if(this.domPosition.prev) { - $(this.domPosition.prev).after(this.currentItem); - } else { - $(this.domPosition.parent).prepend(this.currentItem); - } - } - - return this; - - }, - - serialize: function(o) { - - var items = this._getItemsAsjQuery(o && o.connected); - var str = []; o = o || {}; - - $(items).each(function() { - var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); - if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); - }); - - if(!str.length && o.key) { - str.push(o.key + '='); - } - - return str.join('&'); - - }, - - toArray: function(o) { - - var items = this._getItemsAsjQuery(o && o.connected); - var ret = []; o = o || {}; - - items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); - return ret; - - }, - - /* Be careful with the following core functions */ - _intersectsWith: function(item) { - - var x1 = this.positionAbs.left, - x2 = x1 + this.helperProportions.width, - y1 = this.positionAbs.top, - y2 = y1 + this.helperProportions.height; - - var l = item.left, - r = l + item.width, - t = item.top, - b = t + item.height; - - var dyClick = this.offset.click.top, - dxClick = this.offset.click.left; - - var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; - - if( this.options.tolerance == "pointer" - || this.options.forcePointerForContainers - || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) - ) { - return isOverElement; - } else { - - return (l < x1 + (this.helperProportions.width / 2) // Right Half - && x2 - (this.helperProportions.width / 2) < r // Left Half - && t < y1 + (this.helperProportions.height / 2) // Bottom Half - && y2 - (this.helperProportions.height / 2) < b ); // Top Half - - } - }, - - _intersectsWithPointer: function(item) { - - var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), - isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), - isOverElement = isOverElementHeight && isOverElementWidth, - verticalDirection = this._getDragVerticalDirection(), - horizontalDirection = this._getDragHorizontalDirection(); - - if (!isOverElement) - return false; - - return this.floating ? - ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) - : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); - - }, - - _intersectsWithSides: function(item) { - - var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), - isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), - verticalDirection = this._getDragVerticalDirection(), - horizontalDirection = this._getDragHorizontalDirection(); - - if (this.floating && horizontalDirection) { - return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); - } else { - return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); - } - - }, - - _getDragVerticalDirection: function() { - var delta = this.positionAbs.top - this.lastPositionAbs.top; - return delta != 0 && (delta > 0 ? "down" : "up"); - }, - - _getDragHorizontalDirection: function() { - var delta = this.positionAbs.left - this.lastPositionAbs.left; - return delta != 0 && (delta > 0 ? "right" : "left"); - }, - - refresh: function(event) { - this._refreshItems(event); - this.refreshPositions(); - return this; - }, - - _connectWith: function() { - var options = this.options; - return options.connectWith.constructor == String - ? [options.connectWith] - : options.connectWith; - }, - - _getItemsAsjQuery: function(connected) { - - var self = this; - var items = []; - var queries = []; - var connectWith = this._connectWith(); - - if(connectWith && connected) { - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], 'sortable'); - if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); - } - }; - }; - } - - queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); - - for (var i = queries.length - 1; i >= 0; i--){ - queries[i][0].each(function() { - items.push(this); - }); - }; - - return $(items); - - }, - - _removeCurrentsFromItems: function() { - - var list = this.currentItem.find(":data(sortable-item)"); - - for (var i=0; i < this.items.length; i++) { - - for (var j=0; j < list.length; j++) { - if(list[j] == this.items[i].item[0]) - this.items.splice(i,1); - }; - - }; - - }, - - _refreshItems: function(event) { - - this.items = []; - this.containers = [this]; - var items = this.items; - var self = this; - var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; - var connectWith = this._connectWith(); - - if(connectWith) { - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], 'sortable'); - if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); - this.containers.push(inst); - } - }; - }; - } - - for (var i = queries.length - 1; i >= 0; i--) { - var targetData = queries[i][1]; - var _queries = queries[i][0]; - - for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { - var item = $(_queries[j]); - - item.data('sortable-item', targetData); // Data for target checking (mouse manager) - - items.push({ - item: item, - instance: targetData, - width: 0, height: 0, - left: 0, top: 0 - }); - }; - }; - - }, - - refreshPositions: function(fast) { - - //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change - if(this.offsetParent && this.helper) { - this.offset.parent = this._getParentOffset(); - } - - for (var i = this.items.length - 1; i >= 0; i--){ - var item = this.items[i]; - - //We ignore calculating positions of all connected containers when we're not over them - if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) - continue; - - var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; - - if (!fast) { - item.width = t.outerWidth(); - item.height = t.outerHeight(); - } - - var p = t.offset(); - item.left = p.left; - item.top = p.top; - }; - - if(this.options.custom && this.options.custom.refreshContainers) { - this.options.custom.refreshContainers.call(this); - } else { - for (var i = this.containers.length - 1; i >= 0; i--){ - var p = this.containers[i].element.offset(); - this.containers[i].containerCache.left = p.left; - this.containers[i].containerCache.top = p.top; - this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); - this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); - }; - } - - return this; - }, - - _createPlaceholder: function(that) { - - var self = that || this, o = self.options; - - if(!o.placeholder || o.placeholder.constructor == String) { - var className = o.placeholder; - o.placeholder = { - element: function() { - - var el = $(document.createElement(self.currentItem[0].nodeName)) - .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") - .removeClass("ui-sortable-helper")[0]; - - if(!className) - el.style.visibility = "hidden"; - - return el; - }, - update: function(container, p) { - - // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that - // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified - if(className && !o.forcePlaceholderSize) return; - - //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item - if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; - if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; - } - }; - } - - //Create the placeholder - self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); - - //Append it after the actual current item - self.currentItem.after(self.placeholder); - - //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) - o.placeholder.update(self, self.placeholder); - - }, - - _contactContainers: function(event) { - - // get innermost container that intersects with item - var innermostContainer = null, innermostIndex = null; - - - for (var i = this.containers.length - 1; i >= 0; i--){ - - // never consider a container that's located within the item itself - if($.ui.contains(this.currentItem[0], this.containers[i].element[0])) - continue; - - if(this._intersectsWith(this.containers[i].containerCache)) { - - // if we've already found a container and it's more "inner" than this, then continue - if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0])) - continue; - - innermostContainer = this.containers[i]; - innermostIndex = i; - - } else { - // container doesn't intersect. trigger "out" event if necessary - if(this.containers[i].containerCache.over) { - this.containers[i]._trigger("out", event, this._uiHash(this)); - this.containers[i].containerCache.over = 0; - } - } - - } - - // if no intersecting containers found, return - if(!innermostContainer) return; - - // move the item into the container if it's not there already - if(this.containers.length === 1) { - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); - this.containers[innermostIndex].containerCache.over = 1; - } else if(this.currentContainer != this.containers[innermostIndex]) { - - //When entering a new container, we will find the item with the least distance and append our item near it - var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; - for (var j = this.items.length - 1; j >= 0; j--) { - if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; - var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; - if(Math.abs(cur - base) < dist) { - dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; - } - } - - if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled - return; - - this.currentContainer = this.containers[innermostIndex]; - itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); - this._trigger("change", event, this._uiHash()); - this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); - - //Update the placeholder - this.options.placeholder.update(this.currentContainer, this.placeholder); - - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); - this.containers[innermostIndex].containerCache.over = 1; - } - - - }, - - _createHelper: function(event) { - - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); - - if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already - $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); - - if(helper[0] == this.currentItem[0]) - this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; - - if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); - if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); - - return helper; - - }, - - _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); - } - if ($.isArray(obj)) { - obj = {left: +obj[0], top: +obj[1] || 0}; - } - if ('left' in obj) { - this.offset.click.left = obj.left + this.margins.left; - } - if ('right' in obj) { - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; - } - if ('top' in obj) { - this.offset.click.top = obj.top + this.margins.top; - } - if ('bottom' in obj) { - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; - } - }, - - _getParentOffset: function() { - - - //Get the offsetParent and cache its position - this.offsetParent = this.helper.offsetParent(); - var po = this.offsetParent.offset(); - - // This is a special case where we need to modify a offset calculated on start, since the following happened: - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { - po.left += this.scrollParent.scrollLeft(); - po.top += this.scrollParent.scrollTop(); - } - - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix - po = { top: 0, left: 0 }; - - return { - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) - }; - - }, - - _getRelativeOffset: function() { - - if(this.cssPosition == "relative") { - var p = this.currentItem.position(); - return { - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() - }; - } else { - return { top: 0, left: 0 }; - } - - }, - - _cacheMargins: function() { - this.margins = { - left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), - top: (parseInt(this.currentItem.css("marginTop"),10) || 0) - }; - }, - - _cacheHelperProportions: function() { - this.helperProportions = { - width: this.helper.outerWidth(), - height: this.helper.outerHeight() - }; - }, - - _setContainment: function() { - - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - 0 - this.offset.relative.left - this.offset.parent.left, - 0 - this.offset.relative.top - this.offset.parent.top, - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; - - if(!(/^(document|window|parent)$/).test(o.containment)) { - var ce = $(o.containment)[0]; - var co = $(o.containment).offset(); - var over = ($(ce).css("overflow") != 'hidden'); - - this.containment = [ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, - co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, - co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - ]; - } - - }, - - _convertPositionTo: function(d, pos) { - - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - return { - top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) - ), - left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) - ) - }; - - }, - - _generatePosition: function(event) { - - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - // This is another very weird special case that only happens for relative elements: - // 1. If the css position is relative - // 2. and the scroll parent is the document or similar to the offset parent - // we have to refresh the relative offset during the scroll so there are no jumps - if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { - this.offset.relative = this._getRelativeOffset(); - } - - var pageX = event.pageX; - var pageY = event.pageY; - - /* - * - Position constraining - - * Constrain the position to a mix of grid, containment. - */ - - if(this.originalPosition) { //If we are not dragging yet, we won't check for options - - if(this.containment) { - if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; - } - - if(o.grid) { - var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; - pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - - var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; - pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; - } - - } - - return { - top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) - ), - left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) - ) - }; - - }, - - _rearrange: function(event, i, a, hardRefresh) { - - a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); - - //Various things done here to improve the performance: - // 1. we create a setTimeout, that calls refreshPositions - // 2. on the instance, we have a counter variable, that get's higher after every append - // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same - // 4. this lets only the last addition to the timeout stack through - this.counter = this.counter ? ++this.counter : 1; - var self = this, counter = this.counter; - - window.setTimeout(function() { - if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove - },0); - - }, - - _clear: function(event, noPropagation) { - - this.reverting = false; - // We delay all events that have to be triggered to after the point where the placeholder has been removed and - // everything else normalized again - var delayedTriggers = [], self = this; - - // We first have to update the dom position of the actual currentItem - // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) - if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem); - this._noFinalSort = null; - - if(this.helper[0] == this.currentItem[0]) { - for(var i in this._storedCSS) { - if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; - } - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); - } else { - this.currentItem.show(); - } - - if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); - if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed - if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element - if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); - for (var i = this.containers.length - 1; i >= 0; i--){ - if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { - delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - } - }; - }; - - //Post events to containers - for (var i = this.containers.length - 1; i >= 0; i--){ - if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - if(this.containers[i].containerCache.over) { - delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - this.containers[i].containerCache.over = 0; - } - } - - //Do what was originally in plugins - if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor - if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity - if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index - - this.dragging = false; - if(this.cancelHelperRemoval) { - if(!noPropagation) { - this._trigger("beforeStop", event, this._uiHash()); - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events - this._trigger("stop", event, this._uiHash()); - } - return false; - } - - if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); - - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - - if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; - - if(!noPropagation) { - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events - this._trigger("stop", event, this._uiHash()); - } - - this.fromOutside = false; - return true; - - }, - - _trigger: function() { - if ($.Widget.prototype._trigger.apply(this, arguments) === false) { - this.cancel(); - } - }, - - _uiHash: function(inst) { - var self = inst || this; - return { - helper: self.helper, - placeholder: self.placeholder || $([]), - position: self.position, - originalPosition: self.originalPosition, - offset: self.positionAbs, - item: self.currentItem, - sender: inst ? inst.element : null - }; - } - -}); - -$.extend($.ui.sortable, { - version: "1.8.12" -}); - -})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.tabs.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.tabs.js deleted file mode 100644 index 9e72e04b17..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.tabs.js +++ /dev/null @@ -1,758 +0,0 @@ -/* - * jQuery UI Tabs 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -var tabId = 0, - listId = 0; - -function getNextTabId() { - return ++tabId; -} - -function getNextListId() { - return ++listId; -} - -$.widget( "ui.tabs", { - options: { - add: null, - ajaxOptions: null, - cache: false, - cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } - collapsible: false, - disable: null, - disabled: [], - enable: null, - event: "click", - fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } - idPrefix: "ui-tabs-", - load: null, - panelTemplate: "
        ", - remove: null, - select: null, - show: null, - spinner: "Loading…", - tabTemplate: "
      • #{label}
      • " - }, - - _create: function() { - this._tabify( true ); - }, - - _setOption: function( key, value ) { - if ( key == "selected" ) { - if (this.options.collapsible && value == this.options.selected ) { - return; - } - this.select( value ); - } else { - this.options[ key ] = value; - this._tabify(); - } - }, - - _tabId: function( a ) { - return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || - this.options.idPrefix + getNextTabId(); - }, - - _sanitizeSelector: function( hash ) { - // we need this because an id may contain a ":" - return hash.replace( /:/g, "\\:" ); - }, - - _cookie: function() { - var cookie = this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); - return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); - }, - - _ui: function( tab, panel ) { - return { - tab: tab, - panel: panel, - index: this.anchors.index( tab ) - }; - }, - - _cleanup: function() { - // restore all former loading tabs labels - this.lis.filter( ".ui-state-processing" ) - .removeClass( "ui-state-processing" ) - .find( "span:data(label.tabs)" ) - .each(function() { - var el = $( this ); - el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); - }); - }, - - _tabify: function( init ) { - var self = this, - o = this.options, - fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash - - this.list = this.element.find( "ol,ul" ).eq( 0 ); - this.lis = $( " > li:has(a[href])", this.list ); - this.anchors = this.lis.map(function() { - return $( "a", this )[ 0 ]; - }); - this.panels = $( [] ); - - this.anchors.each(function( i, a ) { - var href = $( a ).attr( "href" ); - // For dynamically created HTML that contains a hash as href IE < 8 expands - // such href to the full page url with hash and then misinterprets tab as ajax. - // Same consideration applies for an added tab with a fragment identifier - // since a[href=#fragment-identifier] does unexpectedly not match. - // Thus normalize href attribute... - var hrefBase = href.split( "#" )[ 0 ], - baseEl; - if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || - ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { - href = a.hash; - a.href = href; - } - - // inline tab - if ( fragmentId.test( href ) ) { - self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); - // remote tab - // prevent loading the page itself if href is just "#" - } else if ( href && href !== "#" ) { - // required for restore on destroy - $.data( a, "href.tabs", href ); - - // TODO until #3808 is fixed strip fragment identifier from url - // (IE fails to load from such url) - $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); - - var id = self._tabId( a ); - a.href = "#" + id; - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) - .insertAfter( self.panels[ i - 1 ] || self.list ); - $panel.data( "destroy.tabs", true ); - } - self.panels = self.panels.add( $panel ); - // invalid tab href - } else { - o.disabled.push( i ); - } - }); - - // initialization from scratch - if ( init ) { - // attach necessary classes for styling - this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); - this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - this.lis.addClass( "ui-state-default ui-corner-top" ); - this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); - - // Selected tab - // use "selected" option or try to retrieve: - // 1. from fragment identifier in url - // 2. from cookie - // 3. from selected class attribute on
      • - if ( o.selected === undefined ) { - if ( location.hash ) { - this.anchors.each(function( i, a ) { - if ( a.hash == location.hash ) { - o.selected = i; - return false; - } - }); - } - if ( typeof o.selected !== "number" && o.cookie ) { - o.selected = parseInt( self._cookie(), 10 ); - } - if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - o.selected = o.selected || ( this.lis.length ? 0 : -1 ); - } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release - o.selected = -1; - } - - // sanity check - default to first tab... - o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) - ? o.selected - : 0; - - // Take disabling tabs via class attribute from HTML - // into account and update option properly. - // A selected tab cannot become disabled. - o.disabled = $.unique( o.disabled.concat( - $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { - return self.lis.index( n ); - }) - ) ).sort(); - - if ( $.inArray( o.selected, o.disabled ) != -1 ) { - o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); - } - - // highlight selected tab - this.panels.addClass( "ui-tabs-hide" ); - this.lis.removeClass( "ui-tabs-selected ui-state-active" ); - // check for length avoids error when initializing empty list - if ( o.selected >= 0 && this.anchors.length ) { - self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); - this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); - - // seems to be expected behavior that the show callback is fired - self.element.queue( "tabs", function() { - self._trigger( "show", null, - self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); - }); - - this.load( o.selected ); - } - - // clean up to avoid memory leaks in certain versions of IE 6 - // TODO: namespace this event - $( window ).bind( "unload", function() { - self.lis.add( self.anchors ).unbind( ".tabs" ); - self.lis = self.anchors = self.panels = null; - }); - // update selected after add/remove - } else { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - - // update collapsible - // TODO: use .toggleClass() - this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); - - // set or update cookie after init and add/remove respectively - if ( o.cookie ) { - this._cookie( o.selected, o.cookie ); - } - - // disable tabs - for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { - $( li )[ $.inArray( i, o.disabled ) != -1 && - // TODO: use .toggleClass() - !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); - } - - // reset cache if switching from cached to not cached - if ( o.cache === false ) { - this.anchors.removeData( "cache.tabs" ); - } - - // remove all handlers before, tabify may run on existing tabs after add or option change - this.lis.add( this.anchors ).unbind( ".tabs" ); - - if ( o.event !== "mouseover" ) { - var addState = function( state, el ) { - if ( el.is( ":not(.ui-state-disabled)" ) ) { - el.addClass( "ui-state-" + state ); - } - }; - var removeState = function( state, el ) { - el.removeClass( "ui-state-" + state ); - }; - this.lis.bind( "mouseover.tabs" , function() { - addState( "hover", $( this ) ); - }); - this.lis.bind( "mouseout.tabs", function() { - removeState( "hover", $( this ) ); - }); - this.anchors.bind( "focus.tabs", function() { - addState( "focus", $( this ).closest( "li" ) ); - }); - this.anchors.bind( "blur.tabs", function() { - removeState( "focus", $( this ).closest( "li" ) ); - }); - } - - // set up animations - var hideFx, showFx; - if ( o.fx ) { - if ( $.isArray( o.fx ) ) { - hideFx = o.fx[ 0 ]; - showFx = o.fx[ 1 ]; - } else { - hideFx = showFx = o.fx; - } - } - - // Reset certain styles left over from animation - // and prevent IE's ClearType bug... - function resetStyle( $el, fx ) { - $el.css( "display", "" ); - if ( !$.support.opacity && fx.opacity ) { - $el[ 0 ].style.removeAttribute( "filter" ); - } - } - - // Show a tab... - var showTab = showFx - ? function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way - .animate( showFx, showFx.duration || "normal", function() { - resetStyle( $show, showFx ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }); - } - : function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.removeClass( "ui-tabs-hide" ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }; - - // Hide a tab, $show is optional... - var hideTab = hideFx - ? function( clicked, $hide ) { - $hide.animate( hideFx, hideFx.duration || "normal", function() { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - resetStyle( $hide, hideFx ); - self.element.dequeue( "tabs" ); - }); - } - : function( clicked, $hide, $show ) { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - self.element.dequeue( "tabs" ); - }; - - // attach tab event handler, unbind to avoid duplicates from former tabifying... - this.anchors.bind( o.event + ".tabs", function() { - var el = this, - $li = $(el).closest( "li" ), - $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), - $show = self.element.find( self._sanitizeSelector( el.hash ) ); - - // If tab is already selected and not collapsible or tab disabled or - // or is already loading or click callback returns false stop here. - // Check if click handler returns false last so that it is not executed - // for a disabled or loading tab! - if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || - $li.hasClass( "ui-state-disabled" ) || - $li.hasClass( "ui-state-processing" ) || - self.panels.filter( ":animated" ).length || - self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { - this.blur(); - return false; - } - - o.selected = self.anchors.index( this ); - - self.abort(); - - // if tab may be closed - if ( o.collapsible ) { - if ( $li.hasClass( "ui-tabs-selected" ) ) { - o.selected = -1; - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }).dequeue( "tabs" ); - - this.blur(); - return false; - } else if ( !$hide.length ) { - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 - self.load( self.anchors.index( this ) ); - - this.blur(); - return false; - } - } - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - // show new tab - if ( $show.length ) { - if ( $hide.length ) { - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }); - } - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - self.load( self.anchors.index( this ) ); - } else { - throw "jQuery UI Tabs: Mismatching fragment identifier."; - } - - // Prevent IE from keeping other link focussed when using the back button - // and remove dotted border from clicked link. This is controlled via CSS - // in modern browsers; blur() removes focus from address bar in Firefox - // which can become a usability and annoying problem with tabs('rotate'). - if ( $.browser.msie ) { - this.blur(); - } - }); - - // disable click in any case - this.anchors.bind( "click.tabs", function(){ - return false; - }); - }, - - _getIndex: function( index ) { - // meta-function to give users option to provide a href string instead of a numerical index. - // also sanitizes numerical indexes to valid values. - if ( typeof index == "string" ) { - index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); - } - - return index; - }, - - destroy: function() { - var o = this.options; - - this.abort(); - - this.element - .unbind( ".tabs" ) - .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) - .removeData( "tabs" ); - - this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - - this.anchors.each(function() { - var href = $.data( this, "href.tabs" ); - if ( href ) { - this.href = href; - } - var $this = $( this ).unbind( ".tabs" ); - $.each( [ "href", "load", "cache" ], function( i, prefix ) { - $this.removeData( prefix + ".tabs" ); - }); - }); - - this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { - if ( $.data( this, "destroy.tabs" ) ) { - $( this ).remove(); - } else { - $( this ).removeClass([ - "ui-state-default", - "ui-corner-top", - "ui-tabs-selected", - "ui-state-active", - "ui-state-hover", - "ui-state-focus", - "ui-state-disabled", - "ui-tabs-panel", - "ui-widget-content", - "ui-corner-bottom", - "ui-tabs-hide" - ].join( " " ) ); - } - }); - - if ( o.cookie ) { - this._cookie( null, o.cookie ); - } - - return this; - }, - - add: function( url, label, index ) { - if ( index === undefined ) { - index = this.anchors.length; - } - - var self = this, - o = this.options, - $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), - id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); - - $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); - - // try to find an existing element before creating a new one - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .data( "destroy.tabs", true ); - } - $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); - - if ( index >= this.lis.length ) { - $li.appendTo( this.list ); - $panel.appendTo( this.list[ 0 ].parentNode ); - } else { - $li.insertBefore( this.lis[ index ] ); - $panel.insertBefore( this.panels[ index ] ); - } - - o.disabled = $.map( o.disabled, function( n, i ) { - return n >= index ? ++n : n; - }); - - this._tabify(); - - if ( this.anchors.length == 1 ) { - o.selected = 0; - $li.addClass( "ui-tabs-selected ui-state-active" ); - $panel.removeClass( "ui-tabs-hide" ); - this.element.queue( "tabs", function() { - self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); - }); - - this.load( 0 ); - } - - this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - remove: function( index ) { - index = this._getIndex( index ); - var o = this.options, - $li = this.lis.eq( index ).remove(), - $panel = this.panels.eq( index ).remove(); - - // If selected tab was removed focus tab to the right or - // in case the last tab was removed the tab to the left. - if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { - this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); - } - - o.disabled = $.map( - $.grep( o.disabled, function(n, i) { - return n != index; - }), - function( n, i ) { - return n >= index ? --n : n; - }); - - this._tabify(); - - this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); - return this; - }, - - enable: function( index ) { - index = this._getIndex( index ); - var o = this.options; - if ( $.inArray( index, o.disabled ) == -1 ) { - return; - } - - this.lis.eq( index ).removeClass( "ui-state-disabled" ); - o.disabled = $.grep( o.disabled, function( n, i ) { - return n != index; - }); - - this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - disable: function( index ) { - index = this._getIndex( index ); - var self = this, o = this.options; - // cannot disable already selected tab - if ( index != o.selected ) { - this.lis.eq( index ).addClass( "ui-state-disabled" ); - - o.disabled.push( index ); - o.disabled.sort(); - - this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - } - - return this; - }, - - select: function( index ) { - index = this._getIndex( index ); - if ( index == -1 ) { - if ( this.options.collapsible && this.options.selected != -1 ) { - index = this.options.selected; - } else { - return this; - } - } - this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); - return this; - }, - - load: function( index ) { - index = this._getIndex( index ); - var self = this, - o = this.options, - a = this.anchors.eq( index )[ 0 ], - url = $.data( a, "load.tabs" ); - - this.abort(); - - // not remote or from cache - if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { - this.element.dequeue( "tabs" ); - return; - } - - // load remote from here on - this.lis.eq( index ).addClass( "ui-state-processing" ); - - if ( o.spinner ) { - var span = $( "span", a ); - span.data( "label.tabs", span.html() ).html( o.spinner ); - } - - this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { - url: url, - success: function( r, s ) { - self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); - - // take care of tab labels - self._cleanup(); - - if ( o.cache ) { - $.data( a, "cache.tabs", true ); - } - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - o.ajaxOptions.success( r, s ); - } - catch ( e ) {} - }, - error: function( xhr, s, e ) { - // take care of tab labels - self._cleanup(); - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - // Passing index avoid a race condition when this method is - // called after the user has selected another tab. - // Pass the anchor that initiated this request allows - // loadError to manipulate the tab content panel via $(a.hash) - o.ajaxOptions.error( xhr, s, index, a ); - } - catch ( e ) {} - } - } ) ); - - // last, so that load event is fired before show... - self.element.dequeue( "tabs" ); - - return this; - }, - - abort: function() { - // stop possibly running animations - this.element.queue( [] ); - this.panels.stop( false, true ); - - // "tabs" queue must not contain more than two elements, - // which are the callbacks for the latest clicked tab... - this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); - - // terminate pending requests from other tabs - if ( this.xhr ) { - this.xhr.abort(); - delete this.xhr; - } - - // take care of tab labels - this._cleanup(); - return this; - }, - - url: function( index, url ) { - this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); - return this; - }, - - length: function() { - return this.anchors.length; - } -}); - -$.extend( $.ui.tabs, { - version: "1.8.12" -}); - -/* - * Tabs Extensions - */ - -/* - * Rotate - */ -$.extend( $.ui.tabs.prototype, { - rotation: null, - rotate: function( ms, continuing ) { - var self = this, - o = this.options; - - var rotate = self._rotate || ( self._rotate = function( e ) { - clearTimeout( self.rotation ); - self.rotation = setTimeout(function() { - var t = o.selected; - self.select( ++t < self.anchors.length ? t : 0 ); - }, ms ); - - if ( e ) { - e.stopPropagation(); - } - }); - - var stop = self._unrotate || ( self._unrotate = !continuing - ? function(e) { - if (e.clientX) { // in case of a true click - self.rotate(null); - } - } - : function( e ) { - t = o.selected; - rotate(); - }); - - // start rotation - if ( ms ) { - this.element.bind( "tabsshow", rotate ); - this.anchors.bind( o.event + ".tabs", stop ); - rotate(); - // stop rotation - } else { - clearTimeout( self.rotation ); - this.element.unbind( "tabsshow", rotate ); - this.anchors.unbind( o.event + ".tabs", stop ); - delete this._rotate; - delete this._unrotate; - } - - return this; - } -}); - -})( jQuery ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.widget.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.widget.js deleted file mode 100644 index 5dd5023ad7..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/jquery.ui.widget.js +++ /dev/null @@ -1,262 +0,0 @@ -/*! - * jQuery UI Widget 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ -(function( $, undefined ) { - -// jQuery 1.4+ -if ( $.cleanData ) { - var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - $( elem ).triggerHandler( "remove" ); - } - _cleanData( elems ); - }; -} else { - var _remove = $.fn.remove; - $.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - $( this ).triggerHandler( "remove" ); - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); - }; -} - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - // TODO: add this back in 1.9 and use $.error() (see #5972) -// if ( !instance ) { -// throw "cannot call methods on " + name + " prior to initialization; " + -// "attempted to call method '" + options + "'"; -// } -// if ( !$.isFunction( instance[options] ) ) { -// throw "no such method '" + options + "' for " + name + " widget instance"; -// } -// var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var callback = this.options[ type ]; - - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - data = data || {}; - - // copy original event properties over to the new event - // this would happen if we could call $.event.fix instead of $.Event - // but we don't have a way to force an event to be fixed multiple times - if ( event.originalEvent ) { - for ( var i = $.event.props.length, prop; i; ) { - prop = $.event.props[ --i ]; - event[ prop ] = event.originalEvent[ prop ]; - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.blind.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.blind.min.js deleted file mode 100644 index 870d328007..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.blind.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jQuery UI Effects Blind 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Blind - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a, -g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.bounce.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.bounce.min.js deleted file mode 100644 index 4b46ccd1b4..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.bounce.min.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * jQuery UI Effects Bounce 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Bounce - * - * Depends: - * jquery.effects.core.js - */ -(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/ -3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent", -border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); -return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); -else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), -b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, -a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, -a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== -e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fade.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fade.min.js deleted file mode 100644 index f07ba6111d..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fade.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * jQuery UI Effects Fade 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fold.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fold.min.js deleted file mode 100644 index fb5c9284f8..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.fold.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jQuery UI Effects Fold 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.highlight.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.highlight.min.js deleted file mode 100644 index c3e0c97197..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.highlight.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jQuery UI Effects Highlight 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.pulsate.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.pulsate.min.js deleted file mode 100644 index 3354426b5c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.effects.pulsate.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jQuery UI Effects Pulsate 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.accordion.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.accordion.min.js deleted file mode 100644 index b317d5df3f..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.accordion.min.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * jQuery UI Accordion 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); -a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); -if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", -function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a= -this.options;if(a.icons){c("").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"); -this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); -b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); -a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ -c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; -if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); -if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), -e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| -e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", -"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.12", -animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/); -f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide", -paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.autocomplete.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.autocomplete.min.js deleted file mode 100644 index 9d229b6380..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.autocomplete.min.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * jQuery UI Autocomplete 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g= -false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= -a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)}; -this.menu=d("
          ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& -a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); -d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& -b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= -this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length
        • ").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, -"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); -(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", --1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})}, -deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0); -e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e, -g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first")); -this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,f=d.primary&&d.secondary,e=[];if(d.primary||d.secondary){if(this.options.text)e.push("ui-button-text-icon"+(f?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("");d.secondary&&b.append("");if(!this.options.text){e.push(f?"ui-button-icons-only": -"ui-button-icon-only");this.hasTitle||b.attr("title",c)}}else e.push("ui-button-text-only");b.addClass(e.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()}, -destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.core.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.core.min.js deleted file mode 100644 index a8a883b3a0..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.core.min.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * jQuery UI 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.12",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, -NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, -"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); -if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, -"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h, -d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); -c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a')}function F(a,b){d.extend(a,b);for(var c in b)if(b[c]== -null||b[c]==A)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.12"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){F(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase(); -f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('
          ')}}, -_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&& -b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f== -""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a, -c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b), -true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}F(a.settings,e||{}); -b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass); -this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup", -this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs, -function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null: -f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target); -if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a); -d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");F(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-= -document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim"); -var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst= -b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover"); -this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+ -this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&& -a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth(): -0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a), -"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"? -"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a= -d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a= -d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c== -"M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth= -b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker(); -this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0); -a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c? -c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y", -RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= -a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), -b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= -this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+r+"":f?"":''+r+"";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
          '+(c?h:"")+(this._isInRange(a,r)?'":"")+(c?"":h)+"
          ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z= -this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",D=0;D1)switch(E){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]- -1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='
          '+(/all|left/.test(t)&&D==0?c?f:n:"")+(/all|right/.test(t)&&D==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,D>0||E>0,z,w)+'
          ';var B=j?'":"";for(t=0;t<7;t++){var q= -(t+h)%7;B+="=5?' class="ui-datepicker-week-end"':"")+'>'+s[q]+""}x+=B+"";B=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,B);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;B=l?6:Math.ceil((t+B)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O";var P=!j?"":'";for(t=0;t<7;t++){var G= -p?p.apply(a.input?a.input[0]:null,[q]):[true,""],C=q.getMonth()!=g,J=C&&!H||!G[0]||k&&qo;P+='";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+= -P+""}g++;if(g>11){g=0;m++}x+="
          '+this._get(a,"weekHeader")+"
          '+this._get(a,"calculateWeek")(q)+""+(C&&!v?" ":J?''+q.getDate()+"":''+q.getDate()+"")+"
          "+(l?""+(i[0]>0&&E==i[1]-1?'
          ':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
          ', -o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&& -l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";if(d.browser.mozilla)k+='";else{k+=a.yearshtml;a.yearshtml=null}}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
          ";return k},_adjustInstDate:function(a,b,c){var e= -a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a, -"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); -c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, -"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= -function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, -[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.12";window["DP_jQuery_"+y]=d})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.dialog.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.dialog.min.js deleted file mode 100644 index 4bddfed3f9..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.dialog.min.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * jQuery UI Dialog 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.button.js - * jquery.ui.draggable.js - * jquery.ui.mouse.js - * jquery.ui.position.js - * jquery.ui.resizable.js - */ -(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, -position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
          ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ -b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
          ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), -h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", -e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); -a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== -b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+= -1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== -f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
          ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
          ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, -function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", -handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, -originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", -f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): -[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); -if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): -e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= -this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- -b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.12",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), -create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), -height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); -b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return athis.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g= -this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])? -e:!(e-this.offset.click.left').css({width:this.offsetWidth+ -"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity", -a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= -i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate); -if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.position.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.position.min.js deleted file mode 100644 index 37e50e5d10..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.position.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * jQuery UI Position 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, -left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= -k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= -m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= -d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= -a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), -g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.progressbar.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.progressbar.min.js deleted file mode 100644 index 5af8ca4ea1..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.progressbar.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * jQuery UI Progressbar 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
          ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.12"})})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.resizable.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.resizable.min.js deleted file mode 100644 index c7972a8e84..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.resizable.min.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * jQuery UI Resizable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, -_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('
          ').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), -top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= -this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", -nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; -if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), -d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset= -this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: -this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", -b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height; -f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing"); -this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top= -null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidthb.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+ -this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b, -a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a, -c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize, -originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.12"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize= -b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width", -"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})}; -if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height- -g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width, -height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d= -e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options, -d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper? -d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height= -a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&& -/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable"); -b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/ -(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.selectable.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.selectable.min.js deleted file mode 100644 index d32e21221a..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.selectable.min.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * jQuery UI Selectable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), -selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
          ")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, -c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", -c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= -this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("
          ");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("").appendTo(this.element).addClass("ui-slider-handle"); -if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur(); -else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e= -false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h=== -b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); -this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b, -g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true}, -_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a; -if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value= -this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, -_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate); -if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, -1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.12"})})(jQuery); diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.sortable.min.js b/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.sortable.min.js deleted file mode 100644 index b825bbf346..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/minified/jquery.ui.sortable.min.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * jQuery UI Sortable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Sortables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); -this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]= -b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false; -d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left- -this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; -this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= -document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); -return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], -e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); -c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): -this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, -dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, -toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); -if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), -this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= -this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= -d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| -0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", -a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- -f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- -this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, -this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", -a,this._uiHash());for(e=0;e",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
        • #{label}
        • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& -e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= -d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| -(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); -this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= -this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); -if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); -this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ -g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", -function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; -this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= --1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; -d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= -d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, -e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); -j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); -if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, -this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, -load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, -"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, -url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.12"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k - - - - jQuery UI Example Page - - - - - - - -

          Welcome to jQuery UI!

          -

          This page demonstrates the widgets you downloaded using the theme you selected in the download builder. We've included and linked to minified versions of jQuery, your personalized copy of jQuery UI (js/jquery-ui-1.8.12.custom.min.js), and css/ui-lightness/jquery-ui-1.8.12.custom.css which imports the entire jQuery UI CSS Framework. You can choose to link a subset of the CSS Framework depending on your needs.

          -

          You've downloaded components and a theme that are compatible with jQuery 1.3+. Please make sure you are using jQuery 1.3+ in your production environment.

          - -

          YOUR COMPONENTS:

          - - -

          Accordion

          -
          -
          -

          First

          -
          Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
          -
          -
          -

          Second

          -
          Phasellus mattis tincidunt nibh.
          -
          -
          -

          Third

          -
          Nam dui erat, auctor a, dignissim quis.
          -
          -
          - - -

          Tabs

          -
          - -
          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
          -
          Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.
          -
          Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.
          -
          - - -

          Dialog

          -

          Open Dialog

          - - -

          Overlay and Shadow Classes (not currently used in UI widgets)

          -
          -

          Lorem ipsum dolor sit amet, Nulla nec tortor. Donec id elit quis purus consectetur consequat.

          Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci.

          Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat.

          Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam.

          Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante.

          Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi.

          - - -
          -
          -
          -

          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

          -
          -
          - -
          - - - -
          -

          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

          -
          - - - -

          Framework Icons (content color preview)

          -
            - -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • -
          • - -
          • -
          • -
          • -
          • -
          • -
          - - - -

          Slider

          -
          - - -

          Datepicker

          -
          - - -

          Progressbar

          -
          - - -

          Highlight / Error

          -
          -
          -

          - Hey! Sample ui-state-highlight style.

          -
          -
          -
          -
          -
          -

          - Alert: Sample ui-state-error style.

          -
          -
          - - - - - diff --git a/www/include/jslibs/jquery-ui-1.8.12/js/jquery-1.5.1.min.js b/www/include/jslibs/jquery-ui-1.8.12/js/jquery-1.5.1.min.js deleted file mode 100644 index 6437874c69..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/js/jquery-1.5.1.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.5.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Wed Feb 23 13:55:29 2011 -0500 - */ -(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="
          a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
          ",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
          t
          ";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

          ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="
          ";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/",""],legend:[1,"
          ","
          "],thead:[1,"","
          "],tr:[2,"","
          "],td:[3,"","
          "],col:[2,"","
          "],area:[1,"",""],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div
          ","
          "]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
          ").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
          ";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js b/www/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js deleted file mode 100644 index 1b1c88f30c..0000000000 --- a/www/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js +++ /dev/null @@ -1,783 +0,0 @@ -/*! - * jQuery UI 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.12",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, -NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, -"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); -if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, -"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h, -d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); -c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate); -if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); -;/* - * jQuery UI Position 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, -left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= -k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= -m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= -d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= -a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), -g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); -;/* - * jQuery UI Draggable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Draggables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== -"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= -this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- -this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); -d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis|| -this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&& -this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== -a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| -0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], -this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- -(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(), -height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"? -document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"), -10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"), -10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&& -d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], -this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.leftthis.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g= -this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])? -e:!(e-this.offset.click.left').css({width:this.offsetWidth+ -"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity", -a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= -i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), -top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= -this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", -nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; -if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), -d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset= -this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: -this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", -b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height; -f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing"); -this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top= -null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidthb.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+ -this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b, -a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a, -c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize, -originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.12"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize= -b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width", -"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})}; -if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height- -g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width, -height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d= -e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options, -d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper? -d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height= -a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&& -/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable"); -b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/ -(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery); -;/* - * jQuery UI Selectable 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), -selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
          ")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, -c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", -c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= -this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); -this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]= -b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false; -d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left- -this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; -this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= -document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); -return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], -e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); -c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): -this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, -dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, -toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); -if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), -this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= -this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= -d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| -0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", -a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- -f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- -this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, -this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", -a,this._uiHash());for(e=0;e li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); -a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); -if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", -function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a= -this.options;if(a.icons){c("").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"); -this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); -b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); -a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ -c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; -if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); -if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), -e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| -e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", -"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.12", -animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/); -f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide", -paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); -;/* - * jQuery UI Autocomplete 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g= -false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= -a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)}; -this.menu=d("
            ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& -a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); -d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& -b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= -this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, -"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); -(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", --1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})}, -deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0); -e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e, -g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first")); -this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,f=d.primary&&d.secondary,e=[];if(d.primary||d.secondary){if(this.options.text)e.push("ui-button-text-icon"+(f?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("");d.secondary&&b.append("");if(!this.options.text){e.push(f?"ui-button-icons-only": -"ui-button-icon-only");this.hasTitle||b.attr("title",c)}}else e.push("ui-button-text-only");b.addClass(e.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()}, -destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery); -;/* - * jQuery UI Dialog 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.button.js - * jquery.ui.draggable.js - * jquery.ui.mouse.js - * jquery.ui.position.js - * jquery.ui.resizable.js - */ -(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, -position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
            ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ -b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
            ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), -h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", -e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); -a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== -b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+= -1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== -f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
            ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
            ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, -function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", -handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, -originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", -f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): -[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); -if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): -e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= -this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- -b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.12",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), -create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), -height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); -b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("
            ");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("").appendTo(this.element).addClass("ui-slider-handle"); -if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur(); -else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e= -false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h=== -b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); -this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b, -g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true}, -_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a; -if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value= -this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, -_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate); -if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, -1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.12"})})(jQuery); -;/* - * jQuery UI Tabs 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
            ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
          • #{label}
          • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& -e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= -d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| -(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); -this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= -this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); -if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); -this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ -g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", -function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; -this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= --1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; -d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= -d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, -e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); -j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); -if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, -this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, -load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, -"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, -url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.12"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k')}function F(a,b){d.extend(a,b);for(var c in b)if(b[c]== -null||b[c]==A)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.12"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){F(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase(); -f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('
            ')}}, -_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&& -b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f== -""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a, -c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b), -true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}F(a.settings,e||{}); -b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass); -this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup", -this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs, -function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null: -f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target); -if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a); -d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");F(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-= -document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim"); -var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst= -b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover"); -this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+ -this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&& -a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth(): -0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a), -"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"? -"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a= -d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a= -d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c== -"M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth= -b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker(); -this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0); -a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c? -c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y", -RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= -a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), -b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= -this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+r+"":f?"":''+r+"";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
            '+(c?h:"")+(this._isInRange(a,r)?'":"")+(c?"":h)+"
            ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z= -this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",D=0;D1)switch(E){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]- -1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='
            '+(/all|left/.test(t)&&D==0?c?f:n:"")+(/all|right/.test(t)&&D==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,D>0||E>0,z,w)+'
            ';var B=j?'":"";for(t=0;t<7;t++){var q= -(t+h)%7;B+="=5?' class="ui-datepicker-week-end"':"")+'>'+s[q]+""}x+=B+"";B=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,B);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;B=l?6:Math.ceil((t+B)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O";var P=!j?"":'";for(t=0;t<7;t++){var G= -p?p.apply(a.input?a.input[0]:null,[q]):[true,""],C=q.getMonth()!=g,J=C&&!H||!G[0]||k&&qo;P+='";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+= -P+""}g++;if(g>11){g=0;m++}x+="
            '+this._get(a,"weekHeader")+"
            '+this._get(a,"calculateWeek")(q)+""+(C&&!v?" ":J?''+q.getDate()+"":''+q.getDate()+"")+"
            "+(l?""+(i[0]>0&&E==i[1]-1?'
            ':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
            ', -o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&& -l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";if(d.browser.mozilla)k+='";else{k+=a.yearshtml;a.yearshtml=null}}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
            ";return k},_adjustInstDate:function(a,b,c){var e= -a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a, -"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); -c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, -"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= -function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, -[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.12";window["DP_jQuery_"+y]=d})(jQuery); -;/* - * jQuery UI Progressbar 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
            ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.12"})})(jQuery); -;/* - * jQuery UI Effects 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0]; -h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c, -a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.12",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent", -border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); -return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); -else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), -b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, -a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, -a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== -e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); -;/* - * jQuery UI Effects Fade 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Fold 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); -;/* - * jQuery UI Effects Highlight 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Pulsate 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); -; \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png new file mode 100644 index 0000000000..142598c15c Binary files /dev/null and b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png differ diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_222222_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_222222_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_222222_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_222222_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_4b8e0b_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_4b8e0b_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_4b8e0b_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_4b8e0b_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_a83300_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_a83300_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_a83300_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_a83300_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_cccccc_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_cccccc_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_cccccc_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_cccccc_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_ffffff_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_ffffff_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_ffffff_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/images/ui-icons_ffffff_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/jquery-ui-1.8.12.custom.css b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/jquery-ui-1.8.17.custom.css similarity index 92% rename from www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/jquery-ui-1.8.12.custom.css rename to www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/jquery-ui-1.8.17.custom.css index 49afafa4b0..9df8c48c27 100644 --- a/www/include/jslibs/jquery-ui-1.8.12/css/dark-hive/jquery-ui-1.8.12.custom.css +++ b/www/include/jslibs/jquery-ui-1.8.17/css/dark-hive/jquery-ui-1.8.17.custom.css @@ -1,5 +1,5 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -13,12 +13,9 @@ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ +.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } +.ui-helper-clearfix:after { clear: both; } +.ui-helper-clearfix { zoom: 1; } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } @@ -42,7 +39,7 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -280,20 +277,15 @@ ----------------------------------*/ /* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } -.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-left-radius: 6px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; -khtml-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; -khtml-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; -khtml-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } /* Overlays */ .ui-widget-overlay { background: #5c5c5c url(images/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x; opacity: .80;filter:Alpha(Opacity=80); } -.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #cccccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* - * jQuery UI Resizable 1.8.12 +.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #cccccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -302,12 +294,7 @@ * http://docs.jquery.com/UI/Resizable#theming */ .ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; - /* http://bugs.jqueryui.com/ticket/7233 - - Resizable: resizable handles fail to work in IE if transparent and content overlaps - */ - background-image:url(data:); -} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } @@ -317,7 +304,7 @@ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.12 + * jQuery UI Selectable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -327,7 +314,7 @@ */ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } /* - * jQuery UI Accordion 1.8.12 + * jQuery UI Accordion 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -346,7 +333,7 @@ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } .ui-accordion .ui-accordion-content-active { display: block; } /* - * jQuery UI Autocomplete 1.8.12 + * jQuery UI Autocomplete 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -360,7 +347,7 @@ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ /* - * jQuery UI Menu 1.8.12 + * jQuery UI Menu 1.8.17 * * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -399,7 +386,7 @@ margin: -1px; } /* - * jQuery UI Button 1.8.12 + * jQuery UI Button 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -437,7 +424,7 @@ input.ui-button { padding: .4em 1em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ /* - * jQuery UI Dialog 1.8.12 + * jQuery UI Dialog 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -458,7 +445,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } /* - * jQuery UI Slider 1.8.12 + * jQuery UI Slider 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -481,7 +468,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.12 + * jQuery UI Tabs 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -499,7 +486,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tabs .ui-tabs-hide { display: none !important; } /* - * jQuery UI Datepicker 1.8.12 + * jQuery UI Datepicker 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -539,7 +526,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } @@ -566,7 +553,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad width: 200px; /*must have*/ height: 200px; /*must have*/ }/* - * jQuery UI Progressbar 1.8.12 + * jQuery UI Progressbar 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -574,5 +561,5 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad * * http://docs.jquery.com/UI/Progressbar#theming */ -.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar { height:2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_222222_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_222222_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_222222_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_222222_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_2e83ff_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_2e83ff_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_2e83ff_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_454545_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_454545_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_454545_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_454545_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_888888_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_888888_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_888888_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_888888_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/smoothness/images/ui-icons_cd0a0a_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/images/ui-icons_cd0a0a_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/themes/smoothness/jquery-ui-1.8.12.custom.css b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/jquery-ui-1.8.17.custom.css similarity index 92% rename from www/include/jslibs/jquery-ui-1.8.12/development-bundle/themes/smoothness/jquery-ui-1.8.12.custom.css rename to www/include/jslibs/jquery-ui-1.8.17/css/smoothness/jquery-ui-1.8.17.custom.css index c85aabaec0..3a4da3911c 100644 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/themes/smoothness/jquery-ui-1.8.12.custom.css +++ b/www/include/jslibs/jquery-ui-1.8.17/css/smoothness/jquery-ui-1.8.17.custom.css @@ -1,5 +1,5 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -13,12 +13,9 @@ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ +.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } +.ui-helper-clearfix:after { clear: both; } +.ui-helper-clearfix { zoom: 1; } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } @@ -42,7 +39,7 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -280,20 +277,15 @@ ----------------------------------*/ /* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } /* Overlays */ .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } -.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* - * jQuery UI Resizable 1.8.12 +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -302,12 +294,7 @@ * http://docs.jquery.com/UI/Resizable#theming */ .ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; - /* http://bugs.jqueryui.com/ticket/7233 - - Resizable: resizable handles fail to work in IE if transparent and content overlaps - */ - background-image:url(data:); -} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } @@ -317,7 +304,7 @@ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.12 + * jQuery UI Selectable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -327,7 +314,7 @@ */ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } /* - * jQuery UI Accordion 1.8.12 + * jQuery UI Accordion 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -346,7 +333,7 @@ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } .ui-accordion .ui-accordion-content-active { display: block; } /* - * jQuery UI Autocomplete 1.8.12 + * jQuery UI Autocomplete 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -360,7 +347,7 @@ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ /* - * jQuery UI Menu 1.8.12 + * jQuery UI Menu 1.8.17 * * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -399,7 +386,7 @@ margin: -1px; } /* - * jQuery UI Button 1.8.12 + * jQuery UI Button 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -437,7 +424,7 @@ input.ui-button { padding: .4em 1em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ /* - * jQuery UI Dialog 1.8.12 + * jQuery UI Dialog 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -458,7 +445,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } /* - * jQuery UI Slider 1.8.12 + * jQuery UI Slider 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -481,7 +468,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.12 + * jQuery UI Tabs 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -499,7 +486,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tabs .ui-tabs-hide { display: none !important; } /* - * jQuery UI Datepicker 1.8.12 + * jQuery UI Datepicker 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -539,7 +526,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } @@ -566,7 +553,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad width: 200px; /*must have*/ height: 200px; /*must have*/ }/* - * jQuery UI Progressbar 1.8.12 + * jQuery UI Progressbar 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -574,5 +561,5 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad * * http://docs.jquery.com/UI/Progressbar#theming */ -.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar { height:2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_222222_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_222222_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_222222_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_222222_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_228ef1_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_228ef1_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_228ef1_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_228ef1_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ef8c08_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ef8c08_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ef8c08_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ef8c08_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ffd27a_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ffd27a_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ffd27a_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ffd27a_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ffffff_256x240.png b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ffffff_256x240.png similarity index 100% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ffffff_256x240.png rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/images/ui-icons_ffffff_256x240.png diff --git a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/jquery-ui-1.8.12.custom.css b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css similarity index 89% rename from www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/jquery-ui-1.8.12.custom.css rename to www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css index 3f7bf90bb9..5ca17654e0 100644 --- a/www/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/jquery-ui-1.8.12.custom.css +++ b/www/include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css @@ -1,5 +1,5 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -13,12 +13,9 @@ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ +.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } +.ui-helper-clearfix:after { clear: both; } +.ui-helper-clearfix { zoom: 1; } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } @@ -42,7 +39,7 @@ /* - * jQuery UI CSS Framework 1.8.12 + * jQuery UI CSS Framework 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -280,20 +277,15 @@ ----------------------------------*/ /* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } /* Overlays */ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } -.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* - * jQuery UI Resizable 1.8.12 +.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* + * jQuery UI Resizable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -302,12 +294,7 @@ * http://docs.jquery.com/UI/Resizable#theming */ .ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; - /* http://bugs.jqueryui.com/ticket/7233 - - Resizable: resizable handles fail to work in IE if transparent and content overlaps - */ - background-image:url(data:); -} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } @@ -317,7 +304,7 @@ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.12 + * jQuery UI Selectable 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -327,7 +314,7 @@ */ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } /* - * jQuery UI Accordion 1.8.12 + * jQuery UI Accordion 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -346,60 +333,7 @@ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } .ui-accordion .ui-accordion-content-active { display: block; } /* - * jQuery UI Autocomplete 1.8.12 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.12 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.12 + * jQuery UI Button 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -437,7 +371,7 @@ input.ui-button { padding: .4em 1em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ /* - * jQuery UI Dialog 1.8.12 + * jQuery UI Dialog 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -458,7 +392,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } /* - * jQuery UI Slider 1.8.12 + * jQuery UI Slider 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -481,7 +415,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.12 + * jQuery UI Tabs 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -499,7 +433,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tabs .ui-tabs-hide { display: none !important; } /* - * jQuery UI Datepicker 1.8.12 + * jQuery UI Datepicker 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -539,7 +473,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } @@ -566,7 +500,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad width: 200px; /*must have*/ height: 200px; /*must have*/ }/* - * jQuery UI Progressbar 1.8.12 + * jQuery UI Progressbar 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -574,5 +508,5 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad * * http://docs.jquery.com/UI/Progressbar#theming */ -.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar { height:2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/i18n/jquery-ui-i18n.js b/www/include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js similarity index 90% rename from www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/i18n/jquery-ui-i18n.js rename to www/include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js index fbe58934b2..2380f2417f 100644 --- a/www/include/jslibs/jquery-ui-1.8.12/development-bundle/ui/i18n/jquery-ui-i18n.js +++ b/www/include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js @@ -1,4 +1,4 @@ -/* Afrikaans initialisation for the jQuery UI date picker plugin. */ +/* Afrikaans initialisation for the jQuery UI date picker plugin. */ /* Written by Renier Pretorius. */ jQuery(function($){ $.datepicker.regional['af'] = { @@ -44,7 +44,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ar-DZ']); }); -/* Arabic Translation for jQuery UI date picker plugin. */ +/* Arabic Translation for jQuery UI date picker plugin. */ /* Khaled Alhourani -- me@khaledalhourani.com */ /* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */ jQuery(function($){ @@ -66,7 +66,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ar']); -});/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */ +});/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* Written by Jamil Najafov (necefov33@gmail.com). */ jQuery(function($) { $.datepicker.regional['az'] = { @@ -88,7 +88,7 @@ jQuery(function($) { showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['az']); -});/* Bulgarian initialisation for the jQuery UI date picker plugin. */ +});/* Bulgarian initialisation for the jQuery UI date picker plugin. */ /* Written by Stoyan Kyosev (http://svest.org). */ jQuery(function($){ $.datepicker.regional['bg'] = { @@ -112,7 +112,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['bg']); }); -/* Bosnian i18n for the jQuery UI date picker plugin. */ +/* Bosnian i18n for the jQuery UI date picker plugin. */ /* Written by Kenan Konjo. */ jQuery(function($){ $.datepicker.regional['bs'] = { @@ -156,7 +156,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ca']); -});/* Czech initialisation for the jQuery UI date picker plugin. */ +});/* Czech initialisation for the jQuery UI date picker plugin. */ /* Written by Tomas Muller (tomas@tomas-muller.net). */ jQuery(function($){ $.datepicker.regional['cs'] = { @@ -179,7 +179,29 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['cs']); }); -/* Danish initialisation for the jQuery UI date picker plugin. */ +/* Welsh/UK initialisation for the jQuery UI date picker plugin. */ +/* Written by William Griffiths. */ +jQuery(function($){ + $.datepicker.regional['cy-GB'] = { + closeText: 'Done', + prevText: 'Prev', + nextText: 'Next', + currentText: 'Today', + monthNames: ['Ionawr','Chwefror','Mawrth','Ebrill','Mai','Mehefin', + 'Gorffennaf','Awst','Medi','Hydref','Tachwedd','Rhagfyr'], + monthNamesShort: ['Ion', 'Chw', 'Maw', 'Ebr', 'Mai', 'Meh', + 'Gor', 'Aws', 'Med', 'Hyd', 'Tac', 'Rha'], + dayNames: ['Dydd Sul', 'Dydd Llun', 'Dydd Mawrth', 'Dydd Mercher', 'Dydd Iau', 'Dydd Gwener', 'Dydd Sadwrn'], + dayNamesShort: ['Sul', 'Llu', 'Maw', 'Mer', 'Iau', 'Gwe', 'Sad'], + dayNamesMin: ['Su','Ll','Ma','Me','Ia','Gw','Sa'], + weekHeader: 'Wy', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['cy-GB']); +});/* Danish initialisation for the jQuery UI date picker plugin. */ /* Written by Jan Christensen ( deletestuff@gmail.com). */ jQuery(function($){ $.datepicker.regional['da'] = { @@ -202,7 +224,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['da']); }); -/* German initialisation for the jQuery UI date picker plugin. */ +/* German initialisation for the jQuery UI date picker plugin. */ /* Written by Milian Wolff (mail@milianw.de). */ jQuery(function($){ $.datepicker.regional['de'] = { @@ -225,7 +247,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['de']); }); -/* Greek (el) initialisation for the jQuery UI date picker plugin. */ +/* Greek (el) initialisation for the jQuery UI date picker plugin. */ /* Written by Alex Cicovic (http://www.alexcicovic.com) */ jQuery(function($){ $.datepicker.regional['el'] = { @@ -270,7 +292,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['en-AU']); }); -/* English/UK initialisation for the jQuery UI date picker plugin. */ +/* English/UK initialisation for the jQuery UI date picker plugin. */ /* Written by Stuart. */ jQuery(function($){ $.datepicker.regional['en-GB'] = { @@ -316,7 +338,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['en-NZ']); }); -/* Esperanto initialisation for the jQuery UI date picker plugin. */ +/* Esperanto initialisation for the jQuery UI date picker plugin. */ /* Written by Olivier M. (olivierweb@ifrance.com). */ jQuery(function($){ $.datepicker.regional['eo'] = { @@ -361,7 +383,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['es']); -});/* Estonian initialisation for the jQuery UI date picker plugin. */ +});/* Estonian initialisation for the jQuery UI date picker plugin. */ /* Written by Mart Sõmermaa (mrts.pydev at gmail com). */ jQuery(function($){ $.datepicker.regional['et'] = { @@ -383,7 +405,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['et']); -}); /* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */ +}); /* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */ /* Karrikas-ek itzulia (karrikas@karrikas.com) */ jQuery(function($){ $.datepicker.regional['eu'] = { @@ -405,7 +427,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['eu']); -});/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */ +});/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */ /* Javad Mowlanezhad -- jmowla@gmail.com */ /* Jalali calendar should supported soon! (Its implemented but I have to test it) */ jQuery(function($) { @@ -450,7 +472,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['fi']); }); -/* Faroese initialisation for the jQuery UI date picker plugin */ +/* Faroese initialisation for the jQuery UI date picker plugin */ /* Written by Sverri Mohr Olsen, sverrimo@gmail.com */ jQuery(function($){ $.datepicker.regional['fo'] = { @@ -473,7 +495,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['fo']); }); -/* Swiss-French initialisation for the jQuery UI date picker plugin. */ +/* Swiss-French initialisation for the jQuery UI date picker plugin. */ /* Written Martin Voelkle (martin.voelkle@e-tc.ch). */ jQuery(function($){ $.datepicker.regional['fr-CH'] = { @@ -495,7 +517,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['fr-CH']); -});/* French initialisation for the jQuery UI date picker plugin. */ +});/* French initialisation for the jQuery UI date picker plugin. */ /* Written by Keith Wood (kbwood{at}iinet.com.au), Stéphane Nahmani (sholby@sholby.net), Stéphane Raimbault */ @@ -542,7 +564,7 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['gl']); -});/* Hebrew initialisation for the UI Datepicker extension. */ +});/* Hebrew initialisation for the UI Datepicker extension. */ /* Written by Amir Hardon (ahardon at gmail dot com). */ jQuery(function($){ $.datepicker.regional['he'] = { @@ -565,7 +587,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['he']); }); -/* Croatian i18n for the jQuery UI date picker plugin. */ +/* Croatian i18n for the jQuery UI date picker plugin. */ /* Written by Vjekoslav Nesek. */ jQuery(function($){ $.datepicker.regional['hr'] = { @@ -591,19 +613,19 @@ jQuery(function($){ /* Written by Istvan Karaszi (jquery@spam.raszi.hu). */ jQuery(function($){ $.datepicker.regional['hu'] = { - closeText: 'bezárás', - prevText: '« vissza', - nextText: 'előre »', + closeText: 'bezár', + prevText: 'vissza', + nextText: 'előre', currentText: 'ma', monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'], monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún', 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'], - dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'], + dayNames: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'], dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'], dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'], - weekHeader: 'Hé', - dateFormat: 'yy-mm-dd', + weekHeader: 'Hét', + dateFormat: 'yy.mm.dd.', firstDay: 1, isRTL: false, showMonthAfterYear: true, @@ -699,7 +721,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['it']); }); -/* Japanese initialisation for the jQuery UI date picker plugin. */ +/* Japanese initialisation for the jQuery UI date picker plugin. */ /* Written by Kentaro SATO (kentaro@ranvis.com). */ jQuery(function($){ $.datepicker.regional['ja'] = { @@ -721,7 +743,30 @@ jQuery(function($){ showMonthAfterYear: true, yearSuffix: '年'}; $.datepicker.setDefaults($.datepicker.regional['ja']); -});/* Korean initialisation for the jQuery calendar extension. */ +});/* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['kk'] = { + closeText: 'Жабу', + prevText: '<Алдыңғы', + nextText: 'Келесі>', + currentText: 'Бүгін', + monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым', + 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'], + monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау', + 'Шіл','Там','Қыр','Қаз','Қар','Жел'], + dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'], + dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'], + dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'], + weekHeader: 'Не', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['kk']); +}); +/* Korean initialisation for the jQuery calendar extension. */ /* Written by DaeKwon Kang (ncrash.dk@gmail.com). */ jQuery(function($){ $.datepicker.regional['ko'] = { @@ -743,28 +788,28 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: '년'}; $.datepicker.setDefaults($.datepicker.regional['ko']); -});/* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */ -/* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */ +});/* Luxembourgish initialisation for the jQuery UI date picker plugin. */ +/* Written by Michel Weimerskirch */ jQuery(function($){ - $.datepicker.regional['kz'] = { - closeText: 'Жабу', - prevText: '<Алдыңғы', - nextText: 'Келесі>', - currentText: 'Бүгін', - monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым', - 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'], - monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау', - 'Шіл','Там','Қыр','Қаз','Қар','Жел'], - dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'], - dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'], - dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'], - weekHeader: 'Не', + $.datepicker.regional['lb'] = { + closeText: 'Fäerdeg', + prevText: 'Zréck', + nextText: 'Weider', + currentText: 'Haut', + monthNames: ['Januar','Februar','Mäerz','Abrëll','Mee','Juni', + 'Juli','August','September','Oktober','November','Dezember'], + monthNamesShort: ['Jan', 'Feb', 'Mäe', 'Abr', 'Mee', 'Jun', + 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + dayNames: ['Sonndeg', 'Méindeg', 'Dënschdeg', 'Mëttwoch', 'Donneschdeg', 'Freideg', 'Samschdeg'], + dayNamesShort: ['Son', 'Méi', 'Dën', 'Mët', 'Don', 'Fre', 'Sam'], + dayNamesMin: ['So','Mé','Dë','Më','Do','Fr','Sa'], + weekHeader: 'W', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['kz']); + $.datepicker.setDefaults($.datepicker.regional['lb']); }); /* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* @author Arturas Paleicikas */ @@ -810,7 +855,30 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['lv']); -});/* Malayalam (UTF-8) initialisation for the jQuery UI date picker plugin. */ +});/* Macedonian i18n for the jQuery UI date picker plugin. */ +/* Written by Stojce Slavkovski. */ +jQuery(function($){ + $.datepicker.regional['mk'] = { + closeText: 'Затвори', + prevText: '<', + nextText: '>', + currentText: 'Денес', + monthNames: ['Јануари','Фебруари','Март','Април','Мај','Јуни', + 'Јули','Август','Септември','Октомври','Ноември','Декември'], + monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун', + 'Јул','Авг','Сеп','Окт','Ное','Дек'], + dayNames: ['Недела','Понеделник','Вторник','Среда','Четврток','Петок','Сабота'], + dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'], + dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Са'], + weekHeader: 'Сед', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['mk']); +}); +/* Malayalam (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* Written by Saji Nediyanchath (saji89@gmail.com). */ jQuery(function($){ $.datepicker.regional['ml'] = { @@ -855,7 +923,29 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ms']); -});/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */ +});/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */ +/* David De Sloovere @DavidDeSloovere */ +jQuery(function($){ + $.datepicker.regional['nl-BE'] = { + closeText: 'Sluiten', + prevText: '←', + nextText: '→', + currentText: 'Vandaag', + monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', + 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + monthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', + 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'], + dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['nl-BE']); +});/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* Written by Mathias Bynens */ jQuery(function($){ $.datepicker.regional.nl = { @@ -865,13 +955,13 @@ jQuery(function($){ currentText: 'Vandaag', monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], - monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', + monthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'], dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], weekHeader: 'Wk', - dateFormat: 'dd/mm/yy', + dateFormat: 'dd-mm-yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, @@ -987,7 +1077,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['rm']); }); -/* Romanian initialisation for the jQuery UI date picker plugin. +/* Romanian initialisation for the jQuery UI date picker plugin. * * Written by Edmond L. (ll_edmond@walla.com) * and Ionut G. Stan (ionut.g.stan@gmail.com) @@ -1047,7 +1137,7 @@ jQuery(function($){ 'Júl','August','September','Október','November','December'], monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún', 'Júl','Aug','Sep','Okt','Nov','Dec'], - dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'], + dayNames: ['Nedeľa','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'], dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'], dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'], weekHeader: 'Ty', @@ -1082,7 +1172,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['sl']); }); -/* Albanian initialisation for the jQuery UI date picker plugin. */ +/* Albanian initialisation for the jQuery UI date picker plugin. */ /* Written by Flakron Bytyqi (flakron@gmail.com). */ jQuery(function($){ $.datepicker.regional['sq'] = { @@ -1105,7 +1195,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['sq']); }); -/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Serbian i18n for the jQuery UI date picker plugin. */ /* Written by Dejan Dimić. */ jQuery(function($){ $.datepicker.regional['sr-SR'] = { @@ -1128,7 +1218,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['sr-SR']); }); -/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Serbian i18n for the jQuery UI date picker plugin. */ /* Written by Dejan Dimić. */ jQuery(function($){ $.datepicker.regional['sr'] = { @@ -1151,7 +1241,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['sr']); }); -/* Swedish initialisation for the jQuery UI date picker plugin. */ +/* Swedish initialisation for the jQuery UI date picker plugin. */ /* Written by Anders Ekdahl ( anders@nomadiz.se). */ jQuery(function($){ $.datepicker.regional['sv'] = { @@ -1174,7 +1264,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['sv']); }); -/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* Written by S A Sureshkumar (saskumar@live.com). */ jQuery(function($){ $.datepicker.regional['ta'] = { @@ -1197,7 +1287,7 @@ jQuery(function($){ yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ta']); }); -/* Thai initialisation for the jQuery UI date picker plugin. */ +/* Thai initialisation for the jQuery UI date picker plugin. */ /* Written by pipo (pipo@sixhead.com). */ jQuery(function($){ $.datepicker.regional['th'] = { @@ -1265,6 +1355,7 @@ jQuery(function($){ $.datepicker.setDefaults($.datepicker.regional['tr']); });/* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */ /* Written by Maxim Drogobitskiy (maxdao@gmail.com). */ +/* Corrected by Igor Milla (igor.fsp.milla@gmail.com). */ jQuery(function($){ $.datepicker.regional['uk'] = { closeText: 'Закрити', @@ -1278,14 +1369,14 @@ jQuery(function($){ dayNames: ['неділя','понеділок','вівторок','середа','четвер','п’ятниця','субота'], dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'], dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'], - weekHeader: 'Не', + weekHeader: 'Тиж', dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['uk']); -});/* Vietnamese initialisation for the jQuery UI date picker plugin. */ +});/* Vietnamese initialisation for the jQuery UI date picker plugin. */ /* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */ jQuery(function($){ $.datepicker.regional['vi'] = { @@ -1354,7 +1445,7 @@ jQuery(function($){ yearSuffix: '年'}; $.datepicker.setDefaults($.datepicker.regional['zh-HK']); }); -/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Chinese initialisation for the jQuery UI date picker plugin. */ /* Written by Ressol (ressol@gmail.com). */ jQuery(function($){ $.datepicker.regional['zh-TW'] = { diff --git a/www/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js b/www/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js new file mode 100644 index 0000000000..991cb8d0a6 --- /dev/null +++ b/www/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js @@ -0,0 +1,356 @@ +/*! + * jQuery UI 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);/* + * jQuery UI Position 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b)});return h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&jQuery.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);/* + * jQuery UI Draggable 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!!this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy();return this}},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle"))return!1;this.handle=this._getHandle(b);if(!this.handle)return!1;c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
            ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")});return!0},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment();if(this._trigger("start",b)===!1){this._clear();return!1}this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.helper.addClass("ui-draggable-dragging"),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b);return!0},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1){this._mouseUp({});return!1}this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);return!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var d=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){d._trigger("stop",b)!==!1&&d._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b);return a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)});return c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute");return d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f=k&&g<=l||h>=k&&h<=l||gl)&&(e>=i&&e<=j||f>=i&&f<=j||ej);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();droppablesLoop:for(var g=0;g').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e');/sw|se|ne|nw/.test(f)&&h.css({zIndex:++c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){c.disabled||(a(this).removeClass("ui-resizable-autohide"),b._handles.show())},function(){c.disabled||b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement);return this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),a.browser.opera&&/relative/.test(f.css("position"))&&f.css({position:"relative",top:"auto",left:"auto"}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b);return!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui());return!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove();return!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),ea.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null);return a},_proportionallyResize:function(){var b=this.options;if(!!this._proportionallyResizeElements.length){var c=this.helper||this.element;for(var d=0;d');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.17"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10),position:b.css("position")})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,e){a(b).each(function(){var b=a(this),f=a(this).data("resizable-alsoresize"),g={},i=e&&e.length?e:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(i,function(a,b){var c=(f[b]||0)+(h[b]||0);c&&c>=0&&(g[b]=c||null)}),a.browser.opera&&/relative/.test(b.css("position"))&&(d._revertToRelativePosition=!0,b.css({position:"absolute",top:"auto",left:"auto"})),b.css(g)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.css({position:b.data("resizable-alsoresize").position})})};d._revertToRelativePosition&&(d._revertToRelativePosition=!1,typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)),a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!!i){e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/e.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*e.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);/* + * jQuery UI Selectable 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */(function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("
            ")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy();return this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(!this.options.disabled){var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element});return!1}})}},_mouseDrag:function(b){var c=this;this.dragged=!0;if(!this.options.disabled){var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!!i&&i.element!=c.element[0]){var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.righth||i.bottome&&i.rightf&&i.bottom *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f){e=a(this);return!1}});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}this.currentItem=e,this._removeCurrentsFromItems();return!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b);return!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(b,c){if(!!b){a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"=");return d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")});return d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a),this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];e||(b.style.visibility="hidden");return b},update:function(a,b){if(!e||!!d.forcePlaceholderSize)b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!!c)if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.items[i][this.containers[d].floating?"left":"top"];Math.abs(j-h)this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}if(f){a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus();return!1}return!0}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!!g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data))}}),a.extend(a.ui.accordion,{version:"1.8.17",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);else{if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})}},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);/* + * jQuery UI Autocomplete 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + */(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!b.options.disabled&&!b.element.propAttr("readOnly")){d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._move("previous",c),c.preventDefault();break;case e.DOWN:b._move("next",c),c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){b.options.disabled||(b.selectedItem=null,b.previous=b.element.val())}).bind("blur.autocomplete",function(a){b.options.disabled||(clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150))}),this._initSource(),this.response=function(){return b._response.apply(b,arguments)},this.menu=a("
              ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term))}):typeof this.options.source=="string"?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:"json",autocompleteRequest:++c,success:function(a,b){this.autocompleteRequest===c&&f(a)},error:function(){this.autocompleteRequest===c&&f([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible"))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)}},widget:function(){return this.menu.element}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){!a(c.target).closest(".ui-menu-item a").length||(c.preventDefault(),b.select(c))}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){!this.active||(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null)},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10}),result.length||(result=this.element.children(".ui-menu-item:first")),this.activate(b,result)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);/* + * jQuery UI Dialog 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.button.js + * jquery.ui.draggable.js + * jquery.ui.mouse.js + * jquery.ui.position.js + * jquery.ui.resizable.js + */(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
              ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
              ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){b.close(a);return!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1!==c._trigger("beforeClose",b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d);return c}},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger("focus",c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c);return d},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1}}}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open");return b}},_createButtons:function(b){var c=this,d=!1,e=a("
              ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
              ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){a!=="click"&&(a in f?e[a](b):e.attr(a,b))}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.17",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");b||(this.uuid+=1,b=this.uuid);return"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);/* + * jQuery UI Tabs 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */(function(a,b){function f(){return++d}function e(){return++c}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
              ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
            • #{label}
            • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1}}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1){this.blur();return!1}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected")){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur();return!1}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur();return!1}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a},destroy:function(){var b=this.options;this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie);return this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]));return this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0]));return this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.17"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a'))}$.extend($.ui,{datepicker:{version:"1.8.17"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
              ')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"))},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(a){$.datepicker.log(a)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!!$.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e))},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'",x=d?'
              '+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
              ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
              '+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
              '+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
              '+this._get(a,"weekHeader")+"
              '+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?" ":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
              "+(j?""+(g[0]>0&&N==g[1]-1?'
              ':""):""),M+=Q}K+=M}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1;return K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this +._get(a,"showMonthAfterYear"),l='
              ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
              ";return l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e;return e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)})},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.17",window["DP_jQuery_"+dpuuid]=$})(jQuery);/* + * jQuery UI Progressbar 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
              ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===b)return this._value();this._setOption("value",a);return this},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;typeof a!="number"&&(a=0);return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.17"})})(jQuery);/* + * jQuery UI Effects 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */jQuery.effects||function(a,b){function l(b){if(!b||typeof b=="number"||a.fx.speeds[b])return!0;if(typeof b=="string"&&!a.effects[b])return!0;return!1}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete;return[b,c,d,e]}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function c(b){var c;if(b&&b.constructor==Array&&b.length==3)return b;if(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];if(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))return[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55];if(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];if(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];if(c=/rgba\(0, 0, 0, 0\)/.exec(b))return e.transparent;return e[a.trim(b).toLowerCase()]}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){a.isFunction(d)&&(e=d,d=null);return this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class");a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.17",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is(".ui-effects-wrapper")){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c}return b},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1])});return e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)});return i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="hide";return this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])});return d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);/* + * jQuery UI Effects Fade 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Fold 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);/* + * jQuery UI Effects Highlight 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Pulsate 1.8.17 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show");times=(b.options.times||5)*2-1,duration=b.duration?b.duration/2:a.fx.speeds._default/2,isVisible=c.is(":visible"),animateTo=0,isVisible||(c.css("opacity",0).show(),animateTo=1),(d=="hide"&&isVisible||d=="show"&&!isVisible)&×--;for(var e=0;e').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery); \ No newline at end of file diff --git a/www/include/jslibs/jquery.mousewheel.js b/www/include/jslibs/jquery.mousewheel.js old mode 100755 new mode 100644 index 7004bf6160..38b60951b2 --- a/www/include/jslibs/jquery.mousewheel.js +++ b/www/include/jslibs/jquery.mousewheel.js @@ -1,10 +1,11 @@ -/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. +/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * Thanks to: Seamus Leahy for adding deltaX and deltaY * - * Version: 3.0.2 + * Version: 3.0.6 * * Requires: 1.2.2+ */ @@ -13,56 +14,71 @@ var types = ['DOMMouseScroll', 'mousewheel']; +if ($.event.fixHooks) { + for ( var i=types.length; i; ) { + $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; + } +} + $.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) - { - for ( var i=types.length; i; ) - this.addEventListener( types[--i], handler, false ); - } - else - { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) - { - for ( var i=types.length; i; ) - this.removeEventListener( types[--i], handler, false ); - } - else - { - this.onmousewheel = null; - } - } + setup: function() { + if ( this.addEventListener ) { + for ( var i=types.length; i; ) { + this.addEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = handler; + } + }, + + teardown: function() { + if ( this.removeEventListener ) { + for ( var i=types.length; i; ) { + this.removeEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = null; + } + } }; $.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } }); function handler(event) { - var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true; - - event = $.event.fix(event || window.event); - event.type = "mousewheel"; - - if ( event.wheelDelta ) delta = event.wheelDelta/120; - if ( event.detail ) delta = -event.detail/3; - - // Add events and delta to the front of the arguments - args.unshift(event, delta); - - return $.event.handle.apply(this, args); + var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; + event = $.event.fix(orgEvent); + event.type = "mousewheel"; + + // Old school scrollwheel delta + if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } + if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } + + // New school multidimensional scroll (touchpads) deltas + deltaY = delta; + + // Gecko + if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { + deltaY = 0; + deltaX = -1*delta; + } + + // Webkit + if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } + if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } + + // Add event and delta to the front of the arguments + args.unshift(event, delta, deltaX, deltaY); + + return ($.event.dispatch || $.event.handle).apply(this, args); } -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/www/include/jslibs/jquery.vertical.buttonset.html b/www/include/jslibs/jquery.vertical.buttonset.html index 91f19202ac..faed901789 100644 --- a/www/include/jslibs/jquery.vertical.buttonset.html +++ b/www/include/jslibs/jquery.vertical.buttonset.html @@ -1,9 +1,9 @@ - - + + - + - - - - - - - - - - -
              -
              -
                -
              • Push
              • - 0) - { - ?> -
              • - -
              -
              -
              -
              -
              - - - - - - - - - - - - - - -
              - - - - -
              -
              -
              - - - - -
              -
              - -
              -
              -
              -
              - - - - - - - ACL()->get_granted_base(array('canpush'))); - $rs = get_distinct_activite($baslist); - $htmlacti = ''; - foreach ($rs as $row) - { - if(trim($row['activite']) === '') - continue; - $htmlacti .= ''; - } - - $rs = get_distinct_fonction($baslist); - $htmlfonction = ''; - foreach ($rs as $row) - { - if(trim($row['fonction']) === '') - continue; - $htmlfonction .= ''; - } - - $rs = get_distinct_pays($baslist); - $disCoun = array(); - $ctry = getCountries($lng); - foreach ($rs as $row) - { - if (isset($ctry[$row['pays']])) - $disCoun[$row['pays']] = $ctry[$row['pays']]; - } - - $rs = get_distinct_societe($baslist); - $htmlsocie = ''; - foreach ($rs as $row) - { - if(trim($row['societe']) === '') - continue; - $htmlsocie .= ''; - } - - $rs = get_distinct_model($baslist); - $htmltemplate = ''; - foreach ($rs as $row) - { - if(trim($row['lastModel']) === '') - continue; - $htmltemplate .= ''; - } - ?> - - - -
              - - - - - - - - - -
              - - - - - - -   - - - - - + -
              -
              - - -
              - - - - - - - -
              -
              - - - - - - - -
              -
              -
              - - - -
              -
              -
              -
              -
              -
              - - -
              -
              -
              - - - - - - -
              -
              -
              - - - - - - - - - - - - - - - - - - - - - -
              -
              -
              - - - - -
              -
              - - - -
              - -
              -
              - 0) - { - ?> -
              - -
              - : - - - - - - -
              - -
              - - - -
              -
              - -
              - - - storage()->get('push', array()); - if (!isset($push_datas[$parm['token']])) - exit(); - ?> - - - - - - - - $right) - { - $users[$usr] = array('canHD' => (in_array($right['HD'], array('0', '1')) ? $right['HD'] : 0)); - } - - - $push = pushIt($usr_id, $parm['nameBask'], $parmLST, $users, $parm["textmail"], $lng, $parm['accuse']); - $nbchu = $push['nbchu']; - $my_link = $push['mylink']; - $Endusers = $push['users']; - - $lstbyBase = array(); - foreach ($parmLST as $br) - { - $br = explode('_', $br); - $lstbyBase[$br[0]][] = $br[1]; - } - - foreach ($lstbyBase as $sbas_id => $lst) - { - foreach ($lst as $record_id) - { - foreach ($Endusers as $u) - { - $record = new record_adapter($sbas_id, $record_id); - $session->get_logger($record->get_databox()) - ->log($record, Session_Logger::EVENT_PUSH, $u, ''); - } - } - } - - echo "
              " . sprintf(_('Push:: %d paniers envoyes avec success'), $nbchu) . "
              " . '
              '; - $prov = $registry->get('GV_ServerName'); - - if (isset($my_link) && strlen($my_link) > 4) - { - echo ""; - } - ?> -
              - storage()->get('push', array()); - $ssel_id = $push_datas[$parm['token']]['ssel_id']; - - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - if (!$ssel_id || trim($ssel_id) == '') - { - $lst = array_reverse($push_datas[$parm['token']]['lst']); - - $basket = basket_adapter::create($appbox, $parm["nameBask"], $user); - $basket->set_unread(); - $basket->push_list($lst, false); - $basket->flatten(); - $ssel_id = $basket->get_ssel_id(); - - $outinfos = _('prod::push: votre nouveau panier a ete cree avec succes ; il contient vos documents de validation'); - } - else - { - $basket = basket_adapter::getInstance($appbox, $ssel_id, $usr_id); - - if ($basket->is_grouping()) - { - $elements = $basket->get_elements(); - $basket = basket_adapter::create($appbox, $basket->get_name(), $user); - - foreach ($elements as $record) - { - $basket->push_element($record, false, false); - } - - unset($elements); - - $ssel_id = $basket->get_ssel_id(); - } - - $basket->flatten(); - } - - - $my_link = ''; - if ($ssel_id && is_numeric($ssel_id)) - { - $lstUsrs = $push_datas[$parm['token']]['usrs']; - $users = array(); - foreach ($lstUsrs as $usr => $right) - { - $users[$usr] = array('canHD' => (in_array($right['HD'], array('0', '1')) ? $right['HD'] : '0'), 'canRate' => '0', 'canAgree' => '1', 'canSeeOther' => ($parm['view_all'] == '1' ? '1' : '0'), 'canZone' => '0'); - } - - if (!array_key_exists($session->get_usr_id(), $lstUsrs)) - $users[$session->get_usr_id()] = array('canHD' => '0', 'canRate' => '0', 'canAgree' => '1', 'canSeeOther' => '1', 'canZone' => '0'); - - $push = pushValidation($usr_id, $ssel_id, $users, $parm['timValS'], $parm["textmail"], $parm['accuse']); - $my_link = $push['mylink']; - - - $Endusers = $push['users']; - - $lstbyBase = array(); - - $basket = basket_adapter::getInstance($appbox, $ssel_id, $usr_id); - foreach ($basket as $basket_element) - { - $record = $basket_element->get_record(); - $lstbyBase[$record->get_sbas_id()][] = $record->get_record_id(); - } - - foreach ($lstbyBase as $sbas_id => $lst) - { - foreach ($lst as $record_id) - { - foreach ($Endusers as $u) - { - $record = new record_adapter($sbas_id, $record_id); - $session->get_logger($record->get_databox()) - ->log($record, Session_Logger::EVENT_VALIDATE, $u, ''); - unset($record); - } - } - } - } - - if (isset($outinfos)) - echo "
              " . $outinfos . "
              "; - echo "
              "; - if (isset($my_link) && strlen($my_link) > 4) - echo ""; - - echo ""; - } - ?> - - - diff --git a/www/prod/rotate.php b/www/prod/rotate.php index 4e67a9c3d3..d4ec8c2c82 100644 --- a/www/prod/rotate.php +++ b/www/prod/rotate.php @@ -14,8 +14,10 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); + +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +$appbox = appbox::get_instance($Core); $session = $appbox->get_session(); phrasea::headers(); @@ -28,9 +30,9 @@ $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); ?> - - - + + + diff --git a/www/prod/router.php b/www/prod/router.php index df692e4cd9..5f087a2044 100644 --- a/www/prod/router.php +++ b/www/prod/router.php @@ -16,9 +16,8 @@ * @link www.phraseanet.com */ require_once __DIR__ . "/../../lib/bootstrap.php"; -bootstrap::register_autoloads(); -$app = require __DIR__ . "/../../lib/classes/module/Prod.php"; +$app = require __DIR__ . "/../../lib/Alchemy/Phrasea/Application/Prod.php"; $app->run(); diff --git a/www/prod/share.php b/www/prod/share.php index da0ac5b38f..27e3ca28a3 100644 --- a/www/prod/share.php +++ b/www/prod/share.php @@ -14,9 +14,11 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; + +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(); -$appbox = appbox::get_instance(); +$appbox = appbox::get_instance($Core); $registry = $appbox->get_registry(); require($registry->get('GV_RootPath') . "lib/vendor/PHPShortener/phpshortener.class.php"); $session = Session_Handler::getInstance($appbox); @@ -24,17 +26,16 @@ $session = Session_Handler::getInstance($appbox); $request = http_request::getInstance(); $parm = $request->get_parms("bas", "rec"); -$usr_id = $session->get_usr_id(); -$user = User_Adapter::getInstance($usr_id, $appbox); +$user = $Core->getAuthenticatedUser(); $right = false; ?> - - - + + + - + - - + + - + + - display('common/menubar.twig', array('module' => 'upload')); - ?> + getTwig(); + echo $twig->render('common/menubar.twig', array('module' => 'upload')); + ?> -
              - -
              - - +
              + +
              + + -get_databoxes() as $databox) +{ + $groupopen = false; + $sbas_id = $databox->get_sbas_id(); + + foreach ($databox->get_collections() as $collection) + { + if (in_array($collection->get_base_id(), $avBases)) + { + if (!$groupopen) + { + $colls .= ''; + $groupopen = true; + } + $colls .= ''; } - $colls = ''; - $datasSB = array(); - $dstatus = databox_status::getDisplayStatus(); - - foreach ($appbox->get_databoxes() as $databox) + if (in_array($collection->get_base_id(), $avStatus)) { - $groupopen = false; - $sbas_id = $databox->get_sbas_id(); - - foreach ($databox->get_collections() as $collection) + $status = '0000000000000000000000000000000000000000000000000000000000000000'; + if ($sxe = simplexml_load_string($collection->get_prefs())) { - if (in_array($collection->get_base_id(), $avBases)) + if ($sxe->status) { - if (!$groupopen) - { - $colls .= ''; - $groupopen = true; - } - $colls .= ''; - } + $status = databox_status::hex2bin((string) ($sxe->status)); - if (in_array($collection->get_base_id(), $avStatus)) - { - $status = '0000000000000000000000000000000000000000000000000000000000000000'; - if ($sxe = simplexml_load_string($collection->get_prefs())) - { - if ($sxe->status) - { - $status = databox_status::hex2bin((string) ($sxe->status)); - - while (strlen($status) < 64) - $status = '0' . $status; - } - } - - $datasSB[$collection->get_base_id()] = ''; + while (strlen($status) < 64) + $status = '0' . $status; } } - if ($groupopen) - $colls .= ''; + + $datasSB[$collection->get_base_id()] = ''; + } + } + if ($groupopen) + $colls .= ''; +} + + +$maxVolume = min((int) get_cfg_var('upload_max_filesize'), (int) get_cfg_var('post_max_size')); + + +header("Content-Type: text/html; charset=UTF-8"); +?> + + + + <?php echo $registry->get('GV_homeTitle'), ' ', _('admin::monitor: module upload'); ?> + + + + + + + + + + - - - - - + + + display('common/menubar.twig', array('module' => 'upload')); + $twig = $Core->getTwig(); + echo $twig->render('common/menubar.twig' + , array( + 'module' => 'upload' + , 'events' => eventsmanager_broker::getInstance($appbox, $Core) + )); ?>
              @@ -388,7 +391,7 @@ if (count($avBases) == 0)
              -
              +
              $dat) { @@ -429,25 +432,25 @@ if (count($avBases) == 0) -
              -
              - -
              +
              + +
              -
              +
              diff --git a/www/upload/lazaret_image.php b/www/upload/lazaret_image.php index 8df9c736f1..7325858a02 100644 --- a/www/upload/lazaret_image.php +++ b/www/upload/lazaret_image.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms('id'); diff --git a/www/upload/upload.php b/www/upload/upload.php index 627de1f1db..220f4065eb 100644 --- a/www/upload/upload.php +++ b/www/upload/upload.php @@ -15,7 +15,8 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . '/../../lib/classes/http/request.class.php'; + +require_once __DIR__ . '/../../lib/classes/http/request.class.php'; $request = http_request::getInstance(); $parm = $request->get_parms('session', 'coll', 'status'); @@ -24,10 +25,10 @@ if ($parm["session"]) { session_id($parm["session"]); } +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; - -$appbox = appbox::get_instance(); +$appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); define("DEFAULT_MIMETYPE", "application/octet-stream"); @@ -36,8 +37,6 @@ if ($request->comes_from_flash()) else define("UPLOADER", "HTML"); -$registry = $appbox->get_registry(); - if (!isset($_FILES['Filedata'])) { if (UPLOADER == 'FLASH') @@ -57,7 +56,7 @@ if ($_FILES['Filedata']['error'] > 0) } $sbas_id = false; -$usr_id = $session->get_usr_id(); +$usr_id = $Core->getAuthenticatedUser()->get_id(); $sbas_id = phrasea::sbasFromBas($parm['coll']); diff --git a/www/upload/uploadFeedback.php b/www/upload/uploadFeedback.php index 734b64ad8b..6f4b89b733 100644 --- a/www/upload/uploadFeedback.php +++ b/www/upload/uploadFeedback.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms('action', 'from_id', 'to_id', 'actions', 'id'); @@ -128,14 +128,11 @@ switch ($action) { $lazaret = new lazaret(); - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - $twig->addFilter(array('phraseadate' => 'phraseadate::getPrettyString')); - $twig->addFilter(array('basnames' => 'phrasea::bas_names')); + $core = \bootstrap::getCore(); + $twig = $core->getTwig(); $output = $twig->render( - 'upload/lazaret.twig', - array('lazaret' => $lazaret) + 'upload/lazaret.twig', array('lazaret' => $lazaret) ); } catch (Exception $e) diff --git a/www/xmlhttp/acceptcandidates.j.php b/www/xmlhttp/acceptcandidates.j.php index 6353c71a27..5ddb543fd4 100644 --- a/www/xmlhttp/acceptcandidates.j.php +++ b/www/xmlhttp/acceptcandidates.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/checkcandidatetarget.j.php b/www/xmlhttp/checkcandidatetarget.j.php index 7b2406792c..8bb9d1c9c3 100644 --- a/www/xmlhttp/checkcandidatetarget.j.php +++ b/www/xmlhttp/checkcandidatetarget.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/deletecandidates.j.php b/www/xmlhttp/deletecandidates.j.php index aec0cd1a3b..42065c4e4e 100644 --- a/www/xmlhttp/deletecandidates.j.php +++ b/www/xmlhttp/deletecandidates.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/editing_presets.j.php b/www/xmlhttp/editing_presets.j.php index d8be3d741c..236a87fd5a 100644 --- a/www/xmlhttp/editing_presets.j.php +++ b/www/xmlhttp/editing_presets.j.php @@ -14,10 +14,12 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); -$session = $appbox->get_session(); +$usr_id = $Core->getAuthenticatedUser()->get_id(); + +$appbox = appbox::get_instance($Core); $request = http_request::getInstance(); $parm = $request->get_parms( @@ -39,14 +41,14 @@ switch ($parm['act']) $params = array( ':editpresetid' => $parm['presetid'], - ':usr_id' => $session->get_usr_id() + ':usr_id' => $usr_id ); $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); - $ret['html'] = xlist($parm['sbas'], $session->get_usr_id()); + $ret['html'] = xlist($parm['sbas'], $usr_id); break; case 'SAVE': $dom = new DOMDocument('1.0', 'UTF-8'); @@ -62,7 +64,7 @@ switch ($parm['act']) $params = array( ':sbas_id' => $parm['sbas'] - , ':usr_id' => $session->get_usr_id() + , ':usr_id' => $usr_id , ':title' => $parm['title'] , ':presets' => $dom->saveXML() ); @@ -70,10 +72,10 @@ switch ($parm['act']) $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute($params); - $ret['html'] = xlist($parm['sbas'], $session->get_usr_id()); + $ret['html'] = xlist($parm['sbas'], $usr_id); break; case 'LIST': - $ret['html'] = xlist($parm['sbas'], $session->get_usr_id()); + $ret['html'] = xlist($parm['sbas'], $usr_id); break; case "LOAD": $sql = 'SELECT edit_preset_id, creation_date, title, xml diff --git a/www/xmlhttp/getsy_prod.x.php b/www/xmlhttp/getsy_prod.x.php index a7f9418435..a5150ceab6 100644 --- a/www/xmlhttp/getsy_prod.x.php +++ b/www/xmlhttp/getsy_prod.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/getterm_prod.h.php b/www/xmlhttp/getterm_prod.h.php index 8ed668a4c7..3de36ff492 100644 --- a/www/xmlhttp/getterm_prod.h.php +++ b/www/xmlhttp/getterm_prod.h.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/getterm_prod.x.php b/www/xmlhttp/getterm_prod.x.php index 77ce661f71..e7c49af10d 100644 --- a/www/xmlhttp/getterm_prod.x.php +++ b/www/xmlhttp/getterm_prod.x.php @@ -15,7 +15,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; + $request = http_request::getInstance(); $parm = $request->get_parms( "bid" @@ -24,10 +26,7 @@ $parm = $request->get_parms( , "debug" ); -$appbox = appbox::get_instance(); -$session = $appbox->get_session(); -$registry = $appbox->get_registry(); -$parm['lng'] = $session->get_I18n(); +$parm['lng'] = $Core->getLocale(); if ($parm["debug"]) { diff --git a/www/xmlhttp/openbranch_prod.j.php b/www/xmlhttp/openbranch_prod.j.php index a7ccf7c12e..16850f8758 100644 --- a/www/xmlhttp/openbranch_prod.j.php +++ b/www/xmlhttp/openbranch_prod.j.php @@ -15,12 +15,8 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; - -$appbox = appbox::get_instance(); -$session = $appbox->get_session(); -$registry = $appbox->get_registry(); - +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms( diff --git a/www/xmlhttp/openbranches_prod.h.php b/www/xmlhttp/openbranches_prod.h.php index 5c91109a18..642224d104 100644 --- a/www/xmlhttp/openbranches_prod.h.php +++ b/www/xmlhttp/openbranches_prod.h.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/openbranches_prod.x.php b/www/xmlhttp/openbranches_prod.x.php index ee6130178f..9664ddb6fe 100644 --- a/www/xmlhttp/openbranches_prod.x.php +++ b/www/xmlhttp/openbranches_prod.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/replacecandidate.j.php b/www/xmlhttp/replacecandidate.j.php index 95bd8fdb68..75be66a718 100644 --- a/www/xmlhttp/replacecandidate.j.php +++ b/www/xmlhttp/replacecandidate.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); @@ -242,10 +242,7 @@ function simplified($t) return(array('a' => $sa, 'u' => $su)); } -if ($parm['debug']) - var_dump($result); -else - print(p4string::jsonencode(array('parm' => $parm, 'result' => $result))); +print(p4string::jsonencode(array('parm' => $parm, 'result' => $result))); if ($parm['debug']) print(""); diff --git a/www/xmlhttp/search_th_term_prod.j.php b/www/xmlhttp/search_th_term_prod.j.php index 4524ef9aea..15cf266577 100644 --- a/www/xmlhttp/search_th_term_prod.j.php +++ b/www/xmlhttp/search_th_term_prod.j.php @@ -15,11 +15,8 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; -$appbox = appbox::get_instance(); -$session = $appbox->get_session(); -$registry = $appbox->get_registry(); - +/* @var $Core \Alchemy\Phrasea\Core */ +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms(