merged from 1.9 :: MDL-13648 :: several enhancements/changes due to the discussion in the Moodle tracker:
_ changed the README - Custom corners is now experimental _ styles_colors from standard included - all the usabilty work using colors will automatically show up in Custom corners too _ optimized the JavaScript which adds the necessary layouttable classes to the body tag _ Chameleon engine removed - developers throw in CSS at the end without caring if the Chameleon engine can handle it
@ -1,32 +1,17 @@
|
||||
<h3>"Custom corners", the Moodle theme with graphics for transparent custom corners and borders.</h3>
|
||||
|
||||
<p>Custom corners use the technique from Roger Johansson. He describes how to build the graphices on his page "<a href="http://www.456bereastreet.com/archive/200506/customising_custom_corners_and_borders/">customising_custom_corners_and_borders</a>"</p>
|
||||
|
||||
<p>The Moodle implementation does not use JavaScript as described in Roger Johansson's documentation. Moodle adds all neccessary divs to the pages when the option "$THEME->customcorners = true;" is set in config.php.</p>
|
||||
|
||||
<h4>
|
||||
Some basic information:
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
Custom_corners uses the Chameleon engine.
|
||||
You must <strong>not</strong> write hooks as comma separated lists of elements like
|
||||
<pre>
|
||||
td#middle-column div.bt,
|
||||
div#middle-column div.bt {
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
in Chameleon enhanced themes because the Chameleon engine can't handle these comma lists.
|
||||
Please write two seperate statements instead.
|
||||
<pre>
|
||||
td#middle-column div.bt {
|
||||
...
|
||||
}
|
||||
div#middle-column div.bt {
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
This theme contains graphics for customising corners and borders. It makes use of a technique described by
|
||||
Roger Johansson - see
|
||||
"<a href="http://www.456bereastreet.com/archive/200506/customising_custom_corners_and_borders/">customising_custom_corners_and_borders</a>"
|
||||
However, the custom corners theme doesn't use all the JavaScript mentioned by Roger Johansson.
|
||||
Instead, divs are added when "$THEME->customcorners = true;" is set in config.php.
|
||||
</p>
|
||||
|
||||
<p>A Moodle Theme from <strong>Urs Hunkler, <a href="http://www.unodo.de">unodo</a></strong>.</p>
|
||||
<p>
|
||||
Note: Custom corners is included in Moodle 1.9 as an experimental feature.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Custom corners was created by <strong>Urs Hunkler, <a href="http://www.unodo.de">unodo</a></strong>.
|
||||
</p>
|
@ -11,7 +11,7 @@ $THEME->sheets = array('user_styles');
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
$THEME->standardsheets = array('styles_layout');
|
||||
$THEME->standardsheets = array('styles_layout', 'styles_color');
|
||||
|
||||
/// This variable can be set to an array containing
|
||||
/// filenames from the *STANDARD* theme. If the
|
||||
|
@ -7,7 +7,6 @@
|
||||
<link rel="shortcut icon" href="<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/favicon.ico" />
|
||||
|
||||
<?php
|
||||
include($CFG->themedir.'/custom_corners/ui/chameleon.php');
|
||||
include("$CFG->javascript");
|
||||
include($CFG->themedir.'/custom_corners/js/js.php');
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
|
||||
var CSSClass={};CSSClass.is=function(e,c){if(typeof e=="string")e=document.getElementById(e);var classes=e.className;if(!classes)return false;if(classes==c)return true;return e.className.search("\\b"+c+"\\b")!=-1;};CSSClass.add=function(e,c){if(typeof e=="string")e=document.getElementById(e);if(CSSClass.is(e,c))return;if(e.className)c=" "+c;e.className+=c;};CSSClass.remove=function(e,c){if(typeof e=="string")e=document.getElementById(e);e.className=e.className.replace(new RegExp("\\b"+c+"\\b\\s*","g"),"");};
|
@ -1,15 +1,14 @@
|
||||
<script src="<?php echo $CFG->httpsthemewww ?>/custom_corners/js/CSSClass_min.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
/* <![CDATA[ */
|
||||
var CSSClass={};CSSClass.is=function(e,c){if(typeof e=="string")e=document.getElementById(e);var classes=e.className;if(!classes)return false;if(classes==c)return true;return e.className.search("\\b"+c+"\\b")!=-1;};CSSClass.add=function(e,c){if(typeof e=="string")e=document.getElementById(e);if(CSSClass.is(e,c))return;if(e.className)c=" "+c;e.className+=c;};CSSClass.remove=function(e,c){if(typeof e=="string")e=document.getElementById(e);e.className=e.className.replace(new RegExp("\\b"+c+"\\b\\s*","g"),"");};
|
||||
|
||||
var script = {
|
||||
|
||||
corrections: function () {
|
||||
if (top.user) {
|
||||
top.document.getElementsByTagName('frameset')[0].rows = "117,30%,0,200";
|
||||
}
|
||||
|
||||
// check for layouttabel and add haslayouttable class to body
|
||||
// check for layouttabel and add layouttable classes to body
|
||||
var tagname = 'nolayouttable';
|
||||
if (document.getElementById('middle-column')) {
|
||||
var lc = document.getElementById('left-column');
|
||||
|
@ -1,18 +1,6 @@
|
||||
<!--[if IE 7]>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $CFG->httpsthemewww ?>/custom_corners/styles_ie7.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var browserIE7 = true;
|
||||
/* ]]> */
|
||||
</script>
|
||||
<![endif]-->
|
||||
<!--[if IE 6]>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $CFG->httpsthemewww ?>/custom_corners/styles_ie6.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var browserIE6 = true;
|
||||
/* ]]> */
|
||||
</script>
|
||||
<![endif]-->
|
||||
|
@ -1,139 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ChameleonCSS {
|
||||
var $error;
|
||||
var $base;
|
||||
|
||||
var $perm;
|
||||
var $temp;
|
||||
|
||||
function ChameleonCSS($base, $perm, $temp) {
|
||||
$this->base = $base;
|
||||
$this->perm = $perm;
|
||||
$this->temp = $temp;
|
||||
}
|
||||
|
||||
function update($file, $content = '') {
|
||||
if (!is_writable($this->base . $this->$file)) {
|
||||
$this->error = $this->$file . ' is not writeable, the file permissions are currently ' . $this->getfilepermissions($this->$file);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$fp = fopen($this->base . $this->$file, 'w')) {
|
||||
$this->error = 'couldn\'t open file';
|
||||
return false;
|
||||
}
|
||||
fwrite($fp, stripslashes($content));
|
||||
fclose($fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
function getfilepermissions($file) {
|
||||
return substr(sprintf('%o', fileperms($this->base . $file)), -4);
|
||||
}
|
||||
|
||||
function read() {
|
||||
$permcss = file_get_contents($this->base . $this->perm);
|
||||
$tempcss = file_get_contents($this->base . $this->temp);
|
||||
|
||||
if ($permcss === false || $tempcss === false) {
|
||||
$this->error = 'Couldn\'t read file';
|
||||
return false;
|
||||
}
|
||||
|
||||
$permcss = trim($permcss);
|
||||
$tempcss = trim($tempcss);
|
||||
|
||||
if ($tempcss == '') {
|
||||
return $permcss;
|
||||
}
|
||||
return $this->_merge($permcss, $tempcss);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function _merge($permcss, $tempcss) {
|
||||
$csssrcs = array($this->_toobj($permcss), $this->_toobj($tempcss));
|
||||
|
||||
$merged = array();
|
||||
|
||||
for ($i = 0; $i < 2; ++$i) {
|
||||
foreach ($csssrcs[$i] as $sel => $rule) {
|
||||
$newsel = false;
|
||||
if (!isset($merged[$sel])) {
|
||||
$merged[$sel] = array();
|
||||
$newsel = true;
|
||||
}
|
||||
foreach ($rule as $prop => $value) {
|
||||
$merged[$sel][$prop] = $value;
|
||||
}
|
||||
if ($i > 0 && !$newsel) {
|
||||
foreach ($merged[$sel] as $prop => $value) {
|
||||
if (!isset($csssrcs[$i][$sel][$prop])) {
|
||||
unset($merged[$sel][$prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($i > 0) {
|
||||
foreach ($merged as $sel => $value) {
|
||||
if (!isset($csssrcs[$i][$sel])) {
|
||||
unset($merged[$sel]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_tostr($merged);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function _toobj($cssstr) {
|
||||
$cssobj = array();
|
||||
$end = strpos($cssstr, '}');
|
||||
while ($end !== false) {
|
||||
$currule = substr($cssstr, 0, $end);
|
||||
$parts = explode('{', $currule);
|
||||
$selector = trim($parts[0]);
|
||||
$rules = trim($parts[1]);
|
||||
$rulesarr = explode(';', $rules);
|
||||
|
||||
$num = count($rulesarr);
|
||||
for ($i = 0; $i < $num; ++$i) {
|
||||
if (strpos($rulesarr[$i], ':') === false) {
|
||||
break;
|
||||
}
|
||||
$rule = explode(':', $rulesarr[$i]);
|
||||
$prop = trim($rule[0]);
|
||||
$value = trim($rule[1]);
|
||||
|
||||
if (!isset($cssobj[$selector])) {
|
||||
$cssobj[$selector] = array();
|
||||
}
|
||||
$cssobj[$selector][$prop] = $value;
|
||||
}
|
||||
$cssstr = substr($cssstr, $end + 1);
|
||||
$end = strpos($cssstr, '}');
|
||||
}
|
||||
return $cssobj;
|
||||
}
|
||||
|
||||
|
||||
function _tostr($cssobj) {
|
||||
$cssstr = '';
|
||||
foreach ($cssobj as $sel => $rule) {
|
||||
$cssstr .= "$sel {\n";
|
||||
foreach ($rule as $prop => $value) {
|
||||
$cssstr .= " $prop: $value;\n";
|
||||
}
|
||||
$cssstr .= "}\n";
|
||||
}
|
||||
return $cssstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ChameleonFileBrowser {
|
||||
var $root;
|
||||
var $path;
|
||||
var $dir;
|
||||
var $IMAGE_TYPES;
|
||||
|
||||
var $founddirs = array();
|
||||
var $foundfiles = array();
|
||||
|
||||
function ChameleonFileBrowser() {
|
||||
$this->IMAGE_TYPES = array('jpeg', 'jpg', 'gif', 'png');
|
||||
|
||||
$tmp = explode('/', str_replace('\\', '/', __FILE__));
|
||||
array_pop($tmp);
|
||||
array_pop($tmp);
|
||||
$this->root = implode('/', $tmp);
|
||||
|
||||
$this->path = $this->sanitisepath($_GET['path']);
|
||||
$this->dir = $this->root . '/' . $this->path;
|
||||
}
|
||||
|
||||
function sanitisepath($path) {
|
||||
if ($path == 'root') {
|
||||
return 'pix';
|
||||
}
|
||||
|
||||
if (substr($path, 0, 3) != 'pix') {
|
||||
$this->send('<chameleon_error>Not a valid directory</chameleon_error>');
|
||||
}
|
||||
|
||||
return preg_replace('/[.]+/', '', $path);
|
||||
}
|
||||
|
||||
function isimage($file) {
|
||||
if (strpos($file, '.') === false) {
|
||||
return false;
|
||||
}
|
||||
return in_array(array_pop(explode('.', $file)), $this->IMAGE_TYPES);
|
||||
}
|
||||
|
||||
function readfiles() {
|
||||
if (!is_dir($this->dir)) {
|
||||
$this->send('<chameleon_error>Not a valid directory</chameleon_error>');
|
||||
}
|
||||
|
||||
$handle = opendir($this->dir);
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
continue;
|
||||
}
|
||||
if (is_dir($this->dir . '/' . $file)) {
|
||||
$this->founddirs[] = $file;
|
||||
} else if ($this->isimage($file)) {
|
||||
$this->foundfiles[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
sort($this->founddirs, SORT_STRING);
|
||||
sort($this->foundfiles, SORT_STRING);
|
||||
$this->sendfiles();
|
||||
}
|
||||
|
||||
function sendfiles() {
|
||||
$out = "<files path=\"$this->path\">\n";
|
||||
foreach ($this->founddirs as $file) {
|
||||
$out .= " <file type=\"dir\">$this->path/$file</file>\n";
|
||||
}
|
||||
foreach ($this->foundfiles as $file) {
|
||||
$out .= " <file type=\"img\">$this->path/$file</file>\n";
|
||||
}
|
||||
$out .= "</files>";
|
||||
|
||||
$this->send($out);
|
||||
}
|
||||
|
||||
function send($out) {
|
||||
header("Content-type: application/xml; charset=utf-8");
|
||||
die($out);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
if (!empty($THEME->chameleonenabled)) {
|
||||
$chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$chameleon_isteacher = false;
|
||||
if ($COURSE->id == SITEID) {
|
||||
$chameleon_courseparam = '';
|
||||
} else {
|
||||
$chameleon_courseparam = '?id=' . $COURSE->id;
|
||||
$chameleon_isteacher = !empty($COURSE->theme) and has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $COURSE->id));
|
||||
}
|
||||
|
||||
if ($chameleon_isadmin or ($chameleon_isteacher and !empty($CFG->allowcoursethemes) and !empty($THEME->chameleonteachereditenabled))) {
|
||||
// either we're an admin or we're a teacher and this is being used as the course theme
|
||||
// if we're on a page using a course theme edit that, otherwise edit the main chameleon theme
|
||||
// $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : $CFG->theme;
|
||||
$chameleon_theme = current_theme();
|
||||
?>
|
||||
|
||||
<style type="text/css"> @import '<?php echo "$CFG->themewww/$chameleon_theme" ?>/ui/chameleon_ui.css'; </style>
|
||||
|
||||
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/css_query.js" ?>"> </script>
|
||||
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/sarissa.js" ?>"> </script>
|
||||
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/chameleon_js.php$chameleon_courseparam" ?>"> </script>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,400 +0,0 @@
|
||||
/* sorry about the massive abuse of !important ;-) this tries to prevent user changes in CSS being
|
||||
inherited by the user interface */
|
||||
|
||||
/* general box styles */
|
||||
#chameleon-selector-box, #chameleon-style-box,
|
||||
#chameleon-color-box, #chameleon-file-box,
|
||||
#chameleon-export-box {
|
||||
position: absolute !important;
|
||||
left: 0; top: 0;
|
||||
margin: 0 !important; padding: 0 !important;
|
||||
width: 400px !important;
|
||||
background: #eee !important;
|
||||
border: 1px solid #ccc !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
/* reset */
|
||||
#chameleon-selector-box div, #chameleon-style-box div, #chameleon-color-box div, #chameleon-file-box div {
|
||||
margin: 0 !important; padding: 0 !important;
|
||||
color: #000 !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box a, #chameleon-style-box a, #chameleon-color-box a, #chameleon-file-box a {
|
||||
margin: 0 !important; padding: 0 !important;
|
||||
color: #000 !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
border: 0 !important;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box a, #chameleon-style-box a, #chameleon-color-box a, #chameleon-file-box a {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box table, #chameleon-style-box table, #chameleon-color-box table, #chameleon-file-box table,
|
||||
#chameleon-selector-box tr, #chameleon-style-box tr, #chameleon-color-box tr, #chameleon-file-box tr,
|
||||
#chameleon-selector-box td, #chameleon-style-box td, #chameleon-color-box td, #chameleon-file-box td,
|
||||
#chameleon-selector-box th, #chameleon-style-box th, #chameleon-color-box th, #chameleon-file-box th {
|
||||
padding: 0 !important;
|
||||
color: #000 !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
border: 0 !important;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box p, #chameleon-style-box p, #chameleon-color-box p, #chameleon-file-box p {
|
||||
margin: 0 !important; padding: 5px 10px 0 10px !important;
|
||||
color: #000 !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
border: 0 !important;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
/* drag handles */
|
||||
#chameleon-selector-box #chameleon-selector-box-handle,
|
||||
#chameleon-style-box #chameleon-style-box-handle,
|
||||
#chameleon-color-box #chameleon-color-box-handle,
|
||||
#chameleon-file-box #chameleon-file-box-handle,
|
||||
#chameleon-export-box #chameleon-export-box-handle {
|
||||
width: 100% !important; min-height: 20px !important; _height: 20px !important;
|
||||
background: #ddd !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-selector-box-close,
|
||||
#chameleon-style-box #chameleon-style-box-close,
|
||||
#chameleon-color-box #chameleon-color-box-close,
|
||||
#chameleon-file-box #chameleon-file-box-close {
|
||||
padding: 1px 5px !important;
|
||||
float: right !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
/* selector box specific stuff */
|
||||
#chameleon-selector-box ol {
|
||||
list-style-type: none !important;
|
||||
margin: 0 !important; padding: 10px 20px 10px 10px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box li {
|
||||
margin: 0 0 2px 0 !important; padding: 0 0 0 20px !important;
|
||||
color: #000 !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
background: url(images/tag.gif) no-repeat 0 0 !important;
|
||||
position: relative !important;
|
||||
}
|
||||
#chameleon-selector-box li.row1 {
|
||||
background-color: #eee !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-selector-list li {
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-selector-list {
|
||||
border: 1px solid #ccc !important;
|
||||
background: #f6f6f6 !important;
|
||||
margin: 2px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-selector-list li {
|
||||
margin: 2px !important; padding: 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box span {
|
||||
padding: 1px 3px !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
color: #000 !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box span.prop-value {
|
||||
padding-right: 0 !important;
|
||||
cursor: default !important;
|
||||
position: absolute !important;
|
||||
top: 0 !important; right: 0 !important;
|
||||
}
|
||||
|
||||
* html #chameleon-selector-box span.prop-value {
|
||||
padding-right: 15px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box span.active-selector {
|
||||
background: #fff !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview-container {
|
||||
background: #f6f6f6 url(images/grad.gif) repeat-x 0 100% !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview {
|
||||
margin: 0 !important; padding: 0 !important;
|
||||
width: 100% !important;
|
||||
border-collapse: collapse !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview th.selector,
|
||||
#chameleon-selector-box #chameleon-style-overview th.current-selector {
|
||||
padding: 1px 5px !important;
|
||||
background: #000 !important;
|
||||
color: #fff !important;
|
||||
font-weight: bold !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview th.current-selector,
|
||||
#chameleon-selector-box #chameleon-style-overview td.current-selector {
|
||||
border-top: 2px solid #f90 !important;
|
||||
border-bottom: 2px solid #f90 !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview td.selector,
|
||||
#chameleon-selector-box #chameleon-style-overview td.current-selector {
|
||||
padding: 1px 5px !important;
|
||||
background: #000 !important;
|
||||
color: #fff !important;
|
||||
font-weight: normal !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview td.selector a,
|
||||
#chameleon-selector-box #chameleon-style-overview td.current-selector a {
|
||||
color: #f90 !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview td.prop {
|
||||
padding: 1px 0 1px 5px !important;
|
||||
width: 150px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box #chameleon-style-overview td.value {
|
||||
padding: 1px 5px 1px 0 !important;
|
||||
}
|
||||
|
||||
/* style box specific stuff */
|
||||
|
||||
#chameleon-style-box input.chameleon-input-text {
|
||||
border: 1px solid #999 !important;
|
||||
color: #000 !important;
|
||||
background: #fff none !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box option, #chameleon-style-box select {
|
||||
color: #000 !important;
|
||||
background: #fff none !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box input.chameleon-input-text:focus {
|
||||
border: 1px solid #000 !important;
|
||||
background: #fff none !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box input.chameleon-btn,
|
||||
#chameleon-style-box input.chameleon-btn {
|
||||
border: 1px solid #000 !important;
|
||||
background: #aaa none !important;
|
||||
color: #000 !important;
|
||||
font-size: 9pt !important;
|
||||
padding: 2px 5px !important; margin: 0 2px;
|
||||
}
|
||||
|
||||
#chameleon-selector-box input.chameleon-btn:hover,
|
||||
#chameleon-style-box input.chameleon-btn:hover {
|
||||
background: #000 none !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
|
||||
#chameleon-style-box table {
|
||||
margin: 3px 3px 0 1px !important;
|
||||
position: relative !important;
|
||||
z-index: 2 !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box #chameleon-style-controls, #chameleon-selector-box #chameleon-selector-controls {
|
||||
position: relative !important;
|
||||
border: 1px solid #999 !important;
|
||||
background: #f6f6f6 !important;
|
||||
margin: -1px 3px 3px 2px !important;
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box #chameleon-style-tabs, #chameleon-selector-box #chameleon-selector-tabs {
|
||||
position: relative !important;
|
||||
margin: 3px 3px 0 3px !important;
|
||||
z-index: 2 !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box td.chameleon-style-tab, #chameleon-selector-box td.chameleon-selector-tab {
|
||||
border: 1px solid #999 !important;
|
||||
border-bottom: 0 !important;
|
||||
background: transparent url(images/inactive_tab.gif) 0 100% repeat-x !important;
|
||||
padding: 2px 5px 1px 5px !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
#chameleon-style-box td.chameleon-style-tab-active, #chameleon-selector-box td.chameleon-selector-tab-active {
|
||||
border: 1px solid #999 !important;
|
||||
border-bottom: 0 !important;
|
||||
background: transparent url(images/active_tab.gif) 0 100% repeat-x !important;
|
||||
padding: 2px 5px 1px 5px !important;
|
||||
}
|
||||
|
||||
|
||||
#chameleon-style-controls td {
|
||||
text-align: left !important;
|
||||
padding: 2px !important;
|
||||
}
|
||||
|
||||
#chameleon-style-controls td.label {
|
||||
width: 120px !important;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
/* the open color picker/image browser icons */
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-background-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-border-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-border-left-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-border-right-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-border-top-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-color-picker-border-bottom-color,
|
||||
#chameleon-style-controls #chameleon-style-controls-background-image-picker {
|
||||
width: 20px !important; height: 20px !important;
|
||||
border: 1px solid #000 !important;
|
||||
margin: 0 0 0 2px !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
/* color picker */
|
||||
#chameleon-color-box #chameleon-color-palette {
|
||||
position: relative !important;
|
||||
margin: 10px 12px !important;
|
||||
}
|
||||
|
||||
body #chameleon-color-box {
|
||||
width: 312px !important;
|
||||
}
|
||||
|
||||
#chameleon-color-box #chameleon-color-palette div {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box table {
|
||||
margin: 2px 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box #chameleon-files-parent {
|
||||
width: 100px !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box #chameleon-files-location p {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box #chameleon-files-location p span {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box div p, #chameleon-file-box table p {
|
||||
padding: 0 0 0 20px !important; margin: 5px 10px !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box div p {
|
||||
background: url(images/image.gif) no-repeat 0 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box div p.chameleon-image-folder {
|
||||
background: url(images/folder.gif) no-repeat 0 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box table p.chameleon-image-folder {
|
||||
background: url(images/parent.gif) no-repeat 0 0 !important;
|
||||
}
|
||||
|
||||
#chameleon-file-box div p span {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
/* the buttons */
|
||||
|
||||
#chameleon-selector-box input.chameleon-btn,
|
||||
#chameleon-style-box input.chameleon-btn,
|
||||
#chameleon-color-box input.chameleon-btn,
|
||||
#chameleon-file-box input.chameleon-btn {
|
||||
cursor: pointer !important;
|
||||
margin-bottom: 3px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box p.chameleon-instructions, #chameleon-style-box p.chameleon-instructions {
|
||||
font-size: 9pt !important;
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
#chameleon-status-msg {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
#chameleon-status-msg input {
|
||||
margin-top: 2px !important;
|
||||
}
|
||||
|
||||
|
||||
div table#chameleon-status-msg {
|
||||
position: relative !important;
|
||||
background: #f6f6f6 !important;
|
||||
width: 390px !important;
|
||||
margin: 5px auto !important;
|
||||
border: 1px solid #999 !important;
|
||||
}
|
||||
|
||||
div table#chameleon-status-msg td.chameleon-ok {
|
||||
background: #f6f6f6 url(images/ok.gif) no-repeat 50% 50% !important;
|
||||
width: 25px !important; height: 25px !important;
|
||||
}
|
||||
|
||||
div table#chameleon-status-msg td.chameleon-working {
|
||||
background: #f6f6f6 url(images/working.gif) no-repeat 50% 50% !important;
|
||||
width: 25px !important; height: 25px !important;
|
||||
}
|
||||
|
||||
div table#chameleon-status-msg td.chameleon-notice {
|
||||
background: #f6f6f6 url(images/notice.gif) no-repeat 50% 50% !important;
|
||||
width: 25px !important; height: 25px !important;
|
||||
}
|
||||
|
||||
div table#chameleon-status-msg td.chameleon-error {
|
||||
background: #f6f6f6 url(images/error.gif) no-repeat 50% 50% !important;
|
||||
width: 25px !important; height: 25px !important;
|
||||
}
|
||||
|
||||
div#chameleon-launch-hotspots, div#chameleon-status-msg {
|
||||
position: absolute !important;
|
||||
top: 0 !important; left: 50% !important;
|
||||
z-index: 2 !important;
|
||||
background: #f6f6f6 !important;
|
||||
border: 1px solid #999 !important;
|
||||
padding: 2px 10px !important;
|
||||
margin: 0 0 0 -200px !important;
|
||||
cursor: pointer !important;
|
||||
color: #000 !important;
|
||||
width: 400px !important;
|
||||
font: 9pt/1.4 arial,helvetica,sans-serif !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
body div#chameleon-launch-hotspots {
|
||||
width: 200px !important;
|
||||
margin: 0 0 0 -100px !important;
|
||||
}
|
||||
|
||||
#chameleon-selector-box ul {
|
||||
list-style-type: none !important;
|
||||
}
|
||||
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once('../config.php');
|
||||
|
||||
|
||||
if (empty($THEME->chameleonenabled)) {
|
||||
die('CHAMELEON_ERROR Editing this theme has been disabled');
|
||||
}
|
||||
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error('Incorrect course id');
|
||||
}
|
||||
|
||||
course_setup($course); // we should not require login here
|
||||
|
||||
if ($id != SITEID and !empty($CFG->allowcoursethemes) and !empty($course->theme) and !empty($THEME->chameleonteachereditenabled)) {
|
||||
if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
|
||||
}
|
||||
} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
|
||||
}
|
||||
|
||||
|
||||
require_once('ChameleonCSS.class.php');
|
||||
require_once('ChameleonFileBrowser.class.php');
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['path'])) {
|
||||
$fm = new ChameleonFileBrowser;
|
||||
die($fm->readfiles());
|
||||
}
|
||||
|
||||
$chameleon = new ChameleonCSS('../', 'user_styles.css', 'temp_user_styles.css');
|
||||
|
||||
if (isset($_POST['css'])) {
|
||||
if (!isset($_GET['temp'])) {
|
||||
if (!$chameleon->update('perm', $_POST['css'])) {
|
||||
die('CHAMELEON_ERROR ' . $chameleon->error);
|
||||
}
|
||||
if (!$chameleon->update('temp')) {
|
||||
die('CHAMELEON_ERROR ' . $chameleon->error);
|
||||
}
|
||||
} else {
|
||||
if (!$chameleon->update('temp', $_POST['css'])) {
|
||||
die('CHAMELEON_ERROR ' . $chameleon->error);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$css = $chameleon->read();
|
||||
if ($css === false) {
|
||||
echo 'CHAMELEON_ERROR ' . $chameleon->error;
|
||||
} else {
|
||||
echo $css;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,356 +0,0 @@
|
||||
/*
|
||||
cssQuery, version 2.0.2 (2005-08-19)
|
||||
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
|
||||
License: http://creativecommons.org/licenses/LGPL/2.1/
|
||||
*/
|
||||
|
||||
// the following functions allow querying of the DOM using CSS selectors
|
||||
var cssQuery = function() {
|
||||
var version = "2.0.2";
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// main query function
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
var $COMMA = /\s*,\s*/;
|
||||
var cssQuery = function($selector, $$from) {
|
||||
try {
|
||||
var $match = [];
|
||||
var $useCache = arguments.callee.caching && !$$from;
|
||||
var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document];
|
||||
// process comma separated selectors
|
||||
var $$selectors = parseSelector($selector).split($COMMA), i;
|
||||
for (i = 0; i < $$selectors.length; i++) {
|
||||
// convert the selector to a stream
|
||||
$selector = _toStream($$selectors[i]);
|
||||
// faster chop if it starts with id (MSIE only)
|
||||
if (isMSIE && $selector.slice(0, 3).join("") == " *#") {
|
||||
$selector = $selector.slice(2);
|
||||
$$from = _msie_selectById([], $base, $selector[1]);
|
||||
} else $$from = $base;
|
||||
// process the stream
|
||||
var j = 0, $token, $filter, $arguments, $cacheSelector = "";
|
||||
while (j < $selector.length) {
|
||||
$token = $selector[j++];
|
||||
$filter = $selector[j++];
|
||||
$cacheSelector += $token + $filter;
|
||||
// some pseudo-classes allow arguments to be passed
|
||||
// e.g. nth-child(even)
|
||||
$arguments = "";
|
||||
if ($selector[j] == "(") {
|
||||
while ($selector[j++] != ")" && j < $selector.length) {
|
||||
$arguments += $selector[j];
|
||||
}
|
||||
$arguments = $arguments.slice(0, -1);
|
||||
$cacheSelector += "(" + $arguments + ")";
|
||||
}
|
||||
// process a token/filter pair use cached results if possible
|
||||
$$from = ($useCache && cache[$cacheSelector]) ?
|
||||
cache[$cacheSelector] : select($$from, $token, $filter, $arguments);
|
||||
if ($useCache) cache[$cacheSelector] = $$from;
|
||||
}
|
||||
$match = $match.concat($$from);
|
||||
}
|
||||
delete cssQuery.error;
|
||||
return $match;
|
||||
} catch ($error) {
|
||||
cssQuery.error = $error;
|
||||
return [];
|
||||
}};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// public interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
cssQuery.toString = function() {
|
||||
return "function cssQuery() {\n [version " + version + "]\n}";
|
||||
};
|
||||
|
||||
// caching
|
||||
var cache = {};
|
||||
cssQuery.caching = false;
|
||||
cssQuery.clearCache = function($selector) {
|
||||
if ($selector) {
|
||||
$selector = _toStream($selector).join("");
|
||||
delete cache[$selector];
|
||||
} else cache = {};
|
||||
};
|
||||
|
||||
// allow extensions
|
||||
var modules = {};
|
||||
var loaded = false;
|
||||
cssQuery.addModule = function($name, $script) {
|
||||
if (loaded) eval("$script=" + String($script));
|
||||
modules[$name] = new $script();;
|
||||
};
|
||||
|
||||
// hackery
|
||||
cssQuery.valueOf = function($code) {
|
||||
return $code ? eval($code) : this;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// declarations
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
var selectors = {};
|
||||
var pseudoClasses = {};
|
||||
// a safari bug means that these have to be declared here
|
||||
var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/};
|
||||
var attributeSelectors = [];
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// selectors
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// descendant selector
|
||||
selectors[" "] = function($results, $from, $tagName, $namespace) {
|
||||
// loop through current selection
|
||||
var $element, i, j;
|
||||
for (i = 0; i < $from.length; i++) {
|
||||
// get descendants
|
||||
var $subset = getElementsByTagName($from[i], $tagName, $namespace);
|
||||
// loop through descendants and add to results selection
|
||||
for (j = 0; ($element = $subset[j]); j++) {
|
||||
if (thisElement($element) && compareNamespace($element, $namespace))
|
||||
$results.push($element);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ID selector
|
||||
selectors["#"] = function($results, $from, $id) {
|
||||
// loop through current selection and check ID
|
||||
var $element, j;
|
||||
for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element);
|
||||
};
|
||||
|
||||
// class selector
|
||||
selectors["."] = function($results, $from, $className) {
|
||||
// create a RegExp version of the class
|
||||
$className = new RegExp("(^|\\s)" + $className + "(\\s|$)");
|
||||
// loop through current selection and check class
|
||||
var $element, i;
|
||||
for (i = 0; ($element = $from[i]); i++)
|
||||
if ($className.test($element.className)) $results.push($element);
|
||||
};
|
||||
|
||||
// pseudo-class selector
|
||||
selectors[":"] = function($results, $from, $pseudoClass, $arguments) {
|
||||
// retrieve the cssQuery pseudo-class function
|
||||
var $test = pseudoClasses[$pseudoClass], $element, i;
|
||||
// loop through current selection and apply pseudo-class filter
|
||||
if ($test) for (i = 0; ($element = $from[i]); i++)
|
||||
// if the cssQuery pseudo-class function returns "true" add the element
|
||||
if ($test($element, $arguments)) $results.push($element);
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// pseudo-classes
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
pseudoClasses["link"] = function($element) {
|
||||
var $document = getDocument($element);
|
||||
if ($document.links) for (var i = 0; i < $document.links.length; i++) {
|
||||
if ($document.links[i] == $element) return true;
|
||||
}
|
||||
};
|
||||
|
||||
pseudoClasses["visited"] = function($element) {
|
||||
// can't do this without jiggery-pokery
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DOM traversal
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// IE5/6 includes comments (LOL) in it's elements collections.
|
||||
// so we have to check for this. the test is tagName != "!". LOL (again).
|
||||
var thisElement = function($element) {
|
||||
return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
|
||||
};
|
||||
|
||||
// return the previous element to the supplied element
|
||||
// previousSibling is not good enough as it might return a text or comment node
|
||||
var previousElementSibling = function($element) {
|
||||
while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue;
|
||||
return $element;
|
||||
};
|
||||
|
||||
// return the next element to the supplied element
|
||||
var nextElementSibling = function($element) {
|
||||
while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue;
|
||||
return $element;
|
||||
};
|
||||
|
||||
// return the first child ELEMENT of an element
|
||||
// NOT the first child node (though they may be the same thing)
|
||||
var firstElementChild = function($element) {
|
||||
return thisElement($element.firstChild) || nextElementSibling($element.firstChild);
|
||||
};
|
||||
|
||||
var lastElementChild = function($element) {
|
||||
return thisElement($element.lastChild) || previousElementSibling($element.lastChild);
|
||||
};
|
||||
|
||||
// return child elements of an element (not child nodes)
|
||||
var childElements = function($element) {
|
||||
var $childElements = [];
|
||||
$element = firstElementChild($element);
|
||||
while ($element) {
|
||||
$childElements.push($element);
|
||||
$element = nextElementSibling($element);
|
||||
}
|
||||
return $childElements;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// browser compatibility
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// all of the functions in this section can be overwritten. the default
|
||||
// configuration is for IE. The functions below reflect this. standard
|
||||
// methods are included in a separate module. It would probably be better
|
||||
// the other way round of course but this makes it easier to keep IE7 trim.
|
||||
|
||||
var isMSIE = true;
|
||||
|
||||
var isXML = function($element) {
|
||||
var $document = getDocument($element);
|
||||
return (typeof $document.mimeType == "unknown") ?
|
||||
/\.xml$/i.test($document.URL) :
|
||||
Boolean($document.mimeType == "XML Document");
|
||||
};
|
||||
|
||||
// return the element's containing document
|
||||
var getDocument = function($element) {
|
||||
return $element.ownerDocument || $element.document;
|
||||
};
|
||||
|
||||
var getElementsByTagName = function($element, $tagName) {
|
||||
return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName);
|
||||
};
|
||||
|
||||
var compareTagName = function($element, $tagName, $namespace) {
|
||||
if ($tagName == "*") return thisElement($element);
|
||||
if (!compareNamespace($element, $namespace)) return false;
|
||||
if (!isXML($element)) $tagName = $tagName.toUpperCase();
|
||||
return $element.tagName == $tagName;
|
||||
};
|
||||
|
||||
var compareNamespace = function($element, $namespace) {
|
||||
return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace);
|
||||
};
|
||||
|
||||
var getTextContent = function($element) {
|
||||
return $element.innerText;
|
||||
};
|
||||
|
||||
function _msie_selectById($results, $from, id) {
|
||||
var $match, i, j;
|
||||
for (i = 0; i < $from.length; i++) {
|
||||
if ($match = $from[i].all.item(id)) {
|
||||
if ($match.id == id) $results.push($match);
|
||||
else if ($match.length != null) {
|
||||
for (j = 0; j < $match.length; j++) {
|
||||
if ($match[j].id == id) $results.push($match[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
};
|
||||
|
||||
// for IE5.0
|
||||
if (![].push) Array.prototype.push = function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
this[this.length] = arguments[i];
|
||||
}
|
||||
return this.length;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// query support
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// select a set of matching elements.
|
||||
// "from" is an array of elements.
|
||||
// "token" is a character representing the type of filter
|
||||
// e.g. ">" means child selector
|
||||
// "filter" represents the tag name, id or class name that is being selected
|
||||
// the function returns an array of matching elements
|
||||
var $NAMESPACE = /\|/;
|
||||
function select($$from, $token, $filter, $arguments) {
|
||||
if ($NAMESPACE.test($filter)) {
|
||||
$filter = $filter.split($NAMESPACE);
|
||||
$arguments = $filter[0];
|
||||
$filter = $filter[1];
|
||||
}
|
||||
var $results = [];
|
||||
if (selectors[$token]) {
|
||||
selectors[$token]($results, $$from, $filter, $arguments);
|
||||
}
|
||||
return $results;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// parsing
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// convert css selectors to a stream of tokens and filters
|
||||
// it's not a real stream. it's just an array of strings.
|
||||
var $STANDARD_SELECT = /^[^\s>+~]/;
|
||||
var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;
|
||||
function _toStream($selector) {
|
||||
if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector;
|
||||
return $selector.match($$STREAM) || [];
|
||||
};
|
||||
|
||||
var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g;
|
||||
var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g;
|
||||
var parseSelector = function($selector) {
|
||||
return $selector
|
||||
// trim whitespace
|
||||
.replace($WHITESPACE, "$1")
|
||||
// e.g. ".class1" --> "*.class1"
|
||||
.replace($IMPLIED_ALL, "$1*$2");
|
||||
};
|
||||
|
||||
var Quote = {
|
||||
toString: function() {return "'"},
|
||||
match: /^('[^']*')|("[^"]*")$/,
|
||||
test: function($string) {
|
||||
return this.match.test($string);
|
||||
},
|
||||
add: function($string) {
|
||||
return this.test($string) ? $string : this + $string + this;
|
||||
},
|
||||
remove: function($string) {
|
||||
return this.test($string) ? $string.slice(1, -1) : $string;
|
||||
}
|
||||
};
|
||||
|
||||
var getText = function($text) {
|
||||
return Quote.remove($text);
|
||||
};
|
||||
|
||||
var $ESCAPE = /([\/()[\]?{}|*+-])/g;
|
||||
function regEscape($string) {
|
||||
return $string.replace($ESCAPE, "\\$1");
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// modules
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// -------- >> insert modules here for packaging << -------- \\
|
||||
|
||||
loaded = true;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// return the query function
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
return cssQuery;
|
||||
|
||||
}(); // cssQuery
|
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 1.1 KiB |
@ -1,648 +0,0 @@
|
||||
|
||||
/**
|
||||
* ====================================================================
|
||||
* About
|
||||
* ====================================================================
|
||||
* Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs.
|
||||
* The library supports Gecko based browsers like Mozilla and Firefox,
|
||||
* Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera
|
||||
* @version 0.9.6.1
|
||||
* @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net
|
||||
* ====================================================================
|
||||
* Licence
|
||||
* ====================================================================
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 or
|
||||
* the GNU Lesser General Public License version 2.1 as published by
|
||||
* the Free Software Foundation (your choice between the two).
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License or GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* or GNU Lesser General Public License along with this program; if not,
|
||||
* write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* or visit http://www.gnu.org
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* <p>Sarissa is a utility class. Provides "static" methods for DOMDocument and
|
||||
* XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p>
|
||||
* @constructor
|
||||
*/
|
||||
function Sarissa(){};
|
||||
/** @private */
|
||||
Sarissa.PARSED_OK = "Document contains no parsing errors";
|
||||
/**
|
||||
* Tells you whether transformNode and transformNodeToObject are available. This functionality
|
||||
* is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations
|
||||
* use the XSLTProcessor
|
||||
* @deprecated
|
||||
* @type boolean
|
||||
*/
|
||||
Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
|
||||
/**
|
||||
* tells you whether XMLHttpRequest (or equivalent) is available
|
||||
* @type boolean
|
||||
*/
|
||||
Sarissa.IS_ENABLED_XMLHTTP = false;
|
||||
/**
|
||||
* tells you whether selectNodes/selectSingleNode is available
|
||||
* @type boolean
|
||||
*/
|
||||
Sarissa.IS_ENABLED_SELECT_NODES = false;
|
||||
var _sarissa_iNsCounter = 0;
|
||||
var _SARISSA_IEPREFIX4XSLPARAM = "";
|
||||
var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
|
||||
var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
|
||||
var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
|
||||
var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
|
||||
var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
|
||||
var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
|
||||
if(!window.Node || !window.Node.ELEMENT_NODE){
|
||||
var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};
|
||||
};
|
||||
|
||||
// IE initialization
|
||||
if(_SARISSA_IS_IE){
|
||||
// for XSLT parameter names, prefix needed by IE
|
||||
_SARISSA_IEPREFIX4XSLPARAM = "xsl:";
|
||||
// used to store the most recent ProgID available out of the above
|
||||
var _SARISSA_DOM_PROGID = "";
|
||||
var _SARISSA_XMLHTTP_PROGID = "";
|
||||
/**
|
||||
* Called when the Sarissa_xx.js file is parsed, to pick most recent
|
||||
* ProgIDs for IE, then gets destroyed.
|
||||
* @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
|
||||
* @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
|
||||
*/
|
||||
pickRecentProgID = function (idList, enabledList){
|
||||
// found progID flag
|
||||
var bFound = false;
|
||||
for(var i=0; i < idList.length && !bFound; i++){
|
||||
try{
|
||||
var oDoc = new ActiveXObject(idList[i]);
|
||||
o2Store = idList[i];
|
||||
bFound = true;
|
||||
for(var j=0;j<enabledList.length;j++)
|
||||
if(i <= enabledList[j][1])
|
||||
Sarissa["IS_ENABLED_"+enabledList[j][0]] = true;
|
||||
}catch (objException){
|
||||
// trap; try next progID
|
||||
};
|
||||
};
|
||||
if (!bFound)
|
||||
throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
|
||||
idList = null;
|
||||
return o2Store;
|
||||
};
|
||||
// pick best available MSXML progIDs
|
||||
_SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]);
|
||||
_SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]);
|
||||
_SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
|
||||
_SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]);
|
||||
// we dont need this anymore
|
||||
pickRecentProgID = null;
|
||||
//============================================
|
||||
// Factory methods (IE)
|
||||
//============================================
|
||||
// see non-IE version
|
||||
Sarissa.getDomDocument = function(sUri, sName){
|
||||
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
|
||||
// if a root tag name was provided, we need to load it in the DOM
|
||||
// object
|
||||
if (sName){
|
||||
// if needed, create an artifical namespace prefix the way Moz
|
||||
// does
|
||||
if (sUri){
|
||||
oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />");
|
||||
// don't use the same prefix again
|
||||
++_sarissa_iNsCounter;
|
||||
}
|
||||
else
|
||||
oDoc.loadXML("<" + sName + "/>");
|
||||
};
|
||||
return oDoc;
|
||||
};
|
||||
// see non-IE version
|
||||
Sarissa.getParseErrorText = function (oDoc) {
|
||||
var parseErrorText = Sarissa.PARSED_OK;
|
||||
if(oDoc.parseError != 0){
|
||||
parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
|
||||
"\nLocation: " + oDoc.parseError.url +
|
||||
"\nLine Number " + oDoc.parseError.line + ", Column " +
|
||||
oDoc.parseError.linepos +
|
||||
":\n" + oDoc.parseError.srcText +
|
||||
"\n";
|
||||
for(var i = 0; i < oDoc.parseError.linepos;i++){
|
||||
parseErrorText += "-";
|
||||
};
|
||||
parseErrorText += "^\n";
|
||||
};
|
||||
return parseErrorText;
|
||||
};
|
||||
// see non-IE version
|
||||
Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
|
||||
oDoc.setProperty("SelectionLanguage", "XPath");
|
||||
oDoc.setProperty("SelectionNamespaces", sNsSet);
|
||||
};
|
||||
/**
|
||||
* Basic implementation of Mozilla's XSLTProcessor for IE.
|
||||
* Reuses the same XSLT stylesheet for multiple transforms
|
||||
* @constructor
|
||||
*/
|
||||
XSLTProcessor = function(){
|
||||
this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
|
||||
this.processor = null;
|
||||
};
|
||||
/**
|
||||
* Impoprts the given XSLT DOM and compiles it to a reusable transform
|
||||
* @argument xslDoc The XSLT DOMDocument to import
|
||||
*/
|
||||
XSLTProcessor.prototype.importStylesheet = function(xslDoc){
|
||||
// convert stylesheet to free threaded
|
||||
var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
|
||||
converted.loadXML(xslDoc.xml);
|
||||
this.template.stylesheet = converted;
|
||||
this.processor = this.template.createProcessor();
|
||||
// (re)set default param values
|
||||
this.paramsSet = new Array();
|
||||
};
|
||||
/**
|
||||
* Transform the given XML DOM
|
||||
* @argument sourceDoc The XML DOMDocument to transform
|
||||
* @return The transformation result as a DOM Document
|
||||
*/
|
||||
XSLTProcessor.prototype.transformToDocument = function(sourceDoc){
|
||||
this.processor.input = sourceDoc;
|
||||
var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
|
||||
this.processor.output = outDoc;
|
||||
this.processor.transform();
|
||||
return outDoc;
|
||||
};
|
||||
/**
|
||||
* Set global XSLT parameter of the imported stylesheet
|
||||
* @argument nsURI The parameter namespace URI
|
||||
* @argument name The parameter base name
|
||||
* @argument value The new parameter value
|
||||
*/
|
||||
XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
|
||||
/* nsURI is optional but cannot be null */
|
||||
if(nsURI){
|
||||
this.processor.addParameter(name, value, nsURI);
|
||||
}else{
|
||||
this.processor.addParameter(name, value);
|
||||
};
|
||||
/* update updated params for getParameter */
|
||||
if(!this.paramsSet[""+nsURI]){
|
||||
this.paramsSet[""+nsURI] = new Array();
|
||||
};
|
||||
this.paramsSet[""+nsURI][name] = value;
|
||||
};
|
||||
/**
|
||||
* Gets a parameter if previously set by setParameter. Returns null
|
||||
* otherwise
|
||||
* @argument name The parameter base name
|
||||
* @argument value The new parameter value
|
||||
* @return The parameter value if reviously set by setParameter, null otherwise
|
||||
*/
|
||||
XSLTProcessor.prototype.getParameter = function(nsURI, name){
|
||||
nsURI = nsURI || "";
|
||||
if(nsURI in this.paramsSet && name in this.paramsSet[nsURI]){
|
||||
return this.paramsSet[nsURI][name];
|
||||
}else{
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
else{ /* end IE initialization, try to deal with real browsers now ;-) */
|
||||
if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
|
||||
/**
|
||||
* <p>Ensures the document was loaded correctly, otherwise sets the
|
||||
* parseError to -1 to indicate something went wrong. Internal use</p>
|
||||
* @private
|
||||
*/
|
||||
Sarissa.__handleLoad__ = function(oDoc){
|
||||
if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror")
|
||||
oDoc.parseError = -1;
|
||||
Sarissa.__setReadyState__(oDoc, 4);
|
||||
};
|
||||
/**
|
||||
* <p>Attached by an event handler to the load event. Internal use.</p>
|
||||
* @private
|
||||
*/
|
||||
_sarissa_XMLDocument_onload = function(){
|
||||
Sarissa.__handleLoad__(this);
|
||||
};
|
||||
/**
|
||||
* <p>Sets the readyState property of the given DOM Document object.
|
||||
* Internal use.</p>
|
||||
* @private
|
||||
* @argument oDoc the DOM Document object to fire the
|
||||
* readystatechange event
|
||||
* @argument iReadyState the number to change the readystate property to
|
||||
*/
|
||||
Sarissa.__setReadyState__ = function(oDoc, iReadyState){
|
||||
oDoc.readyState = iReadyState;
|
||||
if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function")
|
||||
oDoc.onreadystatechange();
|
||||
};
|
||||
Sarissa.getDomDocument = function(sUri, sName){
|
||||
var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null);
|
||||
oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false);
|
||||
return oDoc;
|
||||
};
|
||||
if(window.XMLDocument){
|
||||
/**
|
||||
* <p>Emulate IE's onreadystatechange attribute</p>
|
||||
*/
|
||||
XMLDocument.prototype.onreadystatechange = null;
|
||||
/**
|
||||
* <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p>
|
||||
* <ul><li>1 == LOADING,</li>
|
||||
* <li>2 == LOADED,</li>
|
||||
* <li>3 == INTERACTIVE,</li>
|
||||
* <li>4 == COMPLETED</li></ul>
|
||||
*/
|
||||
XMLDocument.prototype.readyState = 0;
|
||||
/**
|
||||
* <p>Emulate IE's parseError attribute</p>
|
||||
*/
|
||||
XMLDocument.prototype.parseError = 0;
|
||||
|
||||
// NOTE: setting async to false will only work with documents
|
||||
// called over HTTP (meaning a server), not the local file system,
|
||||
// unless you are using Moz 1.4+.
|
||||
// BTW the try>catch block is for 1.4; I haven't found a way to check if
|
||||
// the property is implemented without
|
||||
// causing an error and I dont want to use user agent stuff for that...
|
||||
var _SARISSA_SYNC_NON_IMPLEMENTED = false;// ("async" in XMLDocument.prototype) ? false: true;
|
||||
/**
|
||||
* <p>Keeps a handle to the original load() method. Internal use and only
|
||||
* if Mozilla version is lower than 1.4</p>
|
||||
* @private
|
||||
*/
|
||||
XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load;
|
||||
|
||||
/**
|
||||
* <p>Overrides the original load method to provide synchronous loading for
|
||||
* Mozilla versions prior to 1.4, using an XMLHttpRequest object (if
|
||||
* async is set to false)</p>
|
||||
* @returns the DOM Object as it was before the load() call (may be empty)
|
||||
*/
|
||||
XMLDocument.prototype.load = function(sURI) {
|
||||
var oDoc = document.implementation.createDocument("", "", null);
|
||||
Sarissa.copyChildNodes(this, oDoc);
|
||||
this.parseError = 0;
|
||||
Sarissa.__setReadyState__(this, 1);
|
||||
try {
|
||||
if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) {
|
||||
var tmp = new XMLHttpRequest();
|
||||
tmp.open("GET", sURI, false);
|
||||
tmp.send(null);
|
||||
Sarissa.__setReadyState__(this, 2);
|
||||
Sarissa.copyChildNodes(tmp.responseXML, this);
|
||||
Sarissa.__setReadyState__(this, 3);
|
||||
}
|
||||
else {
|
||||
this._sarissa_load(sURI);
|
||||
};
|
||||
}
|
||||
catch (objException) {
|
||||
this.parseError = -1;
|
||||
}
|
||||
finally {
|
||||
if(this.async == false){
|
||||
Sarissa.__handleLoad__(this);
|
||||
};
|
||||
};
|
||||
return oDoc;
|
||||
};
|
||||
|
||||
|
||||
}//if(window.XMLDocument)
|
||||
else if(document.implementation && document.implementation.hasFeature && document.implementation.hasFeature('LS', '3.0')){
|
||||
Document.prototype.async = true;
|
||||
Document.prototype.onreadystatechange = null;
|
||||
Document.prototype.parseError = 0;
|
||||
Document.prototype.load = function(sURI) {
|
||||
var parser = document.implementation.createLSParser(this.async ? document.implementation.MODE_ASYNCHRONOUS : document.implementation.MODE_SYNCHRONOUS, null);
|
||||
if(this.async){
|
||||
var self = this;
|
||||
parser.addEventListener("load",
|
||||
function(e) {
|
||||
self.readyState = 4;
|
||||
Sarissa.copyChildNodes(e.newDocument, self.documentElement, false);
|
||||
self.onreadystatechange.call();
|
||||
},
|
||||
false);
|
||||
};
|
||||
try {
|
||||
var oDoc = parser.parseURI(sURI);
|
||||
}
|
||||
catch(e){
|
||||
this.parseError = -1;
|
||||
};
|
||||
if(!this.async)
|
||||
Sarissa.copyChildNodes(oDoc, this.documentElement, false);
|
||||
return oDoc;
|
||||
};
|
||||
/**
|
||||
* <p>Factory method to obtain a new DOM Document object</p>
|
||||
* @argument sUri the namespace of the root node (if any)
|
||||
* @argument sUri the local name of the root node (if any)
|
||||
* @returns a new DOM Document
|
||||
*/
|
||||
Sarissa.getDomDocument = function(sUri, sName){
|
||||
return document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null);
|
||||
};
|
||||
};
|
||||
};//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT)
|
||||
};
|
||||
//==========================================
|
||||
// Common stuff
|
||||
//==========================================
|
||||
if(!window.DOMParser){
|
||||
/*
|
||||
* DOMParser is a utility class, used to construct DOMDocuments from XML strings
|
||||
* @constructor
|
||||
*/
|
||||
DOMParser = function() {
|
||||
};
|
||||
if(_SARISSA_IS_SAFARI){
|
||||
/**
|
||||
* Construct a new DOM Document from the given XMLstring
|
||||
* @param sXml the given XML string
|
||||
* @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
|
||||
* @return a new DOM Document from the given XML string
|
||||
*/
|
||||
DOMParser.prototype.parseFromString = function(sXml, contentType){
|
||||
if(contentType.toLowerCase() != "application/xml"){
|
||||
throw "Cannot handle content type: \"" + contentType + "\"";
|
||||
};
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(str), false);
|
||||
xmlhttp.send(null);
|
||||
return xmlhttp.responseXML;
|
||||
};
|
||||
}else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && "loadXML" in Sarissa.getDomDocument()){
|
||||
DOMParser.prototype.parseFromString = function(sXml, contentType){
|
||||
var doc = Sarissa.getDomDocument();
|
||||
doc.loadXML(sXml);
|
||||
return doc;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if(window.XMLHttpRequest){
|
||||
Sarissa.IS_ENABLED_XMLHTTP = true;
|
||||
}
|
||||
else if(_SARISSA_IS_IE){
|
||||
/**
|
||||
* Emulate XMLHttpRequest
|
||||
* @constructor
|
||||
*/
|
||||
XMLHttpRequest = function() {
|
||||
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
|
||||
};
|
||||
Sarissa.IS_ENABLED_XMLHTTP = true;
|
||||
};
|
||||
|
||||
if(!window.document.importNode && _SARISSA_IS_IE){
|
||||
try{
|
||||
/**
|
||||
* Implements importNode for the current window document in IE using innerHTML.
|
||||
* Testing showed that DOM was multiple times slower than innerHTML for this,
|
||||
* sorry folks. If you encounter trouble (who knows what IE does behind innerHTML)
|
||||
* please gimme a call.
|
||||
* @param oNode the Node to import
|
||||
* @param bChildren whether to include the children of oNode
|
||||
* @returns the imported node for further use
|
||||
*/
|
||||
window.document.importNode = function(oNode, bChildren){
|
||||
var importNode = document.createElement("div");
|
||||
if(bChildren)
|
||||
importNode.innerHTML = Sarissa.serialize(oNode);
|
||||
else
|
||||
importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false));
|
||||
return importNode.firstChild;
|
||||
};
|
||||
}catch(e){};
|
||||
};
|
||||
if(!Sarissa.getParseErrorText){
|
||||
/**
|
||||
* <p>Returns a human readable description of the parsing error. Usefull
|
||||
* for debugging. Tip: append the returned error string in a <pre>
|
||||
* element if you want to render it.</p>
|
||||
* <p>Many thanks to Christian Stocker for the initial patch.</p>
|
||||
* @argument oDoc The target DOM document
|
||||
* @returns The parsing error description of the target Document in
|
||||
* human readable form (preformated text)
|
||||
*/
|
||||
Sarissa.getParseErrorText = function (oDoc){
|
||||
var parseErrorText = Sarissa.PARSED_OK;
|
||||
if(oDoc && oDoc.parseError && oDoc.parseError != 0){
|
||||
/*moz*/
|
||||
if(oDoc.documentElement.tagName == "parsererror"){
|
||||
parseErrorText = oDoc.documentElement.firstChild.data;
|
||||
parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data;
|
||||
}/*konq*/
|
||||
else{
|
||||
parseErrorText = Sarissa.getText(oDoc.documentElement);/*.getElementsByTagName("h1")[0], false) + "\n";
|
||||
parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n";
|
||||
parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false);*/
|
||||
};
|
||||
};
|
||||
return parseErrorText;
|
||||
};
|
||||
};
|
||||
Sarissa.getText = function(oNode, deep){
|
||||
var s = "";
|
||||
var nodes = oNode.childNodes;
|
||||
for(var i=0; i < nodes.length; i++){
|
||||
var node = nodes[i];
|
||||
var nodeType = node.nodeType;
|
||||
if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){
|
||||
s += node.data;
|
||||
}else if(deep == true
|
||||
&& (nodeType == Node.ELEMENT_NODE
|
||||
|| nodeType == Node.DOCUMENT_NODE
|
||||
|| nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
|
||||
s += Sarissa.getText(node, true);
|
||||
};
|
||||
};
|
||||
return s;
|
||||
};
|
||||
if(window.XMLSerializer){
|
||||
/**
|
||||
* <p>Factory method to obtain the serialization of a DOM Node</p>
|
||||
* @returns the serialized Node as an XML string
|
||||
*/
|
||||
Sarissa.serialize = function(oDoc){
|
||||
var s = null;
|
||||
if(oDoc){
|
||||
s = oDoc.innerHTML?oDoc.innerHTML:(new XMLSerializer()).serializeToString(oDoc);
|
||||
};
|
||||
return s;
|
||||
};
|
||||
}else{
|
||||
if(Sarissa.getDomDocument && (Sarissa.getDomDocument("","foo", null)).xml){
|
||||
// see non-IE version
|
||||
Sarissa.serialize = function(oDoc) {
|
||||
var s = null;
|
||||
if(oDoc){
|
||||
s = oDoc.innerHTML?oDoc.innerHTML:oDoc.xml;
|
||||
};
|
||||
return s;
|
||||
};
|
||||
/**
|
||||
* Utility class to serialize DOM Node objects to XML strings
|
||||
* @constructor
|
||||
*/
|
||||
XMLSerializer = function(){};
|
||||
/**
|
||||
* Serialize the given DOM Node to an XML string
|
||||
* @param oNode the DOM Node to serialize
|
||||
*/
|
||||
XMLSerializer.prototype.serializeToString = function(oNode) {
|
||||
return oNode.xml;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* strips tags from a markup string
|
||||
*/
|
||||
Sarissa.stripTags = function (s) {
|
||||
return s.replace(/<[^>]+>/g,"");
|
||||
};
|
||||
/**
|
||||
* <p>Deletes all child nodes of the given node</p>
|
||||
* @argument oNode the Node to empty
|
||||
*/
|
||||
Sarissa.clearChildNodes = function(oNode) {
|
||||
// need to check for firstChild due to opera 8 bug with hasChildNodes
|
||||
while(oNode.firstChild){
|
||||
oNode.removeChild(oNode.firstChild);
|
||||
};
|
||||
};
|
||||
/**
|
||||
* <p> Copies the childNodes of nodeFrom to nodeTo</p>
|
||||
* <p> <b>Note:</b> The second object's original content is deleted before
|
||||
* the copy operation, unless you supply a true third parameter</p>
|
||||
* @argument nodeFrom the Node to copy the childNodes from
|
||||
* @argument nodeTo the Node to copy the childNodes to
|
||||
* @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false
|
||||
*/
|
||||
Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
|
||||
if((!nodeFrom) || (!nodeTo)){
|
||||
throw "Both source and destination nodes must be provided";
|
||||
};
|
||||
if(!bPreserveExisting){
|
||||
Sarissa.clearChildNodes(nodeTo);
|
||||
};
|
||||
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
|
||||
var nodes = nodeFrom.childNodes;
|
||||
if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
|
||||
for(var i=0;i < nodes.length;i++) {
|
||||
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
|
||||
};
|
||||
}
|
||||
else{
|
||||
for(var i=0;i < nodes.length;i++) {
|
||||
nodeTo.appendChild(nodes[i].cloneNode(true));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* <p> Moves the childNodes of nodeFrom to nodeTo</p>
|
||||
* <p> <b>Note:</b> The second object's original content is deleted before
|
||||
* the move operation, unless you supply a true third parameter</p>
|
||||
* @argument nodeFrom the Node to copy the childNodes from
|
||||
* @argument nodeTo the Node to copy the childNodes to
|
||||
* @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
|
||||
*/
|
||||
Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
|
||||
if((!nodeFrom) || (!nodeTo)){
|
||||
throw "Both source and destination nodes must be provided";
|
||||
};
|
||||
if(!bPreserveExisting){
|
||||
Sarissa.clearChildNodes(nodeTo);
|
||||
};
|
||||
var nodes = nodeFrom.childNodes;
|
||||
// if within the same doc, just move, else copy and delete
|
||||
if(nodeFrom.ownerDocument == nodeTo.ownerDocument){
|
||||
while(nodeFrom.firstChild){
|
||||
nodeTo.appendChild(nodeFrom.firstChild);
|
||||
};
|
||||
}else{
|
||||
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
|
||||
if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
|
||||
for(var i=0;i < nodes.length;i++) {
|
||||
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
|
||||
};
|
||||
}else{
|
||||
for(var i=0;i < nodes.length;i++) {
|
||||
nodeTo.appendChild(nodes[i].cloneNode(true));
|
||||
};
|
||||
};
|
||||
Sarissa.clearChildNodes(nodeFrom);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* <p>Serialize any object to an XML string. All properties are serialized using the property name
|
||||
* as the XML element name. Array elements are rendered as <code>array-item</code> elements,
|
||||
* using their index/key as the value of the <code>key</code> attribute.</p>
|
||||
* @argument anyObject the object to serialize
|
||||
* @argument objectName a name for that object
|
||||
* @return the XML serializationj of the given object as a string
|
||||
*/
|
||||
Sarissa.xmlize = function(anyObject, objectName, indentSpace){
|
||||
indentSpace = indentSpace?indentSpace:'';
|
||||
var s = indentSpace + '<' + objectName + '>';
|
||||
var isLeaf = false;
|
||||
if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String
|
||||
|| anyObject instanceof Boolean || anyObject instanceof Date){
|
||||
s += Sarissa.escape(""+anyObject);
|
||||
isLeaf = true;
|
||||
}else{
|
||||
s += "\n";
|
||||
var itemKey = '';
|
||||
var isArrayItem = anyObject instanceof Array;
|
||||
for(var name in anyObject){
|
||||
s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " ");
|
||||
};
|
||||
s += indentSpace;
|
||||
};
|
||||
return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape the given string chacters that correspond to the five predefined XML entities
|
||||
* @param sXml the string to escape
|
||||
*/
|
||||
Sarissa.escape = function(sXml){
|
||||
return sXml.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
};
|
||||
|
||||
/**
|
||||
* Unescape the given string. This turns the occurences of the predefined XML
|
||||
* entities to become the characters they represent correspond to the five predefined XML entities
|
||||
* @param sXml the string to unescape
|
||||
*/
|
||||
Sarissa.unescape = function(sXml){
|
||||
return sXml.replace(/'/g,"'")
|
||||
.replace(/"/g,"\"")
|
||||
.replace(/>/g,">")
|
||||
.replace(/</g,"<")
|
||||
.replace(/&/g,"&");
|
||||
};
|
||||
//
|
@ -1,4 +1,3 @@
|
||||
/* @override http://ubuntu.userver.lan/moodle_19/theme/custom_corners/user_styles.css */
|
||||
body {
|
||||
font-size: 100%;
|
||||
color: #333333;
|
||||
@ -11,7 +10,6 @@ div#page {
|
||||
margin: 0 4%;
|
||||
padding-top: 2px;
|
||||
width: auto;
|
||||
/* min-width: 800px; */
|
||||
}
|
||||
div.clearer {
|
||||
clear: both;
|
||||
@ -31,11 +29,11 @@ hr {
|
||||
border-style: none;
|
||||
}
|
||||
span.arrow {
|
||||
font-family:Arial,Helvetica,Courier,sans-serif;
|
||||
font-family: Arial,Helvetica,Courier,sans-serif;
|
||||
font-size: 80%;
|
||||
}
|
||||
p.arrow_button input {
|
||||
font-family:Arial,Helvetica,Courier,sans-serif;
|
||||
font-family: Arial,Helvetica,Courier,sans-serif;
|
||||
font-size: 80%;
|
||||
}
|
||||
table.generaltable {
|
||||
@ -120,9 +118,8 @@ table.generaltable td.cell {
|
||||
border-color: #DDDDDD;
|
||||
}
|
||||
div.informationbox {
|
||||
background-color: #EEEEEE;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #f1ece6;
|
||||
border: 1px solid;
|
||||
border-color: #FFFFFF #DDDDDD #DDDDDD #FFFFFF;
|
||||
}
|
||||
table.userinfobox {
|
||||
@ -229,6 +226,7 @@ div.sideblock div.header {
|
||||
div.sideblock div.content {
|
||||
padding: 0.3em 0.3em 0.5em;
|
||||
border-style: none;
|
||||
background-color: #f1ece6;
|
||||
}
|
||||
div.sideblock table.minicalendar td.day {
|
||||
text-align: center;
|
||||
@ -340,6 +338,15 @@ div.block_calendar_month td.event_user {
|
||||
background-color: #DCE7EC;
|
||||
border-color: #DCE7EC;
|
||||
}
|
||||
div.block_calendar_month div.filters table {
|
||||
background-color: inherit;
|
||||
}
|
||||
table#calendar td.maincalendar div.filters table {
|
||||
background-color: inherit;
|
||||
}
|
||||
table#calendar td.sidecalendar div.filters table {
|
||||
background-color: inherit;
|
||||
}
|
||||
h3.eventskey {
|
||||
font-size: 100%;
|
||||
}
|
||||
@ -388,9 +395,24 @@ table#calendar td.event_global {
|
||||
body.admin table.generaltable {
|
||||
width: 100%;
|
||||
}
|
||||
body.admin div.generalboxcontent {
|
||||
background-color: inherit;
|
||||
border-style: none;
|
||||
}
|
||||
body.admin table.generalbox {
|
||||
background-color: inherit;
|
||||
border-style: none;
|
||||
}
|
||||
body.admin td.generalboxcontent {
|
||||
background-color: inherit;
|
||||
border-style: none;
|
||||
}
|
||||
body#course-view tr.section td.side {
|
||||
border-style: none;
|
||||
}
|
||||
body#course-view tr.current td.side {
|
||||
background: #f1ece6;
|
||||
}
|
||||
body#course-view tr.section td.content {
|
||||
padding-bottom: 1.5em;
|
||||
border-style: none;
|
||||
@ -416,6 +438,12 @@ div.sideblock ul.list li {
|
||||
div.block_rss_client ul.list li {
|
||||
padding-left: 0;
|
||||
}
|
||||
div.block_messages div.content {
|
||||
font-size: inherit;
|
||||
}
|
||||
div.block_messages div.content div.info {
|
||||
text-align: left;
|
||||
}
|
||||
div.sideblock div.column.c0 {
|
||||
margin-left: -19px;
|
||||
}
|
||||
@ -478,6 +506,7 @@ div.sideblock div.header div.commands {
|
||||
form#adminsettings fieldset {
|
||||
margin-top: 1em;
|
||||
padding: 0;
|
||||
background-color: inherit;
|
||||
}
|
||||
fieldset.adminsettings span.form-shortname {
|
||||
color: #AAAAAA;
|
||||
@ -506,7 +535,8 @@ form.mform div.textarea textarea {
|
||||
width: 35em;
|
||||
}
|
||||
form#adminsettings div.form-item {
|
||||
/*background: url(pix/small_bg_gradient.png) repeat-x 0 bottom;*/
|
||||
|
||||
/*background: url(pix/small_bg_gradient.png) repeat-x 0 bottom;*/
|
||||
border-top: 1px solid #F1ECE6;
|
||||
}
|
||||
form#adminsettings .form-label {
|
||||
@ -525,8 +555,8 @@ body#admin-lang table.translator {
|
||||
body#admin-langimport div.generalbox {
|
||||
border-style: none;
|
||||
}
|
||||
div.htmlarea iframe{
|
||||
/*width: 600px !important;*/
|
||||
div.htmlarea iframe {
|
||||
|
||||
}
|
||||
div#header-home {
|
||||
position: relative;
|
||||
@ -1162,7 +1192,7 @@ div.coursebox div.summary {
|
||||
}
|
||||
body#mod-forum-view div.subscription {
|
||||
float: none;
|
||||
text-align:right;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.forumpost tr.header {
|
||||
@ -1170,6 +1200,15 @@ table.forumpost tr.header {
|
||||
background-repeat: repeat-x;
|
||||
background-position: left bottom;
|
||||
}
|
||||
table.forumpost td.starter {
|
||||
background: inherit;
|
||||
}
|
||||
table.forumpost td.left {
|
||||
background: inherit;
|
||||
}
|
||||
table.forumpost td.picture {
|
||||
background: #fff;
|
||||
}
|
||||
table.forumpost {
|
||||
margin-top: 20px;
|
||||
border-style: none;
|
||||
@ -1203,6 +1242,9 @@ td.content {
|
||||
div.glossarydisplay table.glossarypost {
|
||||
border-color: #F1ECE6;
|
||||
}
|
||||
div.glossarydisplay table.glossarycategoryheader {
|
||||
background-color: inherit;
|
||||
}
|
||||
div.glossarydisplay div.entrybox {
|
||||
border-color: #F1ECE6;
|
||||
}
|
||||
@ -1329,23 +1371,21 @@ body.grade-report-grader table#user-grades td.course {
|
||||
font-weight: bold;
|
||||
}
|
||||
#admin-roles-override .capcurrent {
|
||||
background-color:#FFFFFF;
|
||||
background-color: #FFFFFF;
|
||||
border: 1px solid #cecece;
|
||||
}
|
||||
|
||||
#admin-roles-manage .capdefault {
|
||||
background-color:#dddddd;
|
||||
background-color: #dddddd;
|
||||
border: 1px solid #cecece;
|
||||
}
|
||||
|
||||
#admin-roles-manage .rolecap {
|
||||
border:none;
|
||||
border-bottom:1px solid;
|
||||
border: none;
|
||||
border-bottom: 1px solid;
|
||||
border-bottom-color: #cecece;
|
||||
}
|
||||
#admin-roles-override .rolecap {
|
||||
border:none;
|
||||
border-bottom:1px solid;
|
||||
border: none;
|
||||
border-bottom: 1px solid;
|
||||
border-bottom-color: #cecece;
|
||||
}
|
||||
#admin-roles-manage .rolecap .cap-desc .cap-name {
|
||||
@ -1354,43 +1394,31 @@ body.grade-report-grader table#user-grades td.course {
|
||||
#admin-roles-override .rolecap .cap-desc .cap-name {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.plugincompattable {
|
||||
font-size: 70%;
|
||||
font-size: 90%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.plugincompattable td.standard {
|
||||
font-weight: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.plugincompattable td.nonstandard {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plugincompattable td.missingplugin {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plugincompattable td.warning {
|
||||
font-style: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.plugincompattable {
|
||||
text-align: left;
|
||||
.plugincheckwrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.plugincheckwrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.plugincompattable td.ok {
|
||||
color: #008000;
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
.plugincompattable td.warning {
|
||||
color: #DF7800;
|
||||
color: #DF7800;
|
||||
}
|
||||
|
||||
.plugincompattable td.error {
|
||||
color: #DF0000;
|
||||
}
|
||||
color: #DF0000;
|
||||
}
|