new xCAT web client
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3634 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
34
xCAT-UI/change.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// Modify the shadow copy of the table on the svr.
|
||||
require_once "lib/functions.php";
|
||||
/* $Id */
|
||||
$tab = $_GET['tab'];
|
||||
|
||||
// Delete a row
|
||||
if (isset($_GET['delrow'])) {
|
||||
$row = $_GET['delrow'];
|
||||
$editable = & $_SESSION["editable-$tab"]; # Get an easier alias for the table array
|
||||
unset($editable[$row]);
|
||||
}
|
||||
|
||||
// Change a value in a cell
|
||||
else {
|
||||
$id = $_POST['id'];
|
||||
$value = $_POST['value'];
|
||||
|
||||
$coord = array();
|
||||
$coord = explode('-', $id);
|
||||
$theLine = $coord[0];
|
||||
$theField = $coord[1];
|
||||
#echo "line: $theLine field: $theField<br>";
|
||||
|
||||
# Get an easier alias for the table array
|
||||
$editable = & $_SESSION["editable-$tab"];
|
||||
|
||||
# Modify the array with the new value from the editable widget
|
||||
$editable[$theLine][$theField] = $value;
|
||||
|
||||
// This value goes back to the javascript editable object in the browser
|
||||
echo "$value";
|
||||
}
|
||||
?>
|
19
xCAT-UI/command.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require_once "lib/security.php";
|
||||
require_once "lib/functions.php";
|
||||
require_once "lib/display.php";
|
||||
if(isset($_REQUEST['cmd'])){
|
||||
$cmd = $_REQUEST['cmd'];
|
||||
}
|
||||
if(isset($_REQUEST['nr'])){
|
||||
$nr = $_REQUEST['nr'];
|
||||
}
|
||||
if(isset($_REQUEST['args'])){
|
||||
$args = $_REQUEST['args'];
|
||||
}
|
||||
#echo "args: $args<br>";
|
||||
$newargs = array();
|
||||
$newargs = explode(" ",$args);
|
||||
$out = docmd($cmd,$nr,$newargs);
|
||||
echo $out;
|
||||
?>
|
27
xCAT-UI/config.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require_once "lib/security.php";
|
||||
require_once "lib/functions.php";
|
||||
require_once "lib/display.php";
|
||||
if(isset($_REQUEST['t'])){
|
||||
$tab = $_REQUEST['t'];
|
||||
if(isset($_REQUEST['save'])){
|
||||
$rsp = doTabRestore($tab,$_SESSION["editable-$tab"]);
|
||||
$errors = array();
|
||||
if(getXmlErrors($rsp,$errors)){
|
||||
displayErrors($errors);
|
||||
dumpGlobals();
|
||||
exit();
|
||||
}else{
|
||||
displaySuccess($tab);
|
||||
}
|
||||
}
|
||||
elseif(isset($_REQUEST['kill'])){
|
||||
unset($_SESSION["edittable-$tab"]);
|
||||
}
|
||||
displayTab($tab);
|
||||
|
||||
}else{
|
||||
displayTabMain();
|
||||
}
|
||||
|
||||
?>
|
11
xCAT-UI/control.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
require_once "lib/security.php";
|
||||
require_once "lib/functions.php";
|
||||
require_once "lib/display.php";
|
||||
if(isset($_REQUEST['cmd'])){
|
||||
$cmd = $_REQUEST['cmd'];
|
||||
}
|
||||
displayCtrlPage($cmd);
|
||||
displayNrTree();
|
||||
|
||||
?>
|
BIN
xCAT-UI/css/.superfish-navbar.css.swp
Normal file
101
xCAT-UI/css/config.css
Normal file
@ -0,0 +1,101 @@
|
||||
|
||||
/* Styles specific to the db.php page */
|
||||
|
||||
#tableNames {
|
||||
position: relative; /* so the h3 inside can be absolute to this div */
|
||||
border: 1px solid black;
|
||||
text-align: left;
|
||||
padding: 12px 5px 10px 5px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#tableNames H3 {
|
||||
position: absolute;
|
||||
top: -25px;
|
||||
left: 15px;
|
||||
background-color: white;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
#tableNames A {
|
||||
font-size: 9pt;
|
||||
margin-left: 0.6em;
|
||||
margin-right: 0.6em;
|
||||
}
|
||||
|
||||
#tableHeading { margin-top: 0px; margin-bottom: 0px; }
|
||||
|
||||
#helpLinks { margin-top: 0px; }
|
||||
|
||||
#helpLinks A {
|
||||
margin-left: 2em;
|
||||
margin-right: 2em;
|
||||
}
|
||||
|
||||
.middlepane {
|
||||
/* float: left; */
|
||||
padding: 5px;
|
||||
margin: 10px;
|
||||
min-width: 600px;
|
||||
}
|
||||
table.tabTable {
|
||||
background-color: #CDCDCD;
|
||||
margin:10px 0pt 15px;
|
||||
font-size: 8pt;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
table.tabTable thead tr th, table.tabTable tfoot tr th {
|
||||
background-color: #e6EEEE;
|
||||
border: 1px solid #FFF;
|
||||
font-size: 8pt;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
table.tabTable tbody td {
|
||||
color: #3D3D3D;
|
||||
padding: 4px;
|
||||
vertical-align: center;
|
||||
|
||||
}
|
||||
|
||||
table.tabTable thead tr {
|
||||
background-color: #8dbdd8;
|
||||
}
|
||||
|
||||
|
||||
/*.colHeaders {
|
||||
font-size: 8pt;
|
||||
padding: 4px;
|
||||
background-color: #e6EEEE;
|
||||
border: 1px solid #FFF;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/* the alternating rows of the table */
|
||||
.ListLine0 { background: #EFF6FF; /*#e0f8f8;*/ }
|
||||
.ListLine1 { background: #D8E8FF; /*#b0f8f8;*/ }
|
||||
|
||||
.Xcell { /* the table cell that contains the red x */
|
||||
background-color: white;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.Ximg { padding-right: 15px; }
|
||||
.Ximg2 { padding-right: 15px; }
|
||||
|
||||
.edit {
|
||||
background: #8f8f0b;
|
||||
font-size: 8pt;
|
||||
}
|
||||
/*
|
||||
#tabTable {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}*/
|
320
xCAT-UI/css/main.css
Normal file
@ -0,0 +1,320 @@
|
||||
body {
|
||||
margin: 0px auto;
|
||||
text-align: center;
|
||||
width: 971px;
|
||||
font: .8em Verdana, Arial, Sans-Serif;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
|
||||
background: #2e2e2e;
|
||||
}
|
||||
|
||||
#header{
|
||||
background: #2e2e2e url('../img/header5.jpg') no-repeat;
|
||||
color: #c0c0c0;
|
||||
width: 960px;
|
||||
margin: 0px auto;
|
||||
height: 40px;
|
||||
/* padding-left: 100px; */
|
||||
}
|
||||
|
||||
#topper {
|
||||
background: #2e2e2e url('../img/topper.jpg') no-repeat;
|
||||
width: 960px;
|
||||
height: 11px;
|
||||
margin: 0px auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#bopper {
|
||||
background: #2e2e2e url('../img/bopper.jpg') no-repeat;
|
||||
width: 960px;
|
||||
height: 11px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#footer {
|
||||
font: 8px Verdana, Arial, Sans-Serif;
|
||||
margin-top: 10px;
|
||||
color: #ddd;
|
||||
|
||||
}
|
||||
|
||||
#main {
|
||||
/* padding: 5px; */
|
||||
margin: 0px auto;
|
||||
width: 960px;
|
||||
background-color: #fff;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#load {
|
||||
display: none;
|
||||
/* position: absolute; */
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
background: url(../img/ajax-loader.gif);
|
||||
width: 43px;
|
||||
height: 11px;
|
||||
text-indent: -9999em;
|
||||
}
|
||||
|
||||
#cmdForm {
|
||||
margin-left: 240px;
|
||||
background: url(../img/cmd.png) no-repeat;
|
||||
width: 132px;
|
||||
width: 159px;
|
||||
height: 40px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#cmdForm #cmd {
|
||||
border: 0;
|
||||
background: none;
|
||||
/* color: #d1d7F8; */
|
||||
color: #555;
|
||||
font-size: 12px;
|
||||
font-family: serif;
|
||||
padding-top: 10px;
|
||||
padding-left: 4px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#cmdForm #go {
|
||||
float: right;
|
||||
padding-top: 8px;
|
||||
|
||||
}
|
||||
|
||||
a.button {
|
||||
background: transparent url('../img/bg_button_a.gif') no-repeat scroll top right;
|
||||
color: #444;
|
||||
display: inline-block; /*block;*/
|
||||
/* float: left; */
|
||||
font: normal 12px arial, sans-serif;
|
||||
height: 24px;
|
||||
margin-right: 6px;
|
||||
padding-right: 18px; /* sliding doors padding */
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a.button span {
|
||||
background: transparent url('../img/bg_button_span.gif') no-repeat;
|
||||
display: inline-block; /*block;*/
|
||||
line-height: 14px;
|
||||
padding: 5px 0 5px 18px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
a.button:active {
|
||||
background-position: bottom right;
|
||||
color: #000;
|
||||
outline: none; /* hide dotted outline in Firefox */
|
||||
}
|
||||
|
||||
a.button:active span {
|
||||
background-position: bottom left;
|
||||
padding: 6px 0 4px 18px; /* push text down 1px */
|
||||
}
|
||||
|
||||
#rangedisplay {
|
||||
float: left;
|
||||
text-align: left;
|
||||
width: 700px;
|
||||
}
|
||||
#nrtree {
|
||||
float: left;
|
||||
width: 150px;
|
||||
border-right: 1px dotted #555;
|
||||
}
|
||||
|
||||
/* tables */
|
||||
table.tablesorter {
|
||||
font-family:arial;
|
||||
background-color: #CDCDCD;
|
||||
margin:10px 0pt 15px;
|
||||
font-size: 8pt;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
|
||||
background-color: #e6EEEE;
|
||||
border: 1px solid #FFF;
|
||||
font-size: 8pt;
|
||||
padding: 4px;
|
||||
}
|
||||
table.tablesorter thead tr .header {
|
||||
background-image: url('../img/bg.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.tablesorter tbody td {
|
||||
color: #3D3D3D;
|
||||
padding: 4px;
|
||||
background-color: #FFF;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.tablesorter tbody tr.odd td {
|
||||
background-color:#F0F0F6;
|
||||
}
|
||||
table.tablesorter thead tr .headerSortUp {
|
||||
background-image: url('../img/asc.gif');
|
||||
}
|
||||
table.tablesorter thead tr .headerSortDown {
|
||||
background-image: url('../img/desc.gif');
|
||||
}
|
||||
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
|
||||
background-color: #8dbdd8;
|
||||
}
|
||||
|
||||
|
||||
.controlHeaders {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #e6EEEE url(foo.jpg) 0 0 repeat-x;
|
||||
float: left;
|
||||
width: 100%;
|
||||
border: 1px solid #2e2e2e;
|
||||
border-width: 1px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.controlHeaders li {
|
||||
display: inline;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.controlHeaders a:link,
|
||||
.controlHeaders a:visited {
|
||||
color: #000;
|
||||
background: #8dbdd8;
|
||||
padding: 10px 40px 4px 10px;
|
||||
float: left;
|
||||
width: auto;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.controlHeaders a:hover {
|
||||
color: #fff;
|
||||
background: #2e2e2e;
|
||||
}
|
||||
|
||||
.controlHeaders li:first-child a {
|
||||
border-left: 1px solid #2d2d2d;
|
||||
}
|
||||
|
||||
.mapper {
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
float: left;
|
||||
width: 916px;
|
||||
border-bottom: 1px dotted #555;
|
||||
}
|
||||
|
||||
/* loading bar */
|
||||
#wrapper { display: none; }
|
||||
|
||||
#loadingZone {
|
||||
margin: 0 auto;
|
||||
width: 410px;
|
||||
text-align: center;
|
||||
color:#6ea1fa;
|
||||
}
|
||||
|
||||
#loadingBar {
|
||||
border:1px solid #c2c2c2;
|
||||
height:2px;
|
||||
text-align:left;
|
||||
line-height:0;
|
||||
margin:0;
|
||||
color:#6ea1fa;
|
||||
padding:0;
|
||||
overflow:hidden; /*fix for IE 6*/
|
||||
}
|
||||
#progressBar{
|
||||
height:2px;
|
||||
line-height:0;
|
||||
margin:0;
|
||||
padding:0;
|
||||
background:#b3f83d;
|
||||
width:0%;
|
||||
}
|
||||
#loadingSms{
|
||||
color:#6ea1fa;
|
||||
float:left;
|
||||
padding:10px 2px;
|
||||
}
|
||||
#infoProgress{
|
||||
color:#6ea1fa;
|
||||
float:right;
|
||||
padding:10px 2px;
|
||||
}
|
||||
#infoLoading{
|
||||
padding:10px;
|
||||
color:#b9b9b9;
|
||||
font-size:10px;
|
||||
}
|
||||
|
||||
/* for display tables */
|
||||
.tabMenu {
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* for usernamed login */
|
||||
#musername {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
padding-right: 5px;
|
||||
text-align: right;
|
||||
font-size: .8em;
|
||||
}
|
||||
#musername span {
|
||||
color: yellow;
|
||||
}
|
||||
#musername a {
|
||||
color: #ddd;
|
||||
}
|
||||
.mContent {
|
||||
padding: 10px;
|
||||
padding-top: 0px;
|
||||
margin: 10px;
|
||||
margin-top: 0px;
|
||||
text-align: left;
|
||||
color: #555;
|
||||
}
|
||||
.mContent h1 {
|
||||
font-size: 1.2em;
|
||||
color: #555;
|
||||
}
|
||||
.mContent h1 i {
|
||||
color: #5d90e9;
|
||||
}
|
||||
|
||||
.mContent h2 {
|
||||
font-size: 1.1em;
|
||||
color: #555;
|
||||
}
|
||||
.mContent a, .mapper a {
|
||||
color:#6ea1fa;
|
||||
}
|
||||
.nrcmd {
|
||||
float: right;
|
||||
text-align: left;
|
||||
}
|
||||
.mapper span {
|
||||
float: left;
|
||||
}
|
||||
/* this is for the table editing in config */
|
||||
.editme input {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
|
||||
background: #FAF8CC;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 8pt;
|
||||
paddint-right: 0;
|
||||
|
||||
}
|
15
xCAT-UI/css/security.css
Normal file
@ -0,0 +1,15 @@
|
||||
#logdialog { /* the div inside the dialog */
|
||||
margin: 0px 10px 20px 10px; /* for some reason the containing dialog cuts off the right 30px */
|
||||
padding: 0px;
|
||||
font-family: Sans-Serif;
|
||||
/*font-size: 7pt; */
|
||||
}
|
||||
|
||||
.LogDialog {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#logdialogNote {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
93
xCAT-UI/css/superfish-navbar.css
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
/*** adding the class sf-navbar in addition to sf-menu creates an all-horizontal nav-bar menu ***/
|
||||
.sf-navbar {
|
||||
background: #BDD2FF;
|
||||
height: 2.5em;
|
||||
padding-bottom: 2.5em;
|
||||
position: relative;
|
||||
}
|
||||
.sf-navbar li {
|
||||
background: #AABDE6;
|
||||
position: static;
|
||||
}
|
||||
.sf-navbar a {
|
||||
border-top: none;
|
||||
}
|
||||
.sf-navbar li ul {
|
||||
width: 44em; /*IE6 soils itself without this*/
|
||||
}
|
||||
.sf-navbar li li {
|
||||
background: #BDD2FF;
|
||||
position: relative;
|
||||
}
|
||||
.sf-navbar li li ul {
|
||||
width: 13em;
|
||||
}
|
||||
.sf-navbar li li li {
|
||||
width: 100%;
|
||||
}
|
||||
.sf-navbar ul li {
|
||||
width: auto;
|
||||
float: left;
|
||||
}
|
||||
.sf-navbar a, .sf-navbar a:visited {
|
||||
border: none;
|
||||
}
|
||||
.sf-navbar li.current {
|
||||
background: #BDD2FF;
|
||||
}
|
||||
.sf-navbar li:hover,
|
||||
.sf-navbar li.sfHover,
|
||||
.sf-navbar li li.current,
|
||||
.sf-navbar a:focus, .sf-navbar a:hover, .sf-navbar a:active {
|
||||
background: #CEE3FF;
|
||||
}
|
||||
.sf-navbar ul li:hover,
|
||||
.sf-navbar ul li.sfHover,
|
||||
ul.sf-navbar ul li:hover li,
|
||||
ul.sf-navbar ul li.sfHover li,
|
||||
.sf-navbar ul a:focus, .sf-navbar ul a:hover, .sf-navbar ul a:active {
|
||||
background: #D1DFFF;
|
||||
}
|
||||
ul.sf-navbar li li li:hover,
|
||||
ul.sf-navbar li li li.sfHover,
|
||||
.sf-navbar li li.current li.current,
|
||||
.sf-navbar ul li li a:focus, .sf-navbar ul li li a:hover, .sf-navbar ul li li a:active {
|
||||
background: #E6EEFF;
|
||||
}
|
||||
ul.sf-navbar .current ul,
|
||||
ul.sf-navbar ul li:hover ul,
|
||||
ul.sf-navbar ul li.sfHover ul {
|
||||
left: 0;
|
||||
top: 2.5em; /* match top ul list item height */
|
||||
}
|
||||
ul.sf-navbar .current ul ul {
|
||||
top: -999em;
|
||||
}
|
||||
|
||||
.sf-navbar li li.current > a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*** point all arrows down ***/
|
||||
/* point right for anchors in subs */
|
||||
.sf-navbar ul .sf-sub-indicator { background-position: -10px -100px; }
|
||||
.sf-navbar ul a > .sf-sub-indicator { background-position: 0 -100px; }
|
||||
/* apply hovers to modern browsers */
|
||||
.sf-navbar ul a:focus > .sf-sub-indicator,
|
||||
.sf-navbar ul a:hover > .sf-sub-indicator,
|
||||
.sf-navbar ul a:active > .sf-sub-indicator,
|
||||
.sf-navbar ul li:hover > a > .sf-sub-indicator,
|
||||
.sf-navbar ul li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px -100px; /* arrow hovers for modern browsers*/
|
||||
}
|
||||
|
||||
/*** remove shadow on first submenu ***/
|
||||
.sf-navbar > li > ul {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
-moz-border-radius-bottomleft: 0;
|
||||
-moz-border-radius-topright: 0;
|
||||
-webkit-border-top-right-radius: 0;
|
||||
-webkit-border-bottom-left-radius: 0;
|
||||
}
|
23
xCAT-UI/css/superfish-vertical.css
Normal file
@ -0,0 +1,23 @@
|
||||
/*** adding sf-vertical in addition to sf-menu creates a vertical menu ***/
|
||||
.sf-vertical, .sf-vertical li {
|
||||
width: 10em;
|
||||
}
|
||||
/* this lacks ul at the start of the selector, so the styles from the main CSS file override it where needed */
|
||||
.sf-vertical li:hover ul,
|
||||
.sf-vertical li.sfHover ul {
|
||||
left: 10em; /* match ul width */
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/*** alter arrow directions ***/
|
||||
.sf-vertical .sf-sub-indicator { background-position: -10px 0; } /* IE6 gets solid image only */
|
||||
.sf-vertical a > .sf-sub-indicator { background-position: 0 0; } /* use translucent arrow for modern browsers*/
|
||||
|
||||
/* hover arrow direction for modern browsers*/
|
||||
.sf-vertical a:focus > .sf-sub-indicator,
|
||||
.sf-vertical a:hover > .sf-sub-indicator,
|
||||
.sf-vertical a:active > .sf-sub-indicator,
|
||||
.sf-vertical li:hover > a > .sf-sub-indicator,
|
||||
.sf-vertical li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px 0; /* arrow hovers for modern browsers*/
|
||||
}
|
161
xCAT-UI/css/superfish.css
Normal file
@ -0,0 +1,161 @@
|
||||
|
||||
/*** ESSENTIAL STYLES ***/
|
||||
.sf-menu, .sf-menu * {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.sf-menu {
|
||||
line-height: 1.5;
|
||||
}
|
||||
.sf-menu ul {
|
||||
position: absolute;
|
||||
top: -999em;
|
||||
width: 10em; /* left offset of submenus need to match (see below) */
|
||||
}
|
||||
.sf-menu ul li {
|
||||
width: 100%;
|
||||
}
|
||||
.sf-menu li:hover {
|
||||
visibility: inherit; /* fixes IE7 'sticky bug' */
|
||||
}
|
||||
.sf-menu li {
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu a {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu li:hover ul,
|
||||
.sf-menu li.sfHover ul {
|
||||
left: 0;
|
||||
top: 2.5em; /* match top ul list item height */
|
||||
/* this changes the top location of the first sub-menu */
|
||||
top: 3em; /* match top ul list item height */
|
||||
z-index: 99;
|
||||
}
|
||||
ul.sf-menu li:hover li ul,
|
||||
ul.sf-menu li.sfHover li ul {
|
||||
top: -999em;
|
||||
}
|
||||
ul.sf-menu li li:hover ul,
|
||||
ul.sf-menu li li.sfHover ul {
|
||||
left: 10em; /* match ul width */
|
||||
top: 0;
|
||||
}
|
||||
ul.sf-menu li li:hover li ul,
|
||||
ul.sf-menu li li.sfHover li ul {
|
||||
top: -999em;
|
||||
}
|
||||
ul.sf-menu li li li:hover ul,
|
||||
ul.sf-menu li li li.sfHover ul {
|
||||
left: 10em; /* match ul width */
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/*** DEMO SKIN ***/
|
||||
.sf-menu {
|
||||
float: left;
|
||||
margin-bottom: 1em;
|
||||
/* the below positions the buttons left relative to the xCAT icon */
|
||||
margin-left: 100px;
|
||||
}
|
||||
.sf-menu a {
|
||||
/*border-left: 1px solid #fff; */
|
||||
border-left: 1px solid #2e2e2e;
|
||||
border-top: 1px solid #CFDEFF;
|
||||
border-top: 1px solid #9da5d4;
|
||||
/* this controls how big the boxes are for the menus */
|
||||
padding: .78em 2em;
|
||||
text-decoration:none;
|
||||
}
|
||||
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
|
||||
color: #13a;
|
||||
color: #ddd;
|
||||
}
|
||||
.sf-menu li {
|
||||
background: #BDD2FF;
|
||||
background: #646987;
|
||||
}
|
||||
.sf-menu li li {
|
||||
background: #AABDE6;
|
||||
background: #686d8a;
|
||||
}
|
||||
|
||||
.level2 {
|
||||
margin-left: 128px;
|
||||
top: -482px;
|
||||
|
||||
}
|
||||
.level3 {
|
||||
margin-left: 256px;
|
||||
top: -964px;
|
||||
background: red;
|
||||
|
||||
}
|
||||
.sf-menu li li li {
|
||||
background: #9AAEDB;
|
||||
}
|
||||
.sf-menu li:hover, .sf-menu li.sfHover,
|
||||
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
|
||||
background: #CFDEFF;
|
||||
background: #9Da5d4;
|
||||
color: #646987;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/*** arrows **/
|
||||
.sf-menu a.sf-with-ul {
|
||||
padding-right: 2.25em;
|
||||
padding-right: 2.5em;
|
||||
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
|
||||
}
|
||||
.sf-sub-indicator {
|
||||
position: absolute;
|
||||
display: block;
|
||||
right: .75em;
|
||||
top: 1.05em; /* IE6 only */
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
text-indent: -999em;
|
||||
overflow: hidden;
|
||||
background: url('../img/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
|
||||
}
|
||||
a > .sf-sub-indicator { /* give all except IE6 the correct values */
|
||||
top: .8em;
|
||||
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
|
||||
}
|
||||
/* apply hovers to modern browsers */
|
||||
a:focus > .sf-sub-indicator,
|
||||
a:hover > .sf-sub-indicator,
|
||||
a:active > .sf-sub-indicator,
|
||||
li:hover > a > .sf-sub-indicator,
|
||||
li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px -100px; /* arrow hovers for modern browsers*/
|
||||
}
|
||||
/* point right for anchors in subs */
|
||||
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
|
||||
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
|
||||
/* apply hovers to modern browsers */
|
||||
.sf-menu ul a:focus > .sf-sub-indicator,
|
||||
.sf-menu ul a:hover > .sf-sub-indicator,
|
||||
.sf-menu ul a:active > .sf-sub-indicator,
|
||||
.sf-menu ul li:hover > a > .sf-sub-indicator,
|
||||
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px 0; /* arrow hovers for modern browsers*/
|
||||
background: red;
|
||||
}
|
||||
|
||||
/*** shadows for all but IE6 **/
|
||||
.sf-shadow ul {
|
||||
background: url('../img/shadow.png') no-repeat bottom right;
|
||||
padding: 0 8px 9px 0;
|
||||
-moz-border-radius-bottomleft: 17px;
|
||||
-moz-border-radius-topright: 17px;
|
||||
-webkit-border-top-right-radius: 17px;
|
||||
-webkit-border-bottom-left-radius: 17px;
|
||||
}
|
||||
.sf-shadow ul.sf-shadow-off {
|
||||
background: transparent;
|
||||
}
|
167
xCAT-UI/css/theme/demo.html
Normal file
@ -0,0 +1,167 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Themeroller Demo</title>
|
||||
|
||||
<script src="http://ui.jquery.com/js/jquery.js"></script>
|
||||
<script src="http://ui.jquery.com/js/ui.js"></script>
|
||||
<link rel="stylesheet" href="http://ui.jquery.com/applications/themeroller/css/app_screen.css" type="text/css" media="screen">
|
||||
<link rel="stylesheet" href="jquery-ui-themeroller.css" type="text/css" media="screen">
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
//accordion
|
||||
$('#accordion').accordion({
|
||||
header: ".ui-accordion-header",
|
||||
clearStyle: true
|
||||
});
|
||||
|
||||
//tabs
|
||||
$('#tabs ul').tabs();
|
||||
|
||||
//datepicker
|
||||
$('#ui-datepicker').datepicker({
|
||||
changeFirstDay: false
|
||||
});
|
||||
|
||||
//slider
|
||||
$('#slider').slider({range: true});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//dialog (currently not js-driven in themeroller)
|
||||
/*
|
||||
var dOffset = $('#dialogContent').offset();
|
||||
$('#dialogContent').dialog({
|
||||
buttons: {
|
||||
'Okay': function() { },
|
||||
'Cancel': function() { }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
window.scrollTo(0,0);
|
||||
|
||||
*/
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="compGroupA" class="clearfix">
|
||||
|
||||
<!-- ACCORDION -->
|
||||
|
||||
|
||||
|
||||
<h2 class="demoHeaders">Accordion</h2>
|
||||
|
||||
<div id="accordion">
|
||||
<div class="ui-accordion-group">
|
||||
<h3 class="ui-accordion-header"><a href="#">Test 1</a></h3>
|
||||
<div class="ui-accordion-content">
|
||||
<p>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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-accordion-group">
|
||||
<h3 class="ui-accordion-header"><a href="#">Test 2</a></h3>
|
||||
<div class="ui-accordion-content">
|
||||
<p>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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </div>
|
||||
</div>
|
||||
<div class="ui-accordion-group">
|
||||
<h3 class="ui-accordion-header"><a href="#">Test 3</a></h3>
|
||||
<div class="ui-accordion-content">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- TABS -->
|
||||
|
||||
|
||||
<h2 class="demoHeaders">Tabs</h2>
|
||||
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li class="ui-tabs-nav-item"><a href="#fragment-1">First Section</a></li>
|
||||
<li class="ui-tabs-nav-item"><a href="#fragment-2">Second Section</a></li>
|
||||
<li class="ui-tabs-nav-item"><a href="#fragment-3"><span>Third Section</span></a></li>
|
||||
</ul>
|
||||
<div id="fragment-1">
|
||||
<p>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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
||||
</div>
|
||||
<div id="fragment-2">
|
||||
<p>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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
<div id="fragment-3">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div><!-- /#compGroupA -->
|
||||
|
||||
<div id="compGroupB" class="clearfix">
|
||||
|
||||
<!-- SLIDER -->
|
||||
|
||||
<h2 class="demoHeaders">Slider</h2>
|
||||
|
||||
<div id="slider">
|
||||
<div class='ui-slider-handle'></div>
|
||||
<div class='ui-slider-handle' style="left: 100px;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Date Picker -->
|
||||
<h2 class="demoHeaders">Date Picker</h2>
|
||||
|
||||
<div id="ui-datepicker" class="clearfix"></div>
|
||||
|
||||
|
||||
|
||||
<!-- Dialog NOTE: Dialog is not generated by UI in this demo so it can be visually styled in themeroller-->
|
||||
<h2 class="demoHeaders">Dialog</h2>
|
||||
|
||||
<div class="ui-dialog ui-draggable" style="width: 30em; height: 20em; ">
|
||||
<div style="position: relative;" class="ui-dialog-container">
|
||||
<div class="ui-dialog-titlebar">
|
||||
<span class="ui-dialog-title">This is my title</span>
|
||||
<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>
|
||||
</div>
|
||||
<div class="ui-dialog-content" id="dialogContent" title="This is my title">
|
||||
<p>I'm in a dialog!</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-resizable-n ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-s ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-e ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-w ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-ne ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-se ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-sw ui-resizable-handle"></div>
|
||||
<div class="ui-resizable-nw ui-resizable-handle"></div>
|
||||
<div class="ui-dialog-buttonpane">
|
||||
<button>Okay</button>
|
||||
<button>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!-- /#compGroupB -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_arrows_leftright.gif
Normal file
After Width: | Height: | Size: 58 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_arrows_updown.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_close.gif
Normal file
After Width: | Height: | Size: 62 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_doc.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_folder_closed.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_folder_open.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_minus.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_plus.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/222222_11x11_icon_resize_se.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/222222_7x7_arrow_down.gif
Normal file
After Width: | Height: | Size: 52 B |
BIN
xCAT-UI/css/theme/images/222222_7x7_arrow_left.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/222222_7x7_arrow_right.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/222222_7x7_arrow_up.gif
Normal file
After Width: | Height: | Size: 52 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_arrows_leftright.gif
Normal file
After Width: | Height: | Size: 58 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_arrows_updown.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_close.gif
Normal file
After Width: | Height: | Size: 62 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_doc.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_folder_closed.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_folder_open.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_minus.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/888888_11x11_icon_plus.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/888888_7x7_arrow_down.gif
Normal file
After Width: | Height: | Size: 52 B |
BIN
xCAT-UI/css/theme/images/888888_7x7_arrow_left.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/888888_7x7_arrow_right.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/888888_7x7_arrow_up.gif
Normal file
After Width: | Height: | Size: 52 B |
BIN
xCAT-UI/css/theme/images/8ab9ff_40x100_textures_02_glass_50.png
Normal file
After Width: | Height: | Size: 219 B |
BIN
xCAT-UI/css/theme/images/d8d8d8_40x100_textures_02_glass_90.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
xCAT-UI/css/theme/images/e0e0e0_40x100_textures_02_glass_80.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
xCAT-UI/css/theme/images/f3f3f3_40x100_textures_01_flat_0.png
Normal file
After Width: | Height: | Size: 180 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_arrows_leftright.gif
Normal file
After Width: | Height: | Size: 58 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_arrows_updown.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_close.gif
Normal file
After Width: | Height: | Size: 62 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_doc.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_folder_closed.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_folder_open.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_minus.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/css/theme/images/ffffff_11x11_icon_plus.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
xCAT-UI/css/theme/images/ffffff_7x7_arrow_down.gif
Normal file
After Width: | Height: | Size: 52 B |
BIN
xCAT-UI/css/theme/images/ffffff_7x7_arrow_left.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/ffffff_7x7_arrow_right.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
xCAT-UI/css/theme/images/ffffff_7x7_arrow_up.gif
Normal file
After Width: | Height: | Size: 52 B |
833
xCAT-UI/css/theme/jquery-ui-themeroller.css
Normal file
@ -0,0 +1,833 @@
|
||||
/*
|
||||
* jQuery UI screen structure and presentation
|
||||
* This CSS file was generated by ThemeRoller, a Filament Group Project for jQuery UI
|
||||
* Author: Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
|
||||
* Visit ThemeRoller.com
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note: If your ThemeRoller settings have a font size set in ems, your components will scale according to their parent element's font size.
|
||||
* As a rule of thumb, set your body's font size to 62.5% to make 1em = 10px.
|
||||
* body {font-size: 62.5%;}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*UI accordion*/
|
||||
.ui-accordion {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
|
||||
font-size: 1.2em;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
}
|
||||
.ui-accordion-group {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
border: 1px solid #cccccc;
|
||||
border-bottom: none;
|
||||
}
|
||||
.ui-accordion-header {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
cursor: pointer;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
}
|
||||
.ui-accordion-header a {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
display: block;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
padding: .5em .5em .5em 1.7em;
|
||||
color: #444444;
|
||||
background: url(images/888888_7x7_arrow_right.gif) .5em 50% no-repeat;
|
||||
}
|
||||
.ui-accordion-header a:hover {
|
||||
background: url(images/222222_7x7_arrow_right.gif) .5em 50% no-repeat;
|
||||
color: #111111;
|
||||
}
|
||||
.ui-accordion-header:hover {
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
color: #111111;
|
||||
}
|
||||
.selected .ui-accordion-header, .selected .ui-accordion-header:hover {
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
}
|
||||
.selected .ui-accordion-header a, .selected .ui-accordion-header a:hover {
|
||||
color: #000000;
|
||||
background: url(images/ffffff_7x7_arrow_down.gif) .5em 50% no-repeat;
|
||||
}
|
||||
.ui-accordion-content {
|
||||
padding: 1.5em 1.7em;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
color: #362b36;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*UI tabs*/
|
||||
.ui-tabs-nav {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
float: left;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-right: 1px solid #cccccc;
|
||||
bottom: -1px;
|
||||
}
|
||||
.ui-tabs-nav-item {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
float: left;
|
||||
border: 1px solid #cccccc;
|
||||
border-right: none;
|
||||
}
|
||||
.ui-tabs-nav-item a {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
float: left;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
padding: .5em 1.7em;
|
||||
color: #444444;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
}
|
||||
.ui-tabs-nav-item a:hover {
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
color: #111111;
|
||||
}
|
||||
.ui-tabs-selected {
|
||||
border-bottom-color: #8ab9ff;
|
||||
}
|
||||
.ui-tabs-selected a, .ui-tabs-selected a:hover {
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
color: #000000;
|
||||
}
|
||||
.ui-tabs-panel {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
clear:left;
|
||||
border: 1px solid #cccccc;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
color: #362b36;
|
||||
padding: 1.5em 1.7em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.ui-tabs-hide {
|
||||
display: none;/* for accessible hiding: position: absolute; left: -99999999px*/;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*slider*/
|
||||
.ui-slider {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
border: 1px solid #dddddd;
|
||||
height: .8em;
|
||||
position: relative;
|
||||
}
|
||||
.ui-slider-handle {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: -3px;
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
border: 1px solid #cccccc;
|
||||
}
|
||||
.ui-slider-handle:hover {
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
border: 1px solid #888888;
|
||||
}
|
||||
.ui-slider-handle-active, .ui-slider-handle-active:hover {
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
border: 1px solid #2694e8;
|
||||
}
|
||||
.ui-slider-range {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
height: .8em;
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
position: absolute;
|
||||
border: 1px solid #cccccc;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
top: -1px;
|
||||
z-index: 1;
|
||||
opacity:.7;
|
||||
/* filter:Alpha(Opacity=70); */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*dialog*/
|
||||
.ui-dialog {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
color: #362b36;
|
||||
border: 4px solid #dddddd;
|
||||
position: relative;
|
||||
}
|
||||
.ui-resizable-handle {
|
||||
position: absolute;
|
||||
font-size: 0.1px;
|
||||
z-index: 99999;
|
||||
}
|
||||
.ui-resizable .ui-resizable-handle {
|
||||
display: block;
|
||||
}
|
||||
body .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */
|
||||
body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */
|
||||
.ui-resizable-n {
|
||||
cursor: n-resize;
|
||||
height: 7px;
|
||||
width: 100%;
|
||||
top: -5px;
|
||||
left: 0px;
|
||||
}
|
||||
.ui-resizable-s {
|
||||
cursor: s-resize;
|
||||
height: 7px;
|
||||
width: 100%;
|
||||
bottom: -5px;
|
||||
left: 0px;
|
||||
}
|
||||
.ui-resizable-e {
|
||||
cursor: e-resize;
|
||||
width: 7px;
|
||||
right: -5px;
|
||||
top: 0px;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-resizable-w {
|
||||
cursor: w-resize;
|
||||
width: 7px;
|
||||
left: -5px;
|
||||
top: 0px;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-resizable-se {
|
||||
cursor: se-resize;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
background: url(images/222222_11x11_icon_resize_se.gif) no-repeat 0 0;
|
||||
}
|
||||
.ui-resizable-sw {
|
||||
cursor: sw-resize;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
.ui-resizable-nw {
|
||||
cursor: nw-resize;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
.ui-resizable-ne {
|
||||
cursor: ne-resize;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
.ui-dialog-titlebar {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
padding: .5em 1.5em .5em 1em;
|
||||
color: #444444;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
position: relative;
|
||||
}
|
||||
.ui-dialog-title {}
|
||||
.ui-dialog-titlebar-close {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
background: url(images/888888_11x11_icon_close.gif) 0 0 no-repeat;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: .7em;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
z-index: 100;
|
||||
}
|
||||
.ui-dialog-titlebar-close-hover, .ui-dialog-titlebar-close:hover {
|
||||
background: url(images/222222_11x11_icon_close.gif) 0 0 no-repeat;
|
||||
}
|
||||
.ui-dialog-titlebar-close:active {
|
||||
background: url(images/ffffff_11x11_icon_close.gif) 0 0 no-repeat;
|
||||
}
|
||||
.ui-dialog-titlebar-close span {
|
||||
display: none;
|
||||
}
|
||||
.ui-dialog-content {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
color: #362b36;
|
||||
padding: 1.5em 1.7em;
|
||||
}
|
||||
.ui-dialog-buttonpane {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
border-top: 1px solid #dddddd;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
.ui-dialog-buttonpane button {
|
||||
margin: .5em 0 .5em 8px;
|
||||
color: #444444;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
font-size: 1em;
|
||||
border: 1px solid #cccccc;
|
||||
cursor: pointer;
|
||||
padding: .2em .6em .3em .6em;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
.ui-dialog-buttonpane button:hover {
|
||||
color: #111111;
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
border: 1px solid #888888;
|
||||
}
|
||||
.ui-dialog-buttonpane button:active {
|
||||
color: #000000;
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
border: 1px solid #2694e8;
|
||||
}
|
||||
/* This file skins dialog */
|
||||
.ui-dialog.ui-draggable .ui-dialog-titlebar,
|
||||
.ui-dialog.ui-draggable .ui-dialog-titlebar {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*datepicker*/
|
||||
/* Main Style Sheet for jQuery UI date picker */
|
||||
.ui-datepicker-div, .ui-datepicker-inline, #ui-datepicker-div {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
font-size: 1.2em;
|
||||
border: 4px solid #dddddd;
|
||||
width: 15.5em;
|
||||
padding: 2.5em .5em .5em .5em;
|
||||
position: relative;
|
||||
}
|
||||
.ui-datepicker-div, #ui-datepicker-div {
|
||||
z-index: 9999; /*must have*/
|
||||
display: none;
|
||||
}
|
||||
.ui-datepicker-inline {
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
.ui-datepicker-control {
|
||||
display: none;
|
||||
}
|
||||
.ui-datepicker-current {
|
||||
display: none;
|
||||
}
|
||||
.ui-datepicker-next, .ui-datepicker-prev {
|
||||
position: absolute;
|
||||
left: .5em;
|
||||
top: .5em;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
}
|
||||
.ui-datepicker-next {
|
||||
left: 14.6em;
|
||||
}
|
||||
.ui-datepicker-next:hover, .ui-datepicker-prev:hover {
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
}
|
||||
.ui-datepicker-next a, .ui-datepicker-prev a {
|
||||
text-indent: -999999px;
|
||||
width: 1.3em;
|
||||
height: 1.4em;
|
||||
display: block;
|
||||
font-size: 1em;
|
||||
background: url(images/888888_7x7_arrow_left.gif) 50% 50% no-repeat;
|
||||
border: 1px solid #cccccc;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-datepicker-next a {
|
||||
background: url(images/888888_7x7_arrow_right.gif) 50% 50% no-repeat;
|
||||
}
|
||||
.ui-datepicker-prev a:hover {
|
||||
background: url(images/222222_7x7_arrow_left.gif) 50% 50% no-repeat;
|
||||
}
|
||||
.ui-datepicker-next a:hover {
|
||||
background: url(images/222222_7x7_arrow_right.gif) 50% 50% no-repeat;
|
||||
}
|
||||
.ui-datepicker-prev a:active {
|
||||
background: url(images/ffffff_7x7_arrow_left.gif) 50% 50% no-repeat;
|
||||
}
|
||||
.ui-datepicker-next a:active {
|
||||
background: url(images/ffffff_7x7_arrow_right.gif) 50% 50% no-repeat;
|
||||
}
|
||||
.ui-datepicker-header select {
|
||||
border: 1px solid #cccccc;
|
||||
color: #444444;
|
||||
background: #e0e0e0;
|
||||
font-size: 1em;
|
||||
line-height: 1.4em;
|
||||
position: absolute;
|
||||
top: .5em;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.ui-datepicker-header option:focus, .ui-datepicker-header option:hover {
|
||||
background: #d8d8d8;
|
||||
}
|
||||
.ui-datepicker-header select.ui-datepicker-new-month {
|
||||
width: 7em;
|
||||
left: 2.2em;
|
||||
}
|
||||
.ui-datepicker-header select.ui-datepicker-new-year {
|
||||
width: 5em;
|
||||
left: 9.4em;
|
||||
}
|
||||
table.ui-datepicker {
|
||||
width: 15.5em;
|
||||
text-align: right;
|
||||
}
|
||||
table.ui-datepicker td a {
|
||||
padding: .1em .3em .1em 0;
|
||||
display: block;
|
||||
color: #444444;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
cursor: pointer;
|
||||
border: 1px solid #f3f3f3;
|
||||
}
|
||||
table.ui-datepicker td a:hover {
|
||||
border: 1px solid #888888;
|
||||
color: #111111;
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
}
|
||||
table.ui-datepicker td a:active {
|
||||
border: 1px solid #2694e8;
|
||||
color: #000000;
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
}
|
||||
table.ui-datepicker .ui-datepicker-title-row td {
|
||||
padding: .3em 0;
|
||||
text-align: center;
|
||||
font-size: .9em;
|
||||
color: #362b36;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
table.ui-datepicker .ui-datepicker-title-row td a {
|
||||
color: #362b36;
|
||||
}
|
||||
.ui-datepicker-cover {
|
||||
display: none;
|
||||
display/**/: block;
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
/* filter: mask(); */
|
||||
top: -4px;
|
||||
left: -4px;
|
||||
width: 193px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ui-autocomplete */
|
||||
.ui-autocomplete-results {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
z-index: 9999;
|
||||
}
|
||||
.ui-autocomplete-results ul, .ui-autocomplete-results li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.ui-autocomplete-results ul {
|
||||
border: 1px solid #cccccc;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
color: #362b36;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.ui-autocomplete-results li {
|
||||
padding: .4em .5em;
|
||||
color: #444444;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
position: relative;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
margin: 1px 0;
|
||||
}
|
||||
.ui-autocomplete-results li.ui-hover-state, .ui-autocomplete-results li.ui-active-state {
|
||||
margin: 0;
|
||||
}
|
||||
/*Paul - you could add classes for these first last states instead for ie6... */
|
||||
.ui-autocomplete-results li:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
.ui-autocomplete-results li:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.ui-autocomplete-results li.ui-autocomplete-over {
|
||||
border: 1px solid #888888;
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
color: #111111 !important;
|
||||
}
|
||||
.ui-autocomplete-results li.ui-autocomplete-active {
|
||||
border: 1px solid #2694e8;
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
color: #000000 !important;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*UI ProgressBar */
|
||||
.ui-progressbar {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
border: 1px solid #dddddd;
|
||||
position: relative;
|
||||
}
|
||||
.ui-progressbar-bar {
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
overflow: visible;
|
||||
position: relative;
|
||||
border: 1px solid #cccccc;
|
||||
margin-top: -1px;
|
||||
margin-left: -1px;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.ui-progressbar-text {
|
||||
color: #444444;
|
||||
padding: .2em .5em;
|
||||
font-weight: normal;
|
||||
}
|
||||
.ui-progressbar-text-back {
|
||||
display: none;
|
||||
/* position: absolute;
|
||||
top: 1px;
|
||||
left: 0px;
|
||||
font-weight: normal;
|
||||
color:#000;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-right: 1px;
|
||||
*/
|
||||
}
|
||||
.ui-progressbar-disabled {
|
||||
opacity:.5;
|
||||
/* filter:Alpha(Opacity=50); */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*UI Colorpicker */
|
||||
.ui-colorpicker {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
border: 4px solid #dddddd;
|
||||
padding: 5px;
|
||||
width: 360px;
|
||||
position: relative;
|
||||
}
|
||||
.ui-colorpicker-color {
|
||||
float: left;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.ui-colorpicker-color div { /* is this extra div needed? why not just .ui-colorpicker-color ? */
|
||||
border: 1px solid #cccccc;
|
||||
height: 150px;
|
||||
background: url(images/_x_.);
|
||||
position: relative;
|
||||
}
|
||||
.ui-colorpicker-color div div {/* shouldn't this have a class like ui-colorpicker-selector ? */
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
background: url(images/_x_.);
|
||||
position: absolute;
|
||||
border: 0;
|
||||
margin: -5px 0 0 -5px;
|
||||
float: none;
|
||||
}
|
||||
.ui-colorpicker-hue {
|
||||
border: 1px solid #cccccc;
|
||||
float: left;
|
||||
width: 17px;
|
||||
height: 150px;
|
||||
background: url(images/_x_.);
|
||||
position: relative;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.ui-colorpicker-hue div {
|
||||
background:transparent url(images/_x_.); /*this image should be themerollable*/
|
||||
height:9px;
|
||||
left:-9px;
|
||||
margin:-4px 0 0;
|
||||
position:absolute;
|
||||
width:35px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.ui-colorpicker-new-color, .ui-colorpicker-current-color {
|
||||
float: left;
|
||||
width: 6.5em;
|
||||
height: 30px;
|
||||
border: 1px solid #cccccc;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.ui-colorpicker-current-color {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.ui-colorpicker-field, .ui-colorpicker-hex {
|
||||
position: absolute;
|
||||
width: 6em;
|
||||
}
|
||||
.ui-colorpicker-field label, .ui-colorpicker-field input,
|
||||
.ui-colorpicker-hex label, .ui-colorpicker-hex input {
|
||||
font-size: 1em;
|
||||
color: #ffffff;
|
||||
}
|
||||
.ui-colorpicker-field label, .ui-colorpicker-hex label {
|
||||
width: 1em;
|
||||
margin-right: .3em;
|
||||
}
|
||||
.ui-colorpicker-field input, .ui-colorpicker-hex input {
|
||||
border: 1px solid #cccccc;
|
||||
width: 4.6em;
|
||||
}
|
||||
.ui-colorpicker-hex {
|
||||
left: 205px;
|
||||
top: 134px;
|
||||
}
|
||||
.ui-colorpicker-rgb-r {
|
||||
top: 52px;
|
||||
left: 205px;
|
||||
}
|
||||
.ui-colorpicker-rgb-g {
|
||||
top: 78px;
|
||||
left: 205px;
|
||||
}
|
||||
.ui-colorpicker-rgb-b {
|
||||
top: 105px;
|
||||
left: 205px;
|
||||
}
|
||||
.ui-colorpicker-hsb-h {
|
||||
top: 52px;
|
||||
left: 290px;
|
||||
}
|
||||
.ui-colorpicker-hsb-s {
|
||||
top: 78px;
|
||||
left: 290px;
|
||||
}
|
||||
.ui-colorpicker-hsb-b {
|
||||
top: 105px;
|
||||
left: 290px;
|
||||
}
|
||||
|
||||
.ui-colorpicker-field label {
|
||||
font-weight: normal;
|
||||
}
|
||||
.ui-colorpicker-field span {
|
||||
width: 7px;
|
||||
background: url(images/888888_11x11_icon_arrows_updown.gif) 50% 50% no-repeat;
|
||||
right: 5px;
|
||||
top: 0;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
}
|
||||
.ui-colorpicker-field span:hover {
|
||||
background: url(images/222222_11x11_icon_arrows_updown.gif) 50% 50% no-repeat;
|
||||
}
|
||||
|
||||
.ui-colorpicker-submit {
|
||||
right: 14px;
|
||||
top: 134px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Generic ThemeRoller Classes
|
||||
>> Make your jQuery Components ThemeRoller-Compatible!
|
||||
*/
|
||||
|
||||
/*component global class*/
|
||||
.ui-component {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
/*component content styles*/
|
||||
.ui-component-content {
|
||||
border: 1px solid #dddddd;
|
||||
background: #f3f3f3 url(images/f3f3f3_40x100_textures_01_flat_0.png) 0 0 repeat-x;
|
||||
color: #362b36;
|
||||
}
|
||||
.ui-component-content a {
|
||||
color: #362b36;
|
||||
text-decoration: underline;
|
||||
}
|
||||
/*component states*/
|
||||
.ui-default-state {
|
||||
border: 1px solid #cccccc;
|
||||
background: #e0e0e0 url(images/e0e0e0_40x100_textures_02_glass_80.png) 0 50% repeat-x;
|
||||
font-weight: normal;
|
||||
color: #444444 !important;
|
||||
}
|
||||
.ui-default-state a {
|
||||
color: #444444;
|
||||
}
|
||||
.ui-default-state:hover, .ui-hover-state {
|
||||
border: 1px solid #888888;
|
||||
background: #d8d8d8 url(images/d8d8d8_40x100_textures_02_glass_90.png) 0 50% repeat-x;
|
||||
font-weight: normal;
|
||||
color: #111111 !important;
|
||||
}
|
||||
.ui-hover-state a {
|
||||
color: #111111;
|
||||
}
|
||||
.ui-default-state:active, .ui-active-state {
|
||||
border: 1px solid #2694e8;
|
||||
background: #8ab9ff url(images/8ab9ff_40x100_textures_02_glass_50.png) 0 50% repeat-x;
|
||||
font-weight: normal;
|
||||
color: #000000 !important;
|
||||
outline: none;
|
||||
}
|
||||
.ui-active-state a {
|
||||
color: #000000;
|
||||
outline: none;
|
||||
}
|
||||
/*icons*/
|
||||
.ui-arrow-right-default {background: url(images/888888_7x7_arrow_right.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-right-default:hover, .ui-arrow-right-hover {background: url(images/222222_7x7_arrow_right.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-right-default:active, .ui-arrow-right-active {background: url(images/ffffff_7x7_arrow_right.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-right-content {background: url(images/222222_7x7_arrow_right.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-arrow-left-default {background: url(images/888888_7x7_arrow_left.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-left-default:hover, .ui-arrow-left-hover {background: url(images/222222_7x7_arrow_left.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-left-default:active, .ui-arrow-left-active {background: url(images/ffffff_7x7_arrow_left.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-left-content {background: url(images/222222_7x7_arrow_left.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-arrow-down-default {background: url(images/888888_7x7_arrow_down.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-down-default:hover, .ui-arrow-down-hover {background: url(images/222222_7x7_arrow_down.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-down-default:active, .ui-arrow-down-active {background: url(images/ffffff_7x7_arrow_down.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-down-content {background: url(images/222222_7x7_arrow_down.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-arrow-up-default {background: url(images/888888_7x7_arrow_up.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-up-default:hover, .ui-arrow-up-hover {background: url(images/222222_7x7_arrow_up.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-up-default:active, .ui-arrow-up-active {background: url(images/ffffff_7x7_arrow_up.gif) no-repeat 50% 50%;}
|
||||
.ui-arrow-up-content {background: url(images/222222_7x7_arrow_up.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-close-default {background: url(images/888888_11x11_icon_close.gif) no-repeat 50% 50%;}
|
||||
.ui-close-default:hover, .ui-close-hover {background: url(images/222222_11x11_icon_close.gif) no-repeat 50% 50%;}
|
||||
.ui-close-default:active, .ui-close-active {background: url(images/ffffff_11x11_icon_close.gif) no-repeat 50% 50%;}
|
||||
.ui-close-content {background: url(images/ffffff_11x11_icon_close.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-folder-closed-default {background: url(images/888888_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-closed-default:hover, .ui-folder-closed-hover {background: url(images/222222_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-closed-default:active, .ui-folder-closed-active {background: url(images/ffffff_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-closed-content {background: url(images/888888_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-folder-open-default {background: url(images/888888_11x11_icon_folder_open.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-open-default:hover, .ui-folder-open-hover {background: url(images/222222_11x11_icon_folder_open.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-open-default:active, .ui-folder-open-active {background: url(images/ffffff_11x11_icon_folder_open.gif) no-repeat 50% 50%;}
|
||||
.ui-folder-open-content {background: url(images/ffffff_11x11_icon_folder_open.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-doc-default {background: url(images/888888_11x11_icon_doc.gif) no-repeat 50% 50%;}
|
||||
.ui-doc-default:hover, .ui-doc-hover {background: url(images/222222_11x11_icon_doc.gif) no-repeat 50% 50%;}
|
||||
.ui-doc-default:active, .ui-doc-active {background: url(images/ffffff_11x11_icon_doc.gif) no-repeat 50% 50%;}
|
||||
.ui-doc-content {background: url(images/222222_11x11_icon_doc.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-arrows-leftright-default {background: url(images/888888_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-leftright-default:hover, .ui-arrows-leftright-hover {background: url(images/222222_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-leftright-default:active, .ui-arrows-leftright-active {background: url(images/ffffff_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-leftright-content {background: url(images/222222_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-arrows-updown-default {background: url(images/888888_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-updown-default:hover, .ui-arrows-updown-hover {background: url(images/222222_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-updown-default:active, .ui-arrows-updown-active {background: url(images/ffffff_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}
|
||||
.ui-arrows-updown-content {background: url(images/222222_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-minus-default {background: url(images/888888_11x11_icon_minus.gif) no-repeat 50% 50%;}
|
||||
.ui-minus-default:hover, .ui-minus-hover {background: url(images/222222_11x11_icon_minus.gif) no-repeat 50% 50%;}
|
||||
.ui-minus-default:active, .ui-minus-active {background: url(images/ffffff_11x11_icon_minus.gif) no-repeat 50% 50%;}
|
||||
.ui-minus-content {background: url(images/222222_11x11_icon_minus.gif) no-repeat 50% 50%;}
|
||||
|
||||
.ui-plus-default {background: url(images/888888_11x11_icon_plus.gif) no-repeat 50% 50%;}
|
||||
.ui-plus-default:hover, .ui-plus-hover {background: url(images/222222_11x11_icon_plus.gif) no-repeat 50% 50%;}
|
||||
.ui-plus-default:active, .ui-plus-active {background: url(images/ffffff_11x11_icon_plus.gif) no-repeat 50% 50%;}
|
||||
.ui-plus-content {background: url(images/222222_11x11_icon_plus.gif) no-repeat 50% 50%;}
|
||||
|
||||
/*hidden elements*/
|
||||
.ui-hidden {
|
||||
display: none;/* for accessible hiding: position: absolute; left: -99999999px*/;
|
||||
}
|
||||
.ui-accessible-hidden {
|
||||
position: absolute; left: -99999999px;
|
||||
}
|
||||
/*reset styles*/
|
||||
.ui-reset {
|
||||
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;
|
||||
}
|
||||
/*clearfix class*/
|
||||
.ui-clearfix:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
.ui-clearfix {display: inline-block;}
|
||||
/* Hides from IE-mac \*/
|
||||
* html .ui-clearfix {height: 1%;}
|
||||
.ui-clearfix {display: block;}
|
||||
/* End hide from IE-mac */
|
||||
|
||||
/* Note: for resizable styles, use the styles listed above in the dialog section */
|
||||
|
||||
/* added to make it so you can't close the dialog! */
|
||||
.ui-dialog-titlebar-close { display: none; }
|
7
xCAT-UI/etc/apache2/conf.d/xcat-web.conf
Normal file
@ -0,0 +1,7 @@
|
||||
Alias /xcat "/opt/xcat/web"
|
||||
<Directory "/opt/xcat/web">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
BIN
xCAT-UI/img/ajax-loader.gif
Normal file
After Width: | Height: | Size: 451 B |
BIN
xCAT-UI/img/arrows-ffffff.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
xCAT-UI/img/asc.gif
Normal file
After Width: | Height: | Size: 54 B |
BIN
xCAT-UI/img/auth.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
xCAT-UI/img/bg.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
xCAT-UI/img/bg_button_a.gif
Normal file
After Width: | Height: | Size: 424 B |
BIN
xCAT-UI/img/bg_button_span.gif
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
xCAT-UI/img/bopper.jpg
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
xCAT-UI/img/cmd-active.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
xCAT-UI/img/cmd-active.xcf
Normal file
BIN
xCAT-UI/img/cmd.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
xCAT-UI/img/cmd.xcf
Normal file
BIN
xCAT-UI/img/cmdBtn.gif
Normal file
After Width: | Height: | Size: 767 B |
BIN
xCAT-UI/img/cmdBtn.xcf
Normal file
BIN
xCAT-UI/img/desc.gif
Normal file
After Width: | Height: | Size: 54 B |
BIN
xCAT-UI/img/header5.jpg
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
xCAT-UI/img/header5.xcf
Normal file
BIN
xCAT-UI/img/indicator.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
xCAT-UI/img/logo2.gif
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
xCAT-UI/img/red-x.gif
Normal file
After Width: | Height: | Size: 1002 B |
BIN
xCAT-UI/img/red-x2-light.gif
Normal file
After Width: | Height: | Size: 973 B |
BIN
xCAT-UI/img/red-x2.gif
Normal file
After Width: | Height: | Size: 973 B |
BIN
xCAT-UI/img/shadow.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
xCAT-UI/img/throbber.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
xCAT-UI/img/topper.jpg
Normal file
After Width: | Height: | Size: 574 B |
BIN
xCAT-UI/img/topper.xcf
Normal file
17
xCAT-UI/index.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
if(preg_match('/MSIE/i', $u_agent)){
|
||||
echo "Internet Explorer is not supported at this time. Please use Firefox\n";
|
||||
exit;
|
||||
}
|
||||
require_once "lib/functions.php";
|
||||
require_once "lib/display.php";
|
||||
require_once "lib/security.php";
|
||||
displayHeader();
|
||||
displayBody();
|
||||
displayFooter();
|
||||
|
||||
#if(!isAuthenticated()){
|
||||
# insertLogin();
|
||||
#}
|
||||
?>
|
806
xCAT-UI/js/JSON/JSON.php
Normal file
@ -0,0 +1,806 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``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 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.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
394
xCAT-UI/js/chili-1.8b.js
Normal file
@ -0,0 +1,394 @@
|
||||
/*
|
||||
===============================================================================
|
||||
Chili is the jQuery code highlighter plugin
|
||||
...............................................................................
|
||||
Copyright 2007 / Andrea Ercolino
|
||||
-------------------------------------------------------------------------------
|
||||
LICENSE: http://www.opensource.org/licenses/mit-license.php
|
||||
WEBSITE: http://noteslog.com/chili/
|
||||
===============================================================================
|
||||
|
||||
===============================================================================
|
||||
Metaobjects is the jQuery metadata plugin on steroids
|
||||
...............................................................................
|
||||
Copyright 2007 / Andrea Ercolino
|
||||
-------------------------------------------------------------------------------
|
||||
LICENSE: http://www.opensource.org/licenses/mit-license.php
|
||||
WEBSITE: http://noteslog.com/metaobjects/
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
( function($) {
|
||||
|
||||
ChiliBook = { //implied global
|
||||
|
||||
version: "1.8b" // 2007-05-26
|
||||
|
||||
, automatic: true
|
||||
, automaticSelector: "code"
|
||||
|
||||
, codeLanguage: function( el ) {
|
||||
var recipeName = $( el ).attr( "class" );
|
||||
return recipeName ? recipeName : '';
|
||||
}
|
||||
|
||||
, metadataSelector: "object.chili" // use an empty string for not executing
|
||||
|
||||
, recipeLoading: true
|
||||
, recipeFolder: "" // used like: recipeFolder + recipeName + '.js'
|
||||
, stylesheetLoading: true
|
||||
, stylesheetFolder: "" // used like: stylesheetFolder + recipeName + '.css'
|
||||
|
||||
, defaultReplacement: '<span class="$0">$$</span>'
|
||||
|
||||
, replaceSpace: " " // use an empty string for not replacing
|
||||
, replaceTab: "    " // use an empty string for not replacing
|
||||
, replaceNewLine: " <br/>" // use an empty string for not replacing
|
||||
|
||||
, recipes: {} //repository
|
||||
, queue: {} //register
|
||||
|
||||
//fix for IE: copy of PREformatted text strips off all html, losing newlines
|
||||
, preFixCopy: document.selection && document.selection.createRange
|
||||
, preContent: ""
|
||||
, preElement: null
|
||||
};
|
||||
|
||||
|
||||
$.metaobjects = function( options ) {
|
||||
|
||||
options = $.extend( {
|
||||
context: document
|
||||
, clean: true
|
||||
, selector: 'object.metaobject'
|
||||
}, options );
|
||||
|
||||
function jsValue( value ) {
|
||||
eval( 'value = ' + value + ";" );
|
||||
return value;
|
||||
}
|
||||
|
||||
return $( options.selector, options.context )
|
||||
.each( function() {
|
||||
|
||||
var settings = { target: this.parentNode };
|
||||
$( '> param[@name=metaparam]', this )
|
||||
.each( function() {
|
||||
$.extend( settings, jsValue( this.value ) );
|
||||
} );
|
||||
|
||||
$( '> param', this )
|
||||
.not( '[@name=metaparam]' )
|
||||
.each( function() {
|
||||
var name = this.name, value = jsValue( this.value );
|
||||
$( settings.target )
|
||||
.each( function() {
|
||||
this[ name ] = value;
|
||||
} );
|
||||
} );
|
||||
|
||||
if( options.clean ) {
|
||||
$( this ).remove();
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
$.fn.chili = function( options ) {
|
||||
var book = $.extend( {}, ChiliBook, options || {} );
|
||||
|
||||
function cook( ingredients, recipe ) {
|
||||
|
||||
function prepareStep( stepName, step ) {
|
||||
var exp = ( typeof step.exp == "string" ) ? step.exp : step.exp.source;
|
||||
steps.push( {
|
||||
stepName: stepName
|
||||
, exp: "(" + exp + ")"
|
||||
, length: 1 // add 1 to account for the newly added parentheses
|
||||
+ (exp // count number of submatches in here
|
||||
.replace( /\\./g, "%" ) // disable any escaped character
|
||||
.replace( /\[.*?\]/g, "%" ) // disable any character class
|
||||
.match( /\((?!\?)/g ) // match any open parenthesis, not followed by a ?
|
||||
|| [] // make sure it is an empty array if there are no matches
|
||||
).length // get the number of matches
|
||||
, replacement: (step.replacement) ? step.replacement : book.defaultReplacement
|
||||
} );
|
||||
} // function prepareStep( stepName, step )
|
||||
|
||||
function knowHow() {
|
||||
var prevLength = 0;
|
||||
var exps = new Array;
|
||||
for (var i = 0; i < steps.length; i++) {
|
||||
var exp = steps[ i ].exp;
|
||||
// adjust backreferences
|
||||
exp = exp.replace( /\\\\|\\(\d+)/g, function( m, aNum ) {
|
||||
return !aNum ? m : "\\" + ( prevLength + 1 + parseInt( aNum, 10 ) );
|
||||
} );
|
||||
exps.push( exp );
|
||||
prevLength += steps[ i ].length;
|
||||
}
|
||||
var source = exps.join( "|" );
|
||||
return new RegExp( source, (recipe.ignoreCase) ? "gi" : "g" );
|
||||
} // function knowHow()
|
||||
|
||||
function escapeHTML( str ) {
|
||||
return str.replace( /&/g, "&" ).replace( /</g, "<" );
|
||||
} // function escapeHTML( str )
|
||||
|
||||
function replaceSpaces( str ) {
|
||||
return str.replace( / +/g, function( spaces ) {
|
||||
return spaces.replace( / /g, replaceSpace );
|
||||
} );
|
||||
} // function replaceSpaces( str )
|
||||
|
||||
function filter( str ) {
|
||||
str = escapeHTML( str );
|
||||
if( replaceSpace ) {
|
||||
str = replaceSpaces( str );
|
||||
}
|
||||
return str;
|
||||
} // function filter( str )
|
||||
|
||||
function chef( matched ) {
|
||||
var i = 0; // iterate steps
|
||||
var j = 1; // iterate chef's arguments
|
||||
var step;
|
||||
while( step = steps[ i++ ] ) {
|
||||
var aux = arguments; // this unmasks chef's arguments inside the next function
|
||||
if( aux[ j ] ) {
|
||||
var pattern = /(\\\$)|(?:\$\$)|(?:\$(\d+))/g;
|
||||
var replacement = step.replacement
|
||||
.replace( pattern, function( m, escaped, K ) {
|
||||
var bit = '';
|
||||
if( escaped ) { /* \$ */
|
||||
return "$";
|
||||
}
|
||||
else if( !K ) { /* $$ */
|
||||
return filter( aux[ j ] );
|
||||
}
|
||||
else if( K == "0" ) { /* $0 */
|
||||
return step.stepName;
|
||||
}
|
||||
else { /* $K */
|
||||
return filter( aux[ j + parseInt( K, 10 ) ] );
|
||||
}
|
||||
} );
|
||||
|
||||
var offset = arguments[ arguments.length - 2 ];
|
||||
var input = arguments[ arguments.length - 1 ];
|
||||
var unmatched = input.substring( lastIndex, offset );
|
||||
lastIndex = offset + matched.length; // lastIndex for the next call to chef
|
||||
|
||||
perfect += filter( unmatched ) + replacement; // use perfect for all the replacing
|
||||
return replacement;
|
||||
}
|
||||
else {
|
||||
j+= step.length;
|
||||
}
|
||||
}
|
||||
} // function chef( matched )
|
||||
|
||||
var replaceSpace = book.replaceSpace;
|
||||
var steps = new Array;
|
||||
for( var stepName in recipe.steps ) {
|
||||
prepareStep( stepName, recipe.steps[ stepName ] );
|
||||
}
|
||||
|
||||
var perfect = ""; //replace doesn't provide a handle to the ongoing partially replaced string
|
||||
var lastIndex = 0; //regexp.lastIndex is available after a string.match, but not in a string.replace
|
||||
ingredients.replace( knowHow(), chef );
|
||||
var lastUnmatched = ingredients.substring( lastIndex, ingredients.length );
|
||||
perfect += filter( lastUnmatched );
|
||||
|
||||
return perfect;
|
||||
|
||||
} // function cook( ingredients, recipe )
|
||||
|
||||
function checkCSS( stylesheetPath ) {
|
||||
if( ! book.queue[ stylesheetPath ] ) {
|
||||
var e = document.createElement( "link" );
|
||||
e.rel = "stylesheet";
|
||||
e.type = "text/css";
|
||||
e.href = stylesheetPath;
|
||||
document.getElementsByTagName( "head" )[0].appendChild( e );
|
||||
|
||||
book.queue[ stylesheetPath ] = true;
|
||||
}
|
||||
} // function checkCSS( recipeName )
|
||||
|
||||
function makeDish( el, recipePath ) {
|
||||
var recipe = book.recipes[ recipePath ];
|
||||
if( ! recipe ) {
|
||||
return;
|
||||
}
|
||||
var chunks = el && el.childNodes && el.childNodes.length;
|
||||
if( chunks && chunks > 1 ) {
|
||||
return;
|
||||
}
|
||||
var ingredients = el.childNodes[0] && el.childNodes[0].data;
|
||||
if( ! ingredients ) {
|
||||
return;
|
||||
}
|
||||
// hack for IE: \r is used instead of \n
|
||||
ingredients = ingredients.replace(/\r\n?/g, "\n");
|
||||
|
||||
var dish = cook( ingredients, recipe ); // all happens here
|
||||
|
||||
if( book.replaceTab ) {
|
||||
dish = dish.replace( /\t/g, book.replaceTab );
|
||||
}
|
||||
if( book.replaceNewLine ) {
|
||||
dish = dish.replace( /\n/g, book.replaceNewLine );
|
||||
}
|
||||
|
||||
$( el ).html( dish );
|
||||
if( ChiliBook.preFixCopy ) {
|
||||
$( el )
|
||||
.parents()
|
||||
.filter( "pre" )
|
||||
.bind( "mousedown", function() {
|
||||
ChiliBook.preElement = this;
|
||||
} )
|
||||
.bind( "mouseup", function() {
|
||||
if( ChiliBook.preElement == this ) {
|
||||
ChiliBook.preContent = document.selection.createRange().htmlText;
|
||||
}
|
||||
} )
|
||||
;
|
||||
}
|
||||
} // function makeDish( el )
|
||||
|
||||
function getPath( recipeName, options ) {
|
||||
var settingsDef = {
|
||||
recipeFolder: book.recipeFolder
|
||||
, recipeFile: recipeName + ".js"
|
||||
, stylesheetFolder: book.stylesheetFolder
|
||||
, stylesheetFile: recipeName + ".css"
|
||||
};
|
||||
var settings;
|
||||
if( options && typeof options == "object" ) {
|
||||
settings = $.extend( settingsDef, options );
|
||||
}
|
||||
else {
|
||||
settings = settingsDef;
|
||||
}
|
||||
return {
|
||||
recipe : settings.recipeFolder + settings.recipeFile
|
||||
, stylesheet: settings.stylesheetFolder + settings.stylesheetFile
|
||||
};
|
||||
} //function getPath( recipeName, options )
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// initializations
|
||||
if( book.metadataSelector ) {
|
||||
$.metaobjects( { context: this, selector: book.metadataSelector } );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// the coloring starts here
|
||||
this
|
||||
.each( function() {
|
||||
var el = this;
|
||||
var recipeName = book.codeLanguage( el );
|
||||
if( '' != recipeName ) {
|
||||
var path = getPath( recipeName, el.chili );
|
||||
if( book.recipeLoading || el.chili ) {
|
||||
/* dynamic setups come here */
|
||||
if( ! book.queue[ path.recipe ] ) {
|
||||
/* this is a new recipe to download */
|
||||
try {
|
||||
book.queue[ path.recipe ] = [ el ];
|
||||
$.getJSON( path.recipe, function( recipeLoaded ) {
|
||||
recipeLoaded.path = path.recipe;
|
||||
book.recipes[ path.recipe ] = recipeLoaded;
|
||||
if( book.stylesheetLoading ) {
|
||||
checkCSS( path.stylesheet );
|
||||
}
|
||||
var q = book.queue[ path.recipe ];
|
||||
for( var i = 0, iTop = q.length; i < iTop; i++ ) {
|
||||
makeDish( q[ i ], path.recipe );
|
||||
}
|
||||
} );
|
||||
}
|
||||
catch( recipeNotAvailable ) {
|
||||
alert( "the recipe for '" + recipeName + "' was not found in '" + path.recipe + "'" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not a new recipe, so just enqueue this element */
|
||||
book.queue[ path.recipe ].push( el );
|
||||
}
|
||||
/* a recipe could have been already downloaded */
|
||||
makeDish( el, path.recipe );
|
||||
}
|
||||
else {
|
||||
/* static setups come here */
|
||||
makeDish( el, path.recipe );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return this;
|
||||
//-----------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//main
|
||||
$( function() {
|
||||
|
||||
if( ChiliBook.automatic ) {
|
||||
if( ChiliBook.elementPath ) {
|
||||
//preserve backward compatibility
|
||||
ChiliBook.automaticSelector = ChiliBook.elementPath;
|
||||
if( ChiliBook.elementClass ) {
|
||||
ChiliBook.codeLanguage = function ( el ) {
|
||||
var selectClass = new RegExp( "\\b" + ChiliBook.elementClass + "\\b", "gi" );
|
||||
var elClass = $( el ).attr( "class" );
|
||||
if( ! elClass ) {
|
||||
return '';
|
||||
}
|
||||
var recipeName = $.trim( elClass.replace( selectClass, "" ) );
|
||||
return recipeName;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$( ChiliBook.automaticSelector ).chili();
|
||||
}
|
||||
|
||||
if( ChiliBook.preFixCopy ) {
|
||||
function preformatted( text ) {
|
||||
if( '' == text ) {
|
||||
return "";
|
||||
}
|
||||
do {
|
||||
var newline_flag = (new Date()).valueOf();
|
||||
}
|
||||
while( text.indexOf( newline_flag ) > -1 );
|
||||
text = text.replace( /\<br[^>]*?\>/ig, newline_flag );
|
||||
var el = document.createElement( '<pre>' );
|
||||
el.innerHTML = text;
|
||||
text = el.innerText.replace( new RegExp( newline_flag, "g" ), '\r\n' );
|
||||
return text;
|
||||
}
|
||||
|
||||
$( "body" )
|
||||
.bind( "copy", function() {
|
||||
if( '' != ChiliBook.preContent ) {
|
||||
window.clipboardData.setData( 'Text', preformatted( ChiliBook.preContent ) );
|
||||
event.returnValue = false;
|
||||
}
|
||||
} )
|
||||
.bind( "mousedown", function() {
|
||||
ChiliBook.preContent = "";
|
||||
} )
|
||||
.bind( "mouseup", function() {
|
||||
ChiliBook.preElement = null;
|
||||
} )
|
||||
;
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} ) ( jQuery );
|
||||
// load progress bar
|
||||
myBar.loaded('chili.js');
|
71
xCAT-UI/js/config.js
Normal file
@ -0,0 +1,71 @@
|
||||
// Javascript functions needed by the db page.
|
||||
setTimeout("myBar.loaded('config.js')", 500);
|
||||
|
||||
// Make this class of elements editable
|
||||
function makeEditable(table, cellclass, imgclass, linkclass) {
|
||||
// Make all the cells editable
|
||||
//todo: figure out how to make the tab key commit the current cell and edit the next
|
||||
$(cellclass).editable('change.php?tab=' + table, {
|
||||
//indicator : "<img src='img/indicator.gif'>",
|
||||
indicator : "updating...",
|
||||
type : 'text',
|
||||
tooltip : 'Click to edit...',
|
||||
style : 'inherit',
|
||||
cssclass : 'inherit',
|
||||
placeholder : '',
|
||||
onblur : 'submit'
|
||||
// callback : function(value,settings) { alert(dump(settings)); }
|
||||
});
|
||||
|
||||
// Set up rollover and action for red x to delete row
|
||||
$(imgclass).hover(function() { $(this).attr('src','img/red-x2.gif'); },
|
||||
function() { $(this).attr('src','img/red-x2-light.gif'); }
|
||||
);
|
||||
$(linkclass).click(function() {
|
||||
var tr = $(this).parent().parent();
|
||||
var rowid = tr.attr('id');
|
||||
var match = rowid.match(/\d+/);
|
||||
$.get('change.php?tab=' + table + '&delrow=' + match[0]);
|
||||
tr.remove();
|
||||
});
|
||||
$('.editme').bind('keydown', function(event){
|
||||
if(event.keyCode==9) {
|
||||
$(this).find("input").blur();
|
||||
$(this).next(".editme").click();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Form a table row to add to the table
|
||||
function formRow(linenum, numCells, ooe) {
|
||||
var newrow = '<tr class=ListLine' + ooe + ' id=row' + linenum + '><td class=Xcell><a class=Xlink2 title="Delete row"><img class=Ximg2 src=img/red-x2-light.gif></a></td>';
|
||||
for (var i=0; i<numCells; i++) {
|
||||
var val = '';
|
||||
// if (i == 0) { val = 'x'; }
|
||||
newrow += '<td class=editme2 id="' + linenum + '-' + i + '">' + val + '</td>';
|
||||
}
|
||||
newrow += '</tr>';
|
||||
return newrow;
|
||||
}
|
||||
|
||||
|
||||
// Load edittab.php, specifying this table as a param
|
||||
function loadTable(table) {
|
||||
var url = 'config.php?t=' + table;
|
||||
$('#middlepane').load(url);
|
||||
}
|
||||
|
||||
|
||||
// Associate a click event with each table link to get its url (which is
|
||||
// the table name) and load edittab.php with that table name.
|
||||
function bindTableLinks() {
|
||||
$('#tableNames A').click(function(e) {
|
||||
var tableName = this.hash.substr(1); // strip off the leading # in the hash string
|
||||
loadTable(tableName);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
// load progress bar
|
||||
myBar.loaded('config.js');
|
87
xCAT-UI/js/hoverIntent.js
Normal file
@ -0,0 +1,87 @@
|
||||
(function($){
|
||||
/* hoverIntent by Brian Cherne */
|
||||
$.fn.hoverIntent = function(f,g) {
|
||||
// default configuration options
|
||||
var cfg = {
|
||||
sensitivity: 7,
|
||||
interval: 100,
|
||||
timeout: 0
|
||||
};
|
||||
// override configuration options with user supplied object
|
||||
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).unbind("mousemove",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = 1;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = 0;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
||||
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
||||
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
||||
if ( p == this ) { return false; }
|
||||
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
var ev = jQuery.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
|
||||
// else e.type == "onmouseover"
|
||||
if (e.type == "mouseover") {
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).bind("mousemove",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "onmouseout"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).unbind("mousemove",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// bind the function to the two event listeners
|
||||
return this.mouseover(handleHover).mouseout(handleHover);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
// load progress bar
|
||||
myBar.loaded('hoverIntent.js');
|
636
xCAT-UI/js/jquery-ui-all.min.js
vendored
Normal file
639
xCAT-UI/js/jquery.form.js
Normal file
@ -0,0 +1,639 @@
|
||||
/*
|
||||
* jQuery Form Plugin
|
||||
* version: 2.24 (10-MAR-2009)
|
||||
* @requires jQuery v1.2.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
/*
|
||||
Usage Note:
|
||||
-----------
|
||||
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
||||
functions are intended to be exclusive. Use ajaxSubmit if you want
|
||||
to bind your own submit handler to the form. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').bind('submit', function() {
|
||||
$(this).ajaxSubmit({
|
||||
target: '#output'
|
||||
});
|
||||
return false; // <-- important!
|
||||
});
|
||||
});
|
||||
|
||||
Use ajaxForm when you want the plugin to manage all the event binding
|
||||
for you. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').ajaxForm({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
|
||||
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
||||
at the appropriate time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for immediately submitting
|
||||
* an HTML form using AJAX.
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
||||
if (!this.length) {
|
||||
log('ajaxSubmit: skipping submit process - no element selected');
|
||||
return this;
|
||||
}
|
||||
|
||||
if (typeof options == 'function')
|
||||
options = { success: options };
|
||||
|
||||
// clean url (don't include hash vaue)
|
||||
var url = this.attr('action') || window.location.href;
|
||||
url = (url.match(/^([^#]+)/)||[])[1];
|
||||
url = url || '';
|
||||
|
||||
options = $.extend({
|
||||
url: url,
|
||||
type: this.attr('method') || 'GET'
|
||||
}, options || {});
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
// provide opportunity to alter form data before it is serialized
|
||||
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
var a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (var n in options.data) {
|
||||
if(options.data[n] instanceof Array) {
|
||||
for (var k in options.data[n])
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
else
|
||||
a.push( { name: n, value: options.data[n] } );
|
||||
}
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else
|
||||
options.data = q; // data is the query string for 'post'
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
||||
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
$(options.target).html(data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success)
|
||||
callbacks.push(options.success);
|
||||
|
||||
options.success = function(data, status) {
|
||||
for (var i=0, max=callbacks.length; i < max; i++)
|
||||
callbacks[i].apply(options, [data, status, $form]);
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var files = $('input:file', this).fieldValue();
|
||||
var found = false;
|
||||
for (var j=0; j < files.length; j++)
|
||||
if (files[j])
|
||||
found = true;
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
if (options.iframe || found) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if (options.closeKeepAlive)
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
else
|
||||
fileUpload();
|
||||
}
|
||||
else
|
||||
$.ajax(options);
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
|
||||
if ($(':input[name=submit]', form).length) {
|
||||
alert('Error: Form elements must not be named "submit".');
|
||||
return;
|
||||
}
|
||||
|
||||
var opts = $.extend({}, $.ajaxSettings, options);
|
||||
var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
|
||||
|
||||
var id = 'jqFormIO' + (new Date().getTime());
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
|
||||
var io = $io[0];
|
||||
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
aborted: 0,
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {},
|
||||
abort: function() {
|
||||
this.aborted = 1;
|
||||
$io.attr('src','about:blank'); // abort op in progress
|
||||
}
|
||||
};
|
||||
|
||||
var g = opts.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
||||
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
||||
|
||||
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
|
||||
s.global && jQuery.active--;
|
||||
return;
|
||||
}
|
||||
if (xhr.aborted)
|
||||
return;
|
||||
|
||||
var cbInvoked = 0;
|
||||
var timedOut = 0;
|
||||
|
||||
// add submitting element to data if we know it
|
||||
var sub = form.clk;
|
||||
if (sub) {
|
||||
var n = sub.name;
|
||||
if (n && !sub.disabled) {
|
||||
options.extraData = options.extraData || {};
|
||||
options.extraData[n] = sub.value;
|
||||
if (sub.type == "image") {
|
||||
options.extraData[name+'.x'] = form.clk_x;
|
||||
options.extraData[name+'.y'] = form.clk_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
setTimeout(function() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
|
||||
// update form attrs in IE friendly way
|
||||
form.setAttribute('target',id);
|
||||
if (form.getAttribute('method') != 'POST')
|
||||
form.setAttribute('method', 'POST');
|
||||
if (form.getAttribute('action') != opts.url)
|
||||
form.setAttribute('action', opts.url);
|
||||
|
||||
// ie borks in some cases when setting encoding
|
||||
if (! options.skipEncodingOverride) {
|
||||
$form.attr({
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data'
|
||||
});
|
||||
}
|
||||
|
||||
// support timout
|
||||
if (opts.timeout)
|
||||
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (options.extraData)
|
||||
for (var n in options.extraData)
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
form.setAttribute('action',a);
|
||||
t ? form.setAttribute('target', t) : $form.removeAttr('target');
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
var nullCheckFlag = 0;
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked++) return;
|
||||
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) throw 'timeout';
|
||||
// extract the server response from the iframe
|
||||
var data, doc;
|
||||
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
|
||||
if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
|
||||
// in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
|
||||
// the onload callback fires, so we give them a 2nd chance
|
||||
nullCheckFlag = 1;
|
||||
cbInvoked--;
|
||||
setTimeout(cb, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': opts.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
xhr.responseText = ta ? ta.value : xhr.responseText;
|
||||
}
|
||||
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
data = $.httpData(xhr, opts.dataType);
|
||||
}
|
||||
catch(e){
|
||||
ok = false;
|
||||
$.handleError(opts, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
opts.success(data, 'success');
|
||||
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
||||
}
|
||||
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
||||
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
||||
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself.
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
}).each(function() {
|
||||
// store options in hash
|
||||
$(":submit,input:image", this).bind('click.form-plugin',function(e) {
|
||||
var form = this.form;
|
||||
form.clk = this;
|
||||
if (this.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
form.clk_x = e.offsetX;
|
||||
form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $(this).offset();
|
||||
form.clk_x = e.pageX - offset.left;
|
||||
form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
form.clk_x = e.pageX - this.offsetLeft;
|
||||
form.clk_y = e.pageY - this.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
this.unbind('submit.form-plugin');
|
||||
return this.each(function() {
|
||||
$(":submit,input:image", this).unbind('click.form-plugin');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length == 0) return a;
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
continue;
|
||||
}
|
||||
|
||||
var v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle them here
|
||||
var inputs = form.getElementsByTagName("input");
|
||||
for(var i=0, max=inputs.length; i < max; i++) {
|
||||
var input = inputs[i];
|
||||
var n = input.name;
|
||||
if(n && !input.disabled && input.type == "image" && form.clk == input)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) return;
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++)
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: this.name, value: v});
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
||||
continue;
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
var v = op.value;
|
||||
if (!v) // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea')
|
||||
this.value = '';
|
||||
else if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = false;
|
||||
else if (tag == 'select')
|
||||
this.selectedIndex = -1;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b == undefined) b = true;
|
||||
return this.each(function() {
|
||||
this.disabled = !b;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*/
|
||||
$.fn.selected = function(select) {
|
||||
if (select == undefined) select = true;
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = select;
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').selected(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// helper fn for console logging
|
||||
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
||||
function log() {
|
||||
if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
|
||||
window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
// load progress bar
|
||||
myBar.loaded('jquery.form.js');
|
32
xCAT-UI/js/jquery.jeditable.mini.js
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
(function($){$.fn.editable=function(target,options){var settings={target:target,name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{}};if(options){$.extend(settings,options);}
|
||||
var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};if(!$.isFunction($(this)[settings.event])){$.fn[settings.event]=function(fn){return fn?this.bind(settings.event,fn):this.trigger(settings.event);}}
|
||||
$(this).attr('title',settings.tooltip);settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
|
||||
$(this)[settings.event](function(e){if(self.editing){return;}
|
||||
if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
|
||||
if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
|
||||
if($(this).html().toLowerCase().replace(/;/,'')==settings.placeholder.toLowerCase().replace(/;/,'')){$(this).html('');}
|
||||
self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('<form/>');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
|
||||
if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
|
||||
var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
|
||||
$.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
|
||||
content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
|
||||
input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){form.submit();});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
|
||||
form.submit(function(e){if(t){clearTimeout(t);}
|
||||
e.preventDefault();if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
|
||||
if('PUT'==settings.method){submitdata['_method']='put';}
|
||||
$(self).html(settings.indicator);$.post(settings.target,submitdata,function(str){$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}});}}
|
||||
return false;});});this.reset=function(){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}});};$.editable={types:{defaults:{element:function(settings,original){var input=$('<input type="hidden">');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset();},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('<button type="submit">');submit.html(settings.submit);}
|
||||
$(this).append(submit);}
|
||||
if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('<button type="cancel">');cancel.html(settings.cancel);}
|
||||
$(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
|
||||
reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('<input>');if(settings.width!='none'){input.width(settings.width);}
|
||||
if(settings.height!='none'){input.height(settings.height);}
|
||||
input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('<textarea>');if(settings.rows){textarea.attr('rows',settings.rows);}else{textarea.height(settings.height);}
|
||||
if(settings.cols){textarea.attr('cols',settings.cols);}else{textarea.width(settings.width);}
|
||||
$(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('<select>');$(this).append(select);return(select);},content:function(string,settings,original){if(String==string.constructor){eval('var json = '+string);for(var key in json){if(!json.hasOwnProperty(key)){continue;}
|
||||
if('selected'==key){continue;}
|
||||
var option=$('<option>').val(key).append(json[key]);$('select',this).append(option);}}
|
||||
$('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==original.revert){$(this).attr('selected','selected');};});}}},addInputType:function(name,input){$.editable.types[name]=input;}};})(jQuery);
|
||||
// load progress bar
|
||||
myBar.loaded('jquery.jeditable.mini.js');
|
35
xCAT-UI/js/jquery.min.js
vendored
Normal file
854
xCAT-UI/js/jquery.tablesorter.js
Normal file
@ -0,0 +1,854 @@
|
||||
/*
|
||||
*
|
||||
* TableSorter 2.0 - Client-side table sorting with ease!
|
||||
* Version 2.0.3
|
||||
* @requires jQuery v1.2.3
|
||||
*
|
||||
* Copyright (c) 2007 Christian Bach
|
||||
* Examples and docs at: http://tablesorter.com
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @description Create a sortable table with multi-column sorting capabilitys
|
||||
*
|
||||
* @example $('table').tablesorter();
|
||||
* @desc Create a simple tablesorter interface.
|
||||
*
|
||||
* @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
|
||||
* @desc Create a tablesorter interface and sort on the first and secound column in ascending order.
|
||||
*
|
||||
* @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
|
||||
* @desc Create a tablesorter interface and disableing the first and secound column headers.
|
||||
*
|
||||
* @example $('table').tablesorter({ 0: {sorter:"integer"}, 1: {sorter:"currency"} });
|
||||
* @desc Create a tablesorter interface and set a column parser for the first and secound column.
|
||||
*
|
||||
*
|
||||
* @param Object settings An object literal containing key/value pairs to provide optional settings.
|
||||
*
|
||||
* @option String cssHeader (optional) A string of the class name to be appended to sortable tr elements in the thead of the table.
|
||||
* Default value: "header"
|
||||
*
|
||||
* @option String cssAsc (optional) A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.
|
||||
* Default value: "headerSortUp"
|
||||
*
|
||||
* @option String cssDesc (optional) A string of the class name to be appended to sortable tr elements in the thead on a descending sort.
|
||||
* Default value: "headerSortDown"
|
||||
*
|
||||
* @option String sortInitialOrder (optional) A string of the inital sorting order can be asc or desc.
|
||||
* Default value: "asc"
|
||||
*
|
||||
* @option String sortMultisortKey (optional) A string of the multi-column sort key.
|
||||
* Default value: "shiftKey"
|
||||
*
|
||||
* @option String textExtraction (optional) A string of the text-extraction method to use.
|
||||
* For complex html structures inside td cell set this option to "complex",
|
||||
* on large tables the complex option can be slow.
|
||||
* Default value: "simple"
|
||||
*
|
||||
* @option Object headers (optional) An array containing the forces sorting rules.
|
||||
* This option let's you specify a default sorting rule.
|
||||
* Default value: null
|
||||
*
|
||||
* @option Array sortList (optional) An array containing the forces sorting rules.
|
||||
* This option let's you specify a default sorting rule.
|
||||
* Default value: null
|
||||
*
|
||||
* @option Array sortForce (optional) An array containing forced sorting rules.
|
||||
* This option let's you specify a default sorting rule, which is prepended to user-selected rules.
|
||||
* Default value: null
|
||||
*
|
||||
* @option Array sortAppend (optional) An array containing forced sorting rules.
|
||||
* This option let's you specify a default sorting rule, which is appended to user-selected rules.
|
||||
* Default value: null
|
||||
*
|
||||
* @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter should apply fixed widths to the table columns.
|
||||
* This is usefull when using the pager companion plugin.
|
||||
* This options requires the dimension jquery plugin.
|
||||
* Default value: false
|
||||
*
|
||||
* @option Boolean cancelSelection (optional) Boolean flag indicating if tablesorter should cancel selection of the table headers text.
|
||||
* Default value: true
|
||||
*
|
||||
* @option Boolean debug (optional) Boolean flag indicating if tablesorter should display debuging information usefull for development.
|
||||
*
|
||||
* @type jQuery
|
||||
*
|
||||
* @name tablesorter
|
||||
*
|
||||
* @cat Plugins/Tablesorter
|
||||
*
|
||||
* @author Christian Bach/christian.bach@polyester.se
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.extend({
|
||||
tablesorter: new function() {
|
||||
|
||||
var parsers = [], widgets = [];
|
||||
|
||||
this.defaults = {
|
||||
cssHeader: "header",
|
||||
cssAsc: "headerSortUp",
|
||||
cssDesc: "headerSortDown",
|
||||
sortInitialOrder: "asc",
|
||||
sortMultiSortKey: "shiftKey",
|
||||
sortForce: null,
|
||||
sortAppend: null,
|
||||
textExtraction: "simple",
|
||||
parsers: {},
|
||||
widgets: [],
|
||||
widgetZebra: {css: ["even","odd"]},
|
||||
headers: {},
|
||||
widthFixed: false,
|
||||
cancelSelection: true,
|
||||
sortList: [],
|
||||
headerList: [],
|
||||
dateFormat: "us",
|
||||
decimal: '.',
|
||||
debug: false
|
||||
};
|
||||
|
||||
/* debuging utils */
|
||||
function benchmark(s,d) {
|
||||
log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
|
||||
}
|
||||
|
||||
this.benchmark = benchmark;
|
||||
|
||||
function log(s) {
|
||||
if (typeof console != "undefined" && typeof console.debug != "undefined") {
|
||||
console.log(s);
|
||||
} else {
|
||||
alert(s);
|
||||
}
|
||||
}
|
||||
|
||||
/* parsers utils */
|
||||
function buildParserCache(table,$headers) {
|
||||
|
||||
if(table.config.debug) { var parsersDebug = ""; }
|
||||
|
||||
var rows = table.tBodies[0].rows;
|
||||
|
||||
if(table.tBodies[0].rows[0]) {
|
||||
|
||||
var list = [], cells = rows[0].cells, l = cells.length;
|
||||
|
||||
for (var i=0;i < l; i++) {
|
||||
var p = false;
|
||||
|
||||
if($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter) ) {
|
||||
|
||||
p = getParserById($($headers[i]).metadata().sorter);
|
||||
|
||||
} else if((table.config.headers[i] && table.config.headers[i].sorter)) {
|
||||
|
||||
p = getParserById(table.config.headers[i].sorter);
|
||||
}
|
||||
if(!p) {
|
||||
p = detectParserForColumn(table,cells[i]);
|
||||
}
|
||||
|
||||
if(table.config.debug) { parsersDebug += "column:" + i + " parser:" +p.id + "\n"; }
|
||||
|
||||
list.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
if(table.config.debug) { log(parsersDebug); }
|
||||
|
||||
return list;
|
||||
};
|
||||
|
||||
function detectParserForColumn(table,node) {
|
||||
var l = parsers.length;
|
||||
for(var i=1; i < l; i++) {
|
||||
if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)) {
|
||||
return parsers[i];
|
||||
}
|
||||
}
|
||||
// 0 is always the generic parser (text)
|
||||
return parsers[0];
|
||||
}
|
||||
|
||||
function getParserById(name) {
|
||||
var l = parsers.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
if(parsers[i].id.toLowerCase() == name.toLowerCase()) {
|
||||
return parsers[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* utils */
|
||||
function buildCache(table) {
|
||||
|
||||
if(table.config.debug) { var cacheTime = new Date(); }
|
||||
|
||||
|
||||
var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
|
||||
totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
|
||||
parsers = table.config.parsers,
|
||||
cache = {row: [], normalized: []};
|
||||
|
||||
for (var i=0;i < totalRows; ++i) {
|
||||
|
||||
/** Add the table data to main data array */
|
||||
var c = table.tBodies[0].rows[i], cols = [];
|
||||
|
||||
cache.row.push($(c));
|
||||
|
||||
for(var j=0; j < totalCells; ++j) {
|
||||
cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));
|
||||
}
|
||||
|
||||
cols.push(i); // add position for rowCache
|
||||
cache.normalized.push(cols);
|
||||
cols = null;
|
||||
};
|
||||
|
||||
if(table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); }
|
||||
|
||||
return cache;
|
||||
};
|
||||
|
||||
function getElementText(config,node) {
|
||||
|
||||
if(!node) return "";
|
||||
|
||||
var t = "";
|
||||
|
||||
if(config.textExtraction == "simple") {
|
||||
if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
|
||||
t = node.childNodes[0].innerHTML;
|
||||
} else {
|
||||
t = node.innerHTML;
|
||||
}
|
||||
} else {
|
||||
if(typeof(config.textExtraction) == "function") {
|
||||
t = config.textExtraction(node);
|
||||
} else {
|
||||
t = $(node).text();
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function appendToTable(table,cache) {
|
||||
|
||||
if(table.config.debug) {var appendTime = new Date()}
|
||||
|
||||
var c = cache,
|
||||
r = c.row,
|
||||
n= c.normalized,
|
||||
totalRows = n.length,
|
||||
checkCell = (n[0].length-1),
|
||||
tableBody = $(table.tBodies[0]),
|
||||
rows = [];
|
||||
|
||||
for (var i=0;i < totalRows; i++) {
|
||||
rows.push(r[n[i][checkCell]]);
|
||||
if(!table.config.appender) {
|
||||
|
||||
var o = r[n[i][checkCell]];
|
||||
var l = o.length;
|
||||
for(var j=0; j < l; j++) {
|
||||
|
||||
tableBody[0].appendChild(o[j]);
|
||||
|
||||
}
|
||||
|
||||
//tableBody.append(r[n[i][checkCell]]);
|
||||
}
|
||||
}
|
||||
|
||||
if(table.config.appender) {
|
||||
|
||||
table.config.appender(table,rows);
|
||||
}
|
||||
|
||||
rows = null;
|
||||
|
||||
if(table.config.debug) { benchmark("Rebuilt table:", appendTime); }
|
||||
|
||||
//apply table widgets
|
||||
applyWidget(table);
|
||||
|
||||
// trigger sortend
|
||||
setTimeout(function() {
|
||||
$(table).trigger("sortEnd");
|
||||
},0);
|
||||
|
||||
};
|
||||
|
||||
function buildHeaders(table) {
|
||||
|
||||
if(table.config.debug) { var time = new Date(); }
|
||||
|
||||
var meta = ($.metadata) ? true : false, tableHeadersRows = [];
|
||||
|
||||
for(var i = 0; i < table.tHead.rows.length; i++) { tableHeadersRows[i]=0; };
|
||||
|
||||
$tableHeaders = $("thead th",table);
|
||||
|
||||
$tableHeaders.each(function(index) {
|
||||
|
||||
this.count = 0;
|
||||
this.column = index;
|
||||
this.order = formatSortingOrder(table.config.sortInitialOrder);
|
||||
|
||||
if(checkHeaderMetadata(this) || checkHeaderOptions(table,index)) this.sortDisabled = true;
|
||||
|
||||
if(!this.sortDisabled) {
|
||||
$(this).addClass(table.config.cssHeader);
|
||||
}
|
||||
|
||||
// add cell to headerList
|
||||
table.config.headerList[index]= this;
|
||||
});
|
||||
|
||||
if(table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); }
|
||||
|
||||
return $tableHeaders;
|
||||
|
||||
};
|
||||
|
||||
function checkCellColSpan(table, rows, row) {
|
||||
var arr = [], r = table.tHead.rows, c = r[row].cells;
|
||||
|
||||
for(var i=0; i < c.length; i++) {
|
||||
var cell = c[i];
|
||||
|
||||
if ( cell.colSpan > 1) {
|
||||
arr = arr.concat(checkCellColSpan(table, headerArr,row++));
|
||||
} else {
|
||||
if(table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row+1])) {
|
||||
arr.push(cell);
|
||||
}
|
||||
//headerArr[row] = (i+row);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
function checkHeaderMetadata(cell) {
|
||||
if(($.metadata) && ($(cell).metadata().sorter === false)) { return true; };
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkHeaderOptions(table,i) {
|
||||
if((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; };
|
||||
return false;
|
||||
}
|
||||
|
||||
function applyWidget(table) {
|
||||
var c = table.config.widgets;
|
||||
var l = c.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
|
||||
getWidgetById(c[i]).format(table);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getWidgetById(name) {
|
||||
var l = widgets.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
if(widgets[i].id.toLowerCase() == name.toLowerCase() ) {
|
||||
return widgets[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function formatSortingOrder(v) {
|
||||
|
||||
if(typeof(v) != "Number") {
|
||||
i = (v.toLowerCase() == "desc") ? 1 : 0;
|
||||
} else {
|
||||
i = (v == (0 || 1)) ? v : 0;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
function isValueInArray(v, a) {
|
||||
var l = a.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
if(a[i][0] == v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function setHeadersCss(table,$headers, list, css) {
|
||||
// remove all header information
|
||||
$headers.removeClass(css[0]).removeClass(css[1]);
|
||||
|
||||
var h = [];
|
||||
$headers.each(function(offset) {
|
||||
if(!this.sortDisabled) {
|
||||
h[this.column] = $(this);
|
||||
}
|
||||
});
|
||||
|
||||
var l = list.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
h[list[i][0]].addClass(css[list[i][1]]);
|
||||
}
|
||||
}
|
||||
|
||||
function fixColumnWidth(table,$headers) {
|
||||
var c = table.config;
|
||||
if(c.widthFixed) {
|
||||
var colgroup = $('<colgroup>');
|
||||
$("tr:first td",table.tBodies[0]).each(function() {
|
||||
colgroup.append($('<col>').css('width',$(this).width()));
|
||||
});
|
||||
$(table).prepend(colgroup);
|
||||
};
|
||||
}
|
||||
|
||||
function updateHeaderSortCount(table,sortList) {
|
||||
var c = table.config, l = sortList.length;
|
||||
for(var i=0; i < l; i++) {
|
||||
var s = sortList[i], o = c.headerList[s[0]];
|
||||
o.count = s[1];
|
||||
o.count++;
|
||||
}
|
||||
}
|
||||
|
||||
/* sorting methods */
|
||||
function multisort(table,sortList,cache) {
|
||||
|
||||
if(table.config.debug) { var sortTime = new Date(); }
|
||||
|
||||
var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
|
||||
|
||||
for(var i=0; i < l; i++) {
|
||||
|
||||
var c = sortList[i][0];
|
||||
var order = sortList[i][1];
|
||||
var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc");
|
||||
|
||||
var e = "e" + i;
|
||||
|
||||
dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); ";
|
||||
dynamicExp += "if(" + e + ") { return " + e + "; } ";
|
||||
dynamicExp += "else { ";
|
||||
}
|
||||
|
||||
// if value is the same keep orignal order
|
||||
var orgOrderCol = cache.normalized[0].length - 1;
|
||||
dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
|
||||
|
||||
for(var i=0; i < l; i++) {
|
||||
dynamicExp += "}; ";
|
||||
}
|
||||
|
||||
dynamicExp += "return 0; ";
|
||||
dynamicExp += "}; ";
|
||||
|
||||
eval(dynamicExp);
|
||||
|
||||
cache.normalized.sort(sortWrapper);
|
||||
|
||||
if(table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); }
|
||||
|
||||
return cache;
|
||||
};
|
||||
|
||||
function sortText(a,b) {
|
||||
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
||||
};
|
||||
|
||||
function sortTextDesc(a,b) {
|
||||
return ((b < a) ? -1 : ((b > a) ? 1 : 0));
|
||||
};
|
||||
|
||||
function sortNumeric(a,b) {
|
||||
return a-b;
|
||||
};
|
||||
|
||||
function sortNumericDesc(a,b) {
|
||||
return b-a;
|
||||
};
|
||||
|
||||
function getCachedSortType(parsers,i) {
|
||||
return parsers[i].type;
|
||||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function(settings) {
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
if(!this.tHead || !this.tBodies) return;
|
||||
|
||||
var $this, $document,$headers, cache, config, shiftDown = 0, sortOrder;
|
||||
|
||||
this.config = {};
|
||||
|
||||
config = $.extend(this.config, $.tablesorter.defaults, settings);
|
||||
|
||||
// store common expression for speed
|
||||
$this = $(this);
|
||||
|
||||
// build headers
|
||||
$headers = buildHeaders(this);
|
||||
|
||||
// try to auto detect column type, and store in tables config
|
||||
this.config.parsers = buildParserCache(this,$headers);
|
||||
|
||||
|
||||
// build the cache for the tbody cells
|
||||
cache = buildCache(this);
|
||||
|
||||
// get the css class names, could be done else where.
|
||||
var sortCSS = [config.cssDesc,config.cssAsc];
|
||||
|
||||
// fixate columns if the users supplies the fixedWidth option
|
||||
fixColumnWidth(this);
|
||||
|
||||
// apply event handling to headers
|
||||
// this is to big, perhaps break it out?
|
||||
$headers.click(function(e) {
|
||||
|
||||
$this.trigger("sortStart");
|
||||
|
||||
var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
|
||||
|
||||
if(!this.sortDisabled && totalRows > 0) {
|
||||
|
||||
|
||||
// store exp, for speed
|
||||
var $cell = $(this);
|
||||
|
||||
// get current column index
|
||||
var i = this.column;
|
||||
|
||||
// get current column sort order
|
||||
this.order = this.count++ % 2;
|
||||
|
||||
// user only whants to sort on one column
|
||||
if(!e[config.sortMultiSortKey]) {
|
||||
|
||||
// flush the sort list
|
||||
config.sortList = [];
|
||||
|
||||
if(config.sortForce != null) {
|
||||
var a = config.sortForce;
|
||||
for(var j=0; j < a.length; j++) {
|
||||
if(a[j][0] != i) {
|
||||
config.sortList.push(a[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add column to sort list
|
||||
config.sortList.push([i,this.order]);
|
||||
|
||||
// multi column sorting
|
||||
} else {
|
||||
// the user has clicked on an all ready sortet column.
|
||||
if(isValueInArray(i,config.sortList)) {
|
||||
|
||||
// revers the sorting direction for all tables.
|
||||
for(var j=0; j < config.sortList.length; j++) {
|
||||
var s = config.sortList[j], o = config.headerList[s[0]];
|
||||
if(s[0] == i) {
|
||||
o.count = s[1];
|
||||
o.count++;
|
||||
s[1] = o.count % 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// add column to sort list array
|
||||
config.sortList.push([i,this.order]);
|
||||
}
|
||||
};
|
||||
setTimeout(function() {
|
||||
//set css for headers
|
||||
setHeadersCss($this[0],$headers,config.sortList,sortCSS);
|
||||
appendToTable($this[0],multisort($this[0],config.sortList,cache));
|
||||
},1);
|
||||
// stop normal event by returning false
|
||||
return false;
|
||||
}
|
||||
// cancel selection
|
||||
}).mousedown(function() {
|
||||
if(config.cancelSelection) {
|
||||
this.onselectstart = function() {return false};
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// apply easy methods that trigger binded events
|
||||
$this.bind("update",function() {
|
||||
|
||||
// rebuild parsers.
|
||||
this.config.parsers = buildParserCache(this,$headers);
|
||||
|
||||
// rebuild the cache map
|
||||
cache = buildCache(this);
|
||||
|
||||
}).bind("sorton",function(e,list) {
|
||||
|
||||
$(this).trigger("sortStart");
|
||||
|
||||
config.sortList = list;
|
||||
|
||||
// update and store the sortlist
|
||||
var sortList = config.sortList;
|
||||
|
||||
// update header count index
|
||||
updateHeaderSortCount(this,sortList);
|
||||
|
||||
//set css for headers
|
||||
setHeadersCss(this,$headers,sortList,sortCSS);
|
||||
|
||||
|
||||
// sort the table and append it to the dom
|
||||
appendToTable(this,multisort(this,sortList,cache));
|
||||
|
||||
}).bind("appendCache",function() {
|
||||
|
||||
appendToTable(this,cache);
|
||||
|
||||
}).bind("applyWidgetId",function(e,id) {
|
||||
|
||||
getWidgetById(id).format(this);
|
||||
|
||||
}).bind("applyWidgets",function() {
|
||||
// apply widgets
|
||||
applyWidget(this);
|
||||
});
|
||||
|
||||
if($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
|
||||
config.sortList = $(this).metadata().sortlist;
|
||||
}
|
||||
// if user has supplied a sort list to constructor.
|
||||
if(config.sortList.length > 0) {
|
||||
$this.trigger("sorton",[config.sortList]);
|
||||
}
|
||||
|
||||
// apply widgets
|
||||
applyWidget(this);
|
||||
});
|
||||
};
|
||||
|
||||
this.addParser = function(parser) {
|
||||
var l = parsers.length, a = true;
|
||||
for(var i=0; i < l; i++) {
|
||||
if(parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
|
||||
a = false;
|
||||
}
|
||||
}
|
||||
if(a) { parsers.push(parser); };
|
||||
};
|
||||
|
||||
this.addWidget = function(widget) {
|
||||
widgets.push(widget);
|
||||
};
|
||||
|
||||
this.formatFloat = function(s) {
|
||||
var i = parseFloat(s);
|
||||
return (isNaN(i)) ? 0 : i;
|
||||
};
|
||||
this.formatInt = function(s) {
|
||||
var i = parseInt(s);
|
||||
return (isNaN(i)) ? 0 : i;
|
||||
};
|
||||
|
||||
this.isDigit = function(s,config) {
|
||||
var DECIMAL = '\\' + config.decimal;
|
||||
var exp = '/(^[+]?0(' + DECIMAL +'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)' + DECIMAL +'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*' + DECIMAL +'0+$)/';
|
||||
return RegExp(exp).test($.trim(s));
|
||||
};
|
||||
|
||||
this.clearTableBody = function(table) {
|
||||
if($.browser.msie) {
|
||||
function empty() {
|
||||
while ( this.firstChild ) this.removeChild( this.firstChild );
|
||||
}
|
||||
empty.apply(table.tBodies[0]);
|
||||
} else {
|
||||
table.tBodies[0].innerHTML = "";
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// extend plugin scope
|
||||
$.fn.extend({
|
||||
tablesorter: $.tablesorter.construct
|
||||
});
|
||||
|
||||
var ts = $.tablesorter;
|
||||
|
||||
// add default parsers
|
||||
ts.addParser({
|
||||
id: "text",
|
||||
is: function(s) {
|
||||
return true;
|
||||
},
|
||||
format: function(s) {
|
||||
return $.trim(s.toLowerCase());
|
||||
},
|
||||
type: "text"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "digit",
|
||||
is: function(s,table) {
|
||||
var c = table.config;
|
||||
return $.tablesorter.isDigit(s,c);
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat(s);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "currency",
|
||||
is: function(s) {
|
||||
return /^[£$€?.]/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "ipAddress",
|
||||
is: function(s) {
|
||||
return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
var a = s.split("."), r = "", l = a.length;
|
||||
for(var i = 0; i < l; i++) {
|
||||
var item = a[i];
|
||||
if(item.length == 2) {
|
||||
r += "0" + item;
|
||||
} else {
|
||||
r += item;
|
||||
}
|
||||
}
|
||||
return $.tablesorter.formatFloat(r);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "url",
|
||||
is: function(s) {
|
||||
return /^(https?|ftp|file):\/\/$/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));
|
||||
},
|
||||
type: "text"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "isoDate",
|
||||
is: function(s) {
|
||||
return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g),"/")).getTime() : "0");
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "percent",
|
||||
is: function(s) {
|
||||
return /\%$/.test($.trim(s));
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "usLongDate",
|
||||
is: function(s) {
|
||||
return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat(new Date(s).getTime());
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "shortDate",
|
||||
is: function(s) {
|
||||
return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
|
||||
},
|
||||
format: function(s,table) {
|
||||
var c = table.config;
|
||||
s = s.replace(/\-/g,"/");
|
||||
if(c.dateFormat == "us") {
|
||||
// reformat the string in ISO format
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
|
||||
} else if(c.dateFormat == "uk") {
|
||||
//reformat the string in ISO format
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
|
||||
} else if(c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
|
||||
}
|
||||
return $.tablesorter.formatFloat(new Date(s).getTime());
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "time",
|
||||
is: function(s) {
|
||||
return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
|
||||
ts.addParser({
|
||||
id: "metadata",
|
||||
is: function(s) {
|
||||
return false;
|
||||
},
|
||||
format: function(s,table,cell) {
|
||||
var c = table.config, p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
|
||||
return $(cell).metadata()[p];
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
// add default widgets
|
||||
ts.addWidget({
|
||||
id: "zebra",
|
||||
format: function(table) {
|
||||
if(table.config.debug) { var time = new Date(); }
|
||||
$("tr:visible",table.tBodies[0])
|
||||
.filter(':even')
|
||||
.removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0])
|
||||
.end().filter(':odd')
|
||||
.removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
|
||||
if(table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); }
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
// load progress bar
|
||||
myBar.loaded('jquery.tablesorter.js');
|
35
xCAT-UI/js/jsTree/css.js
Normal file
@ -0,0 +1,35 @@
|
||||
function get_css(rule_name, stylesheet, delete_flag) {
|
||||
if (!document.styleSheets) return false;
|
||||
rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
|
||||
for (var i = stylesheet; i < document.styleSheets.length; i++) {
|
||||
var styleSheet = document.styleSheets[i]; css_rules = document.styleSheets[i].cssRules || document.styleSheets[i].rules;
|
||||
if(!css_rules) continue;
|
||||
var j = 0;
|
||||
do {
|
||||
if(css_rules[j].selectorText.toLowerCase() == rule_name) {
|
||||
if(delete_flag == true) {
|
||||
if(document.styleSheets[i].removeRule) document.styleSheets[i].removeRule(j);
|
||||
if(document.styleSheets[i].deleteRule) document.styleSheets[i].deleteRule(j);
|
||||
return true;
|
||||
}
|
||||
else return css_rules[j];
|
||||
}
|
||||
}
|
||||
while (css_rules[++j]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function add_css(rule_name, stylesheet) {
|
||||
if (!document.styleSheets || get_css(rule_name)) return false;
|
||||
rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
|
||||
(document.styleSheets[stylesheet].addRule) ? document.styleSheets[stylesheet].addRule(rule_name, null, 0) : document.styleSheets[stylesheet].insertRule(rule_name+' { }', 0);
|
||||
return get_css(rule_name);
|
||||
}
|
||||
function get_sheet_num (href_name) {
|
||||
if (!document.styleSheets) return false;
|
||||
for (var i = 0; i < document.styleSheets.length; i++) { if(document.styleSheets[i].href && document.styleSheets[i].href.toString().match(href_name)) return i; }
|
||||
return false;
|
||||
}
|
||||
function remove_css(rule_name, stylesheet) { return get_css(rule_name, stylesheet, true); }
|
||||
// load progress bar
|
||||
myBar.loaded('jsTree/css.js');
|
70
xCAT-UI/js/jsTree/flat.xsl
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml
|
||||
version="1.0"
|
||||
encoding="utf-8"
|
||||
?>
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
>
|
||||
<xsl:output
|
||||
method="html"
|
||||
encoding="utf-8"
|
||||
omit-xml-declaration="yes"
|
||||
standalone="no"
|
||||
indent="no"
|
||||
media-type="text/xml"
|
||||
/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<ul>
|
||||
<xsl:for-each select="//item[not(@parent_id) or @parent_id=0]">
|
||||
<xsl:call-template name="nodes">
|
||||
<xsl:with-param name="node" select="." />
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="nodes">
|
||||
<xsl:param name="node" />
|
||||
<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />
|
||||
|
||||
<li>
|
||||
<xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
|
||||
<xsl:attribute name="rel"><xsl:value-of select="@type" /></xsl:attribute>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:if test="position() = last()"> last </xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@state = 'open'"> open </xsl:when>
|
||||
<xsl:when test="$children or @hasChildren"> closed </xsl:when>
|
||||
<xsl:otherwise> leaf </xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:attribute>
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:if test="name() != 'id' and name() != 'class'">
|
||||
<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="content/name">
|
||||
<a href="#">
|
||||
<xsl:attribute name="class"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="style">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(attribute::icon) > 0">background-image:url(<xsl:value-of select="@icon" />);</xsl:when>
|
||||
<xsl:otherwise></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute><xsl:value-of select="." /></a>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="$children or @hasChildren">
|
||||
<ul>
|
||||
<xsl:for-each select="//item[@parent_id=$node/attribute::id]">
|
||||
<xsl:call-template name="nodes">
|
||||
<xsl:with-param name="node" select="." />
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
BIN
xCAT-UI/js/jsTree/images/dot.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
xCAT-UI/js/jsTree/images/fminus.gif
Normal file
After Width: | Height: | Size: 60 B |
BIN
xCAT-UI/js/jsTree/images/fminus_rtl.gif
Normal file
After Width: | Height: | Size: 59 B |
BIN
xCAT-UI/js/jsTree/images/fplus.gif
Normal file
After Width: | Height: | Size: 108 B |
BIN
xCAT-UI/js/jsTree/images/fplus_rtl.gif
Normal file
After Width: | Height: | Size: 108 B |
BIN
xCAT-UI/js/jsTree/images/lastli.gif
Normal file
After Width: | Height: | Size: 55 B |
BIN
xCAT-UI/js/jsTree/images/lastli_rtl.gif
Normal file
After Width: | Height: | Size: 54 B |