Added reponse handling for xsd static file rendering

Change-Id: Iccf2b5b4947d2d8c16ddcf4412657d01bd570729
This commit is contained in:
Ziad Sawalha 2011-08-14 16:59:17 -05:00
parent 6449ae382d
commit e8c35a7f23
30 changed files with 3839 additions and 7 deletions

View File

@ -50,6 +50,7 @@ import mimetypes
from webob import Response
from paste.util.template import TemplateError
from paste.util.datetimeutil import parse_date
import datetime
import keystone.logic.types.fault as fault
from keystone.logic.types.fault import ForbiddenFault
@ -331,12 +332,18 @@ def static_file(resp, req, filename, root, guessmime=True, mimetype=None,
ims = req.environ.get('HTTP_IF_MODIFIED_SINCE')
if ims:
ims = ims.split(";")[0].strip() # IE sends "<date>; length=146"
ims = parse_date(ims)
if ims is not None and ims >= int(stats.st_mtime):
resp.date = time.strftime(
"%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
return Response(body=None, status=304, headerlist=resp.headerlist)
try:
ims = datetime.datetime.fromtimestamp(stats.st_mtime)
ims = datetime.datetime.ctime(ims)
filetime = datetime.datetime.fromtimestamp(stats.st_mtime)
if ims is not None and ims >= filetime:
resp.date = time.strftime(
"%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
return Response(body=None, status=304,
headerlist=resp.headerlist)
except:
print "TODO(Ziad): handle this better"
pass
resp.content_length = stats.st_size
if req.method == 'HEAD':
return Response(body=None, status=200, headerlist=resp.headerlist)

View File

@ -0,0 +1,337 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['java'] = [
[
[
/\b(?:import|package)\b/g,
'sh_preproc',
-1
],
[
/\/\/\//g,
'sh_comment',
1
],
[
/\/\//g,
'sh_comment',
7
],
[
/\/\*\*/g,
'sh_comment',
8
],
[
/\/\*/g,
'sh_comment',
9
],
[
/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
'sh_number',
-1
],
[
/"/g,
'sh_string',
10
],
[
/'/g,
'sh_string',
11
],
[
/(\b(?:class|interface))([ \t]+)([$A-Za-z0-9_]+)/g,
['sh_keyword', 'sh_normal', 'sh_classname'],
-1
],
[
/\b(?:abstract|assert|break|case|catch|class|const|continue|default|do|else|extends|false|final|finally|for|goto|if|implements|instanceof|interface|native|new|null|private|protected|public|return|static|strictfp|super|switch|synchronized|throw|throws|true|this|transient|try|volatile|while)\b/g,
'sh_keyword',
-1
],
[
/\b(?:int|byte|boolean|char|long|float|double|short|void)\b/g,
'sh_type',
-1
],
[
/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
'sh_symbol',
-1
],
[
/\{|\}/g,
'sh_cbracket',
-1
],
[
/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,
'sh_function',
-1
],
[
/([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,
['sh_usertype', 'sh_usertype', 'sh_normal'],
-1
]
],
[
[
/$/g,
null,
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
5
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/$/g,
null,
-2
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/"/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
],
[
[
/'/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
]
];

View File

@ -0,0 +1,347 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['javascript'] = [
[
[
/\/\/\//g,
'sh_comment',
1
],
[
/\/\//g,
'sh_comment',
7
],
[
/\/\*\*/g,
'sh_comment',
8
],
[
/\/\*/g,
'sh_comment',
9
],
[
/\b(?:abstract|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|final|finally|for|function|goto|if|implements|in|instanceof|interface|native|new|null|private|protected|prototype|public|return|static|super|switch|synchronized|throw|throws|this|transient|true|try|typeof|var|volatile|while|with)\b/g,
'sh_keyword',
-1
],
[
/(\+\+|--|\)|\])(\s*)(\/=?(?![*\/]))/g,
['sh_symbol', 'sh_normal', 'sh_symbol'],
-1
],
[
/(0x[A-Fa-f0-9]+|(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?)(\s*)(\/(?![*\/]))/g,
['sh_number', 'sh_normal', 'sh_symbol'],
-1
],
[
/([A-Za-z$_][A-Za-z0-9$_]*\s*)(\/=?(?![*\/]))/g,
['sh_normal', 'sh_symbol'],
-1
],
[
/\/(?:\\.|[^*\\\/])(?:\\.|[^\\\/])*\/[gim]*/g,
'sh_regexp',
-1
],
[
/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
'sh_number',
-1
],
[
/"/g,
'sh_string',
10
],
[
/'/g,
'sh_string',
11
],
[
/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
'sh_symbol',
-1
],
[
/\{|\}/g,
'sh_cbracket',
-1
],
[
/\b(?:Math|Infinity|NaN|undefined|arguments)\b/g,
'sh_predef_var',
-1
],
[
/\b(?:Array|Boolean|Date|Error|EvalError|Function|Number|Object|RangeError|ReferenceError|RegExp|String|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt)\b/g,
'sh_predef_func',
-1
],
[
/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,
'sh_function',
-1
]
],
[
[
/$/g,
null,
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
5
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/$/g,
null,
-2
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/"/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
],
[
[
/'/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
]
];

View File

@ -0,0 +1,538 @@
/*
SHJS - Syntax Highlighting in JavaScript
Copyright (C) 2007, 2008 gnombat@users.sourceforge.net
License: http://shjs.sourceforge.net/doc/gplv3.html
*/
if (! this.sh_languages) {
this.sh_languages = {};
}
var sh_requests = {};
function sh_isEmailAddress(url) {
if (/^mailto:/.test(url)) {
return false;
}
return url.indexOf('@') !== -1;
}
function sh_setHref(tags, numTags, inputString) {
var url = inputString.substring(tags[numTags - 2].pos, tags[numTags - 1].pos);
if (url.length >= 2 && url.charAt(0) === '<' && url.charAt(url.length - 1) === '>') {
url = url.substr(1, url.length - 2);
}
if (sh_isEmailAddress(url)) {
url = 'mailto:' + url;
}
tags[numTags - 2].node.href = url;
}
/*
Konqueror has a bug where the regular expression /$/g will not match at the end
of a line more than once:
var regex = /$/g;
var match;
var line = '1234567890';
regex.lastIndex = 10;
match = regex.exec(line);
var line2 = 'abcde';
regex.lastIndex = 5;
match = regex.exec(line2); // fails
*/
function sh_konquerorExec(s) {
var result = [''];
result.index = s.length;
result.input = s;
return result;
}
/**
Highlights all elements containing source code in a text string. The return
value is an array of objects, each representing an HTML start or end tag. Each
object has a property named pos, which is an integer representing the text
offset of the tag. Every start tag also has a property named node, which is the
DOM element started by the tag. End tags do not have this property.
@param inputString a text string
@param language a language definition object
@return an array of tag objects
*/
function sh_highlightString(inputString, language) {
if (/Konqueror/.test(navigator.userAgent)) {
if (! language.konquered) {
for (var s = 0; s < language.length; s++) {
for (var p = 0; p < language[s].length; p++) {
var r = language[s][p][0];
if (r.source === '$') {
r.exec = sh_konquerorExec;
}
}
}
language.konquered = true;
}
}
var a = document.createElement('a');
var span = document.createElement('span');
// the result
var tags = [];
var numTags = 0;
// each element is a pattern object from language
var patternStack = [];
// the current position within inputString
var pos = 0;
// the name of the current style, or null if there is no current style
var currentStyle = null;
var output = function(s, style) {
var length = s.length;
// this is more than just an optimization - we don't want to output empty <span></span> elements
if (length === 0) {
return;
}
if (! style) {
var stackLength = patternStack.length;
if (stackLength !== 0) {
var pattern = patternStack[stackLength - 1];
// check whether this is a state or an environment
if (! pattern[3]) {
// it's not a state - it's an environment; use the style for this environment
style = pattern[1];
}
}
}
if (currentStyle !== style) {
if (currentStyle) {
tags[numTags++] = {pos: pos};
if (currentStyle === 'sh_url') {
sh_setHref(tags, numTags, inputString);
}
}
if (style) {
var clone;
if (style === 'sh_url') {
clone = a.cloneNode(false);
}
else {
clone = span.cloneNode(false);
}
clone.className = style;
tags[numTags++] = {node: clone, pos: pos};
}
}
pos += length;
currentStyle = style;
};
var endOfLinePattern = /\r\n|\r|\n/g;
endOfLinePattern.lastIndex = 0;
var inputStringLength = inputString.length;
while (pos < inputStringLength) {
var start = pos;
var end;
var startOfNextLine;
var endOfLineMatch = endOfLinePattern.exec(inputString);
if (endOfLineMatch === null) {
end = inputStringLength;
startOfNextLine = inputStringLength;
}
else {
end = endOfLineMatch.index;
startOfNextLine = endOfLinePattern.lastIndex;
}
var line = inputString.substring(start, end);
var matchCache = [];
for (;;) {
var posWithinLine = pos - start;
var stateIndex;
var stackLength = patternStack.length;
if (stackLength === 0) {
stateIndex = 0;
}
else {
// get the next state
stateIndex = patternStack[stackLength - 1][2];
}
var state = language[stateIndex];
var numPatterns = state.length;
var mc = matchCache[stateIndex];
if (! mc) {
mc = matchCache[stateIndex] = [];
}
var bestMatch = null;
var bestPatternIndex = -1;
for (var i = 0; i < numPatterns; i++) {
var match;
if (i < mc.length && (mc[i] === null || posWithinLine <= mc[i].index)) {
match = mc[i];
}
else {
var regex = state[i][0];
regex.lastIndex = posWithinLine;
match = regex.exec(line);
mc[i] = match;
}
if (match !== null && (bestMatch === null || match.index < bestMatch.index)) {
bestMatch = match;
bestPatternIndex = i;
if (match.index === posWithinLine) {
break;
}
}
}
if (bestMatch === null) {
output(line.substring(posWithinLine), null);
break;
}
else {
// got a match
if (bestMatch.index > posWithinLine) {
output(line.substring(posWithinLine, bestMatch.index), null);
}
var pattern = state[bestPatternIndex];
var newStyle = pattern[1];
var matchedString;
if (newStyle instanceof Array) {
for (var subexpression = 0; subexpression < newStyle.length; subexpression++) {
matchedString = bestMatch[subexpression + 1];
output(matchedString, newStyle[subexpression]);
}
}
else {
matchedString = bestMatch[0];
output(matchedString, newStyle);
}
switch (pattern[2]) {
case -1:
// do nothing
break;
case -2:
// exit
patternStack.pop();
break;
case -3:
// exitall
patternStack.length = 0;
break;
default:
// this was the start of a delimited pattern or a state/environment
patternStack.push(pattern);
break;
}
}
}
// end of the line
if (currentStyle) {
tags[numTags++] = {pos: pos};
if (currentStyle === 'sh_url') {
sh_setHref(tags, numTags, inputString);
}
currentStyle = null;
}
pos = startOfNextLine;
}
return tags;
}
////////////////////////////////////////////////////////////////////////////////
// DOM-dependent functions
function sh_getClasses(element) {
var result = [];
var htmlClass = element.className;
if (htmlClass && htmlClass.length > 0) {
var htmlClasses = htmlClass.split(' ');
for (var i = 0; i < htmlClasses.length; i++) {
if (htmlClasses[i].length > 0) {
result.push(htmlClasses[i]);
}
}
}
return result;
}
function sh_addClass(element, name) {
var htmlClasses = sh_getClasses(element);
for (var i = 0; i < htmlClasses.length; i++) {
if (name.toLowerCase() === htmlClasses[i].toLowerCase()) {
return;
}
}
htmlClasses.push(name);
element.className = htmlClasses.join(' ');
}
/**
Extracts the tags from an HTML DOM NodeList.
@param nodeList a DOM NodeList
@param result an object with text, tags and pos properties
*/
function sh_extractTagsFromNodeList(nodeList, result) {
var length = nodeList.length;
for (var i = 0; i < length; i++) {
var node = nodeList.item(i);
switch (node.nodeType) {
case 1:
if (node.nodeName.toLowerCase() === 'br') {
var terminator;
if (/MSIE/.test(navigator.userAgent)) {
terminator = '\r';
}
else {
terminator = '\n';
}
result.text.push(terminator);
result.pos++;
}
else {
result.tags.push({node: node.cloneNode(false), pos: result.pos});
sh_extractTagsFromNodeList(node.childNodes, result);
result.tags.push({pos: result.pos});
}
break;
case 3:
case 4:
result.text.push(node.data);
result.pos += node.length;
break;
}
}
}
/**
Extracts the tags from the text of an HTML element. The extracted tags will be
returned as an array of tag objects. See sh_highlightString for the format of
the tag objects.
@param element a DOM element
@param tags an empty array; the extracted tag objects will be returned in it
@return the text of the element
@see sh_highlightString
*/
function sh_extractTags(element, tags) {
var result = {};
result.text = [];
result.tags = tags;
result.pos = 0;
sh_extractTagsFromNodeList(element.childNodes, result);
return result.text.join('');
}
/**
Merges the original tags from an element with the tags produced by highlighting.
@param originalTags an array containing the original tags
@param highlightTags an array containing the highlighting tags - these must not overlap
@result an array containing the merged tags
*/
function sh_mergeTags(originalTags, highlightTags) {
var numOriginalTags = originalTags.length;
if (numOriginalTags === 0) {
return highlightTags;
}
var numHighlightTags = highlightTags.length;
if (numHighlightTags === 0) {
return originalTags;
}
var result = [];
var originalIndex = 0;
var highlightIndex = 0;
while (originalIndex < numOriginalTags && highlightIndex < numHighlightTags) {
var originalTag = originalTags[originalIndex];
var highlightTag = highlightTags[highlightIndex];
if (originalTag.pos <= highlightTag.pos) {
result.push(originalTag);
originalIndex++;
}
else {
result.push(highlightTag);
if (highlightTags[highlightIndex + 1].pos <= originalTag.pos) {
highlightIndex++;
result.push(highlightTags[highlightIndex]);
highlightIndex++;
}
else {
// new end tag
result.push({pos: originalTag.pos});
// new start tag
highlightTags[highlightIndex] = {node: highlightTag.node.cloneNode(false), pos: originalTag.pos};
}
}
}
while (originalIndex < numOriginalTags) {
result.push(originalTags[originalIndex]);
originalIndex++;
}
while (highlightIndex < numHighlightTags) {
result.push(highlightTags[highlightIndex]);
highlightIndex++;
}
return result;
}
/**
Inserts tags into text.
@param tags an array of tag objects
@param text a string representing the text
@return a DOM DocumentFragment representing the resulting HTML
*/
function sh_insertTags(tags, text) {
var doc = document;
var result = document.createDocumentFragment();
var tagIndex = 0;
var numTags = tags.length;
var textPos = 0;
var textLength = text.length;
var currentNode = result;
// output one tag or text node every iteration
while (textPos < textLength || tagIndex < numTags) {
var tag;
var tagPos;
if (tagIndex < numTags) {
tag = tags[tagIndex];
tagPos = tag.pos;
}
else {
tagPos = textLength;
}
if (tagPos <= textPos) {
// output the tag
if (tag.node) {
// start tag
var newNode = tag.node;
currentNode.appendChild(newNode);
currentNode = newNode;
}
else {
// end tag
currentNode = currentNode.parentNode;
}
tagIndex++;
}
else {
// output text
currentNode.appendChild(doc.createTextNode(text.substring(textPos, tagPos)));
textPos = tagPos;
}
}
return result;
}
/**
Highlights an element containing source code. Upon completion of this function,
the element will have been placed in the "sh_sourceCode" class.
@param element a DOM <pre> element containing the source code to be highlighted
@param language a language definition object
*/
function sh_highlightElement(element, language) {
sh_addClass(element, 'sh_sourceCode');
var originalTags = [];
var inputString = sh_extractTags(element, originalTags);
var highlightTags = sh_highlightString(inputString, language);
var tags = sh_mergeTags(originalTags, highlightTags);
var documentFragment = sh_insertTags(tags, inputString);
while (element.hasChildNodes()) {
element.removeChild(element.firstChild);
}
element.appendChild(documentFragment);
}
function sh_getXMLHttpRequest() {
if (window.ActiveXObject) {
return new ActiveXObject('Msxml2.XMLHTTP');
}
else if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
throw 'No XMLHttpRequest implementation available';
}
function sh_load(language, element, prefix, suffix) {
if (language in sh_requests) {
sh_requests[language].push(element);
return;
}
sh_requests[language] = [element];
var request = sh_getXMLHttpRequest();
var url = prefix + 'sh_' + language + suffix;
request.open('GET', url, true);
request.onreadystatechange = function () {
if (request.readyState === 4) {
try {
if (! request.status || request.status === 200) {
eval(request.responseText);
var elements = sh_requests[language];
for (var i = 0; i < elements.length; i++) {
sh_highlightElement(elements[i], sh_languages[language]);
}
}
else {
throw 'HTTP error: status ' + request.status;
}
}
finally {
request = null;
}
}
};
request.send(null);
}
/**
Highlights all elements containing source code on the current page. Elements
containing source code must be "pre" elements with a "class" attribute of
"sh_LANGUAGE", where LANGUAGE is a valid language identifier; e.g., "sh_java"
identifies the element as containing "java" language source code.
*/
function sh_highlightDocument(prefix, suffix) {
var nodeList = document.getElementsByTagName('pre');
for (var i = 0; i < nodeList.length; i++) {
var element = nodeList.item(i);
var htmlClasses = sh_getClasses(element);
for (var j = 0; j < htmlClasses.length; j++) {
var htmlClass = htmlClasses[j].toLowerCase();
if (htmlClass === 'sh_sourcecode') {
continue;
}
if (htmlClass.substr(0, 3) === 'sh_') {
var language = htmlClass.substring(3);
if (language in sh_languages) {
sh_highlightElement(element, sh_languages[language]);
}
else if (typeof(prefix) === 'string' && typeof(suffix) === 'string') {
sh_load(language, element, prefix, suffix);
}
else {
throw 'Found <pre> element with class="' + htmlClass + '", but no such language exists';
}
break;
}
}
}
}

View File

@ -0,0 +1,115 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['xml'] = [
[
[
/<\?xml/g,
'sh_preproc',
1,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
3,
1
],
[
/<!--/g,
'sh_comment',
4
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
5,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
4
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
]
];

View File

@ -0,0 +1,184 @@
/**
controller.js
(C) 2009 Rackspace Hosting, All Rights Reserved
This file definas a single object in global scope:
trc.schema.controller
The controller object is responsible for displaying a menu that
allows users to view schema source and jump to various definitions
in the schema.
**/
//
// Initialization code...
//
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// We use YUI to build our controller menu make sure we have the
// proper dependecies loaded, call init when we do...
//
function InitController()
{
trc.schema.controller._init();
}
trc.util.yui.loadYUIDeps (["menu"], InitController);
})();
if (!trc.schema)
{
trc.schema = new Object();
}
trc.schema.controller = {
//
// Internal and external links by type:
//
// type --> array of links
//
// possible types include: import, include, element,
// attribute, complextype, simpleType
//
// each link contains the following properties:
// name : the name of the link
// href : the link itself
// title : a description of the link
links : new Object(),
//
// A single link that points to the schema index document.
//
index : null,
//
// Our initialization function
//
_init : function() {
//
// Load the menu...
//
var controllerDiv = document.getElementById("Controller");
var mainMenu = this._menuMarkup("mainmenu");
for (var linkType in this.links)
{
var subItem = this._menuItemMarkup(mainMenu, linkType, "#", null);
var subMenu = this._menuMarkup (linkType+"_subMenu");
var items = this.links[linkType];
for (var i=0;i<items.length;i++)
{
this._menuItemMarkup (subMenu,
items[i].name,
items[i].href,
items[i].title);
}
subItem.item.appendChild (subMenu.main);
}
//
// Toggle view source menu
//
this._menuItemMarkup (mainMenu, "toggle src view",
"javascript:trc.schema.sampleManager.toggleSrcView()", null);
//
// Index schema document
//
if (this.index != null)
{
this._menuItemMarkup (mainMenu, this.index.name,
this.index.href, this.index.title);
}
controllerDiv.appendChild (mainMenu.main);
var oMenu = new YAHOO.widget.Menu("mainmenu", {position: "static"});
oMenu.render();
oMenu.show();
},
//
// Builds menu markup returns the associated divs in the
// properties main, body, header, footer, and list
//
_menuMarkup : function(id /*Id for main part*/)
{
//
// Build our menu div...
//
var mainDiv = document.createElement("div");
var headerDiv = document.createElement("div");
var bodyDiv = document.createElement("div");
var footerDiv = document.createElement("div");
var listDiv = document.createElement("ul");
mainDiv.setAttribute ("id", id);
trc.util.dom.setClassName (mainDiv, "yuimenu");
trc.util.dom.setClassName (headerDiv, "hd");
trc.util.dom.setClassName (bodyDiv, "bd");
trc.util.dom.setClassName (footerDiv, "ft");
mainDiv.appendChild (headerDiv);
mainDiv.appendChild (bodyDiv);
mainDiv.appendChild (footerDiv);
bodyDiv.appendChild (listDiv);
return {
main : mainDiv,
body : bodyDiv,
header : headerDiv,
footer : footerDiv,
list : listDiv
};
},
//
// Adds a menu item to existing markup.
//
_menuItemMarkup : function (menu, /*Markup returned from _menuMarkup*/
name, /* String, menu item name */
href, /* String, menu item href */
title /* String, title (tool tip)*/
)
{
var listItem = document.createElement ("li");
var link = document.createElement ("a");
trc.util.dom.setClassName (listItem, "yuimenuitem");
trc.util.dom.setClassName (link, "yuimenuitemlabel");
link.setAttribute ("href", href);
if (title != null)
{
link.setAttribute ("title", title);
}
link.appendChild (document.createTextNode(name));
listItem.appendChild (link);
menu.list.appendChild(listItem);
return {
item : listItem,
anchor : link
};
}
};

View File

@ -0,0 +1,137 @@
/**
layoutManager.js
(C) 2009 Rackspace Hosting, All Rights Reserved
This file contains code that adjusts the layout of a schema
document after a dom has been loaded. It does not modify the
global scope.
**/
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// This function should be called when the DOM is loaded so we
// can get to work adjusting things.
//
function InitLayoutManager()
{
layoutManager._init();
}
trc.util.browser.addInitFunction (InitLayoutManager);
var layoutManager={
//
// Initialization function...
//
_init : function()
{
this._adjustMain();
this._adjustSubElements();
},
//
// Applies appropriate styles to body and other main content
// tags.
//
_adjustMain : function()
{
//
// Change the class name for the correct YUI skin name.
//
var bodyTags = document.getElementsByTagName("body");
if (bodyTags.length == 0)
{
throw new Error ("Couldn't find body element, bad DOM?");
}
else
{
trc.util.dom.setClassName(bodyTags[0], "yui-skin-sam");
}
//
// Setout the layout...
//
var docDiv = document.getElementById("doc");
var mainDiv = document.getElementById("Main");
trc.util.dom.setClassName (docDiv, "yui-t1");
docDiv.setAttribute ("id", "doc3");
mainDiv.setAttribute ("id", "yui-main");
//
// Old IE browser hacks...
//
switch (trc.util.browser.detectIEVersion())
{
//
// IE 6 does not support fixed positioning. The
// following is a little hack to get it to work.
//
//
case 6:
var controllerDiv = document.getElementById("Controller");
controllerDiv.style.position="absolute";
window.setInterval((function(){
/* avoid leak by constantly querying for the
* controller. */
var ctrlDiv = document.getElementById("Controller");
ctrlDiv.style.top = document.documentElement.scrollTop+10;
}), 1000);
break;
//
// The controler doesn't work **at all** in IE 7
// don't even show it.
//
case 7:
var controllerDiv = document.getElementById("Controller");
controllerDiv.style.display = "none";
break;
}
},
//
// Adds appropriate classes for subElements...
//
_adjustSubElements : function()
{
var divs = document.getElementsByTagName("div");
for (var i=0;i<divs.length;i++)
{
var currentClass = divs[i].getAttribute ("class");
var newClassName = currentClass;
switch (currentClass)
{
case "SubItem" :
newClassName += " yui-gd";
break;
case "SubItemProps" :
newClassName += " yui-gd first";
break;
case "SubName" :
newClassName += " yui-u first";
break;
case "SubAttributes" :
case "SubDocumentation" :
newClassName += " yui-u";
break;
}
if (currentClass != newClassName)
{
trc.util.dom.setClassName (divs[i], newClassName);
}
}
}
};
})();

View File

@ -0,0 +1,342 @@
/**
schemaManager.js:
(C) 2009 Rackspace Hosting, All Rights Reserved
This file defines a single object in global scope:
trc.schema.sampleManager
The object is responsible for loading, formatting, and displaying
samples in schema files. It expects trc.util to be defined which is
provided in trc/util.js.
Code highlighting is provided by SHJS
(http://shjs.sourceforge.net/). It should also be loaded before
this code is initialized.
All methods/properties prepended with an underscore (_) are meant
for internal use.
**/
//
// Initialization code...
//
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// Make sure syntax highlighter scripts are loaded, if not then
// load them.
//
if (!window.sh_highlightDocument)
{
trc.util.dom.addStyle ("../style/shjs/sh_darkblue.css");
trc.util.dom.addScript ("../js/shjs/sh_main.js");
trc.util.dom.addScript ("../js/shjs/sh_xml.js");
trc.util.dom.addScript ("../js/shjs/sh_javascript.js");
trc.util.dom.addScript ("../js/shjs/sh_java.js");
}
function InitSchemaSampleManager()
{
trc.schema.sampleManager._init();
}
trc.util.browser.addInitFunction(InitSchemaSampleManager);
})();
//
// Define trc.schema.sampleManager...
//
if (!trc.schema)
{
trc.schema = new Object();
}
trc.schema.sampleManager = {
//
// All sample data in an associative array:
//
// Select Element ID -> Array of sample ids.
//
samples : new Object(),
//
// An array of code data..
//
// Code data is defined as an object with the following
// properties:
//
// type: The mimetype of the code...href: The location of the code
// or null if it's inline
//
// id: The id of the pre that contains the code.
//
// The initial object is the source code for the current document.
//
codes : new Array({
id : "SrcContentCode",
type : "application/xml",
href : (function() {
var ret = location.href;
if (location.hash && (location.hash.length != 0))
{
ret = ret.replace (location.hash, "");
}
return ret;
})()
}),
//
// Sets up the manager, begins the loading process...
//
_init : function() {
//
// Setup an array to hold data items to load, this is used by
// the loadSample method.
//
this._toLoad = new Array();
for (var i=0;i<this.codes.length;i++)
{
if ((this.codes[i] != null) &&
(this.codes[i].href != null))
{
this._toLoad.push (this.codes[i]);
}
}
//
// Loads the code text
//
this._loadCode();
},
//
// Loads the next sample in the toLoad array.
//
_loadCode : function() {
if (this._toLoad.length == 0)
{
//
// All samples have been loaded, fire the loadComplete
// method.
//
this._loadComplete();
return;
}
var codeData = this._toLoad.pop();
var request = trc.util.net.getHTTPRequest();
var manager = this;
request.onreadystatechange = function() {
if (request.readyState == 4 /* Ready */) {
if (request.status == 200 /* OKAY */) {
manager._setCodeText (codeData, request.responseText);
}
else
{
manager._setCodeText (codeData, "Could not load sample ("+request.status+") "+request.responseText);
}
manager._loadCode();
}
};
request.open ("GET", codeData.href);
request.send(null);
},
//
// Called after all samples are loaded into the DOM.
//
_loadComplete : function()
{
//
// Normalize all code samples..
//
this._normalizeCodeText(1, 1, 5);
//
// Perform syntax highlighting...
//
sh_highlightDocument();
//
// All samples are initially hidden, show the selected
// samples...
//
for (var optionID in this.samples)
{
this.showSample(optionID);
}
//
// We've adjusted the document, we need to setup the view so
// that we're still pointing to the hash target.
//
if (window.location.hash &&
(window.location.hash.length != 0))
{
window.location.href = window.location.hash;
}
},
//
// Sets code text replacing any text already existing there.
//
_setCodeText : function ( codeData /* Info of the code to set (code object) */,
code /* Code text to set (string) */)
{
//
// Preprocess the txt if nessesary...
//
var ieVersion = trc.util.browser.detectIEVersion();
if ((ieVersion > -1) &&
(ieVersion < 8))
{
code = trc.util.text.unix2dos (code);
}
var pre = document.getElementById(codeData.id);
var preNodes = pre.childNodes;
//
// Remove placeholder data...
//
while (preNodes.length != 0)
{
pre.removeChild (preNodes[0]);
}
//
// Set the correct class type...
//
switch (codeData.type)
{
/*
Javascript mimetypes
*/
case 'application/json':
case 'application/javascript':
case 'application/x-javascript':
case 'application/ecmascript':
case 'text/ecmascript':
case 'text/javascript':
trc.util.dom.setClassName (pre, "sh_javascript");
break;
/*
Not real mimetypes but this is what we'll use for Java.
*/
case 'application/java':
case 'text/java':
trc.util.dom.setClassName (pre, "sh_java");
break;
default:
trc.util.dom.setClassName (pre, "sh_xml");
break;
}
//
// Add new code...
//
pre.appendChild (document.createTextNode (code));
},
//
// Retrives source code text
//
_getCodeText : function (codeData /* Info for the code to get*/)
{
var pre = document.getElementById(codeData.id);
pre.normalize();
//
// Should be a single text node after pre...
//
return pre.firstChild.nodeValue;
},
//
// Normalizes text by ensuring that top, bottom, right indent
// levels are equal for all samples.
//
_normalizeCodeText : function (top, /* integer, top indent in lines */
bottom, /* integer, bottom indent in lines */
right /* integer, right indent in spaces */
)
{
for (var i=0;i<this.codes.length;i++)
{
if (this.codes[i] != null)
{
var code = this._getCodeText (this.codes[i]);
code = trc.util.text.setIndent (code, top, bottom, right);
this._setCodeText (this.codes[i], code);
}
}
},
//
// This event handler shows the appropriate sample given an ID
// to the select element.
//
showSample : function (selectID) /* ID of the Select element */
{
//
// Get the selected value
//
var selected = document.getElementById(selectID);
var selectedValue = selected.options[selected.selectedIndex].value;
var samples = this.samples[selectID];
//
// Undisplay old samples, display selected ones.
//
for (var i=0;i<samples.length;i++)
{
if (samples[i] != null)
{
var sample = document.getElementById (samples[i]);
if (samples[i] == selectedValue)
{
sample.style.display = "block";
}
else
{
sample.style.display = "none";
}
}
}
},
//
// Toggles the current source view. If the source is displayed it
// undisplays it and vice versa.
//
toggleSrcView : function()
{
var content = document.getElementById ("Content");
var src = document.getElementById ("SrcContent");
if (content.style.display != "none")
{
content.style.display = "none";
src.style.display = "block";
}
else
{
content.style.display = "block";
src.style.display = "none";
}
}
};

View File

@ -0,0 +1,564 @@
/**
util.js:
(C) 2009 Rackspace Hosting, All Rights Reserved
This file defines a single object in global scope:
trc.util
The util object contains internal objects which contain useful
utility properties and methods.
trc.util.browser: contains methods for browser detection.
trc.util.dom: contains methods for manipulating the DOM.
trc.util.text: contains methods and properties useful when working
with plain text.
trc.util.net: contains methods for creating HTTP requests.
trc.util.yui : contains methods for working with the YUI toolkit.
All methods/properties prepended with an underscore (_) are meant
for internal use.
**/
//
// Define TRC
//
if (!window.trc)
{
trc= new Object();
}
trc.util = new Object();
trc.util.browser = {
//
// Returns the current version of IE, or -1 if it's not an IE
// browser. This is one of the recomended ways of detecting IE
// see:
//
// http://msdn.microsoft.com/en-us/library/ms537509%28VS.85%29.aspx
//
detectIEVersion : function() {
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
},
//
// A list of functions to execute on init.
//
_initFuns : new Array(),
//
// Has the init function event been set?
//
_initFunSet: false,
//
// Function called when the DOM has loaded. It launches all init
// functions.
//
_onInit : function()
{
//
// Sort by order...
//
this._initFuns.sort(function(a, b){ return a.order - b.order; });
for (var i=0;i<this._initFuns.length;i++)
{
this._initFuns[i]();
}
},
//
// Adds a function that should be executed when the dom is
// loaded.
//
addInitFunction : function(init, /*Function to call after dom
* is loaded*/
order /* An optional it specifing
* order. The bigger the int the
* later it will run. Default is
* 1.*/
) {
if (arguments.length < 2)
{
init.order = 1;
}
else
{
init.order = order;
}
this._initFuns.push (init);
if (!this._initFunSet)
{
var butil = this;
function initFun()
{
return (function(){ butil._onInit(); });
}
//
// Try event listeners, attachEvent and if that fails use
// window.onload...
//
if (window.addEventListener)
{
window.addEventListener("load", initFun(), false);
} else if (window.attachEvent)
{
window.attachEvent ("onload", initFun());
} else
{
window.onload = initFun();
}
this._initFunSet = true;
}
}
};
trc.util.dom = {
//
// Adds a new script tag to the current DOM.
//
addScript : function (src /* Script href */)
{
var scriptElement = document.createElement ("script");
scriptElement.setAttribute ("type", "text/javascript");
scriptElement.setAttribute ("src", src);
this.addToHead (scriptElement);
},
//
// Adds a new stylesheet to the current DOM.
//
addStyle : function (src /* Stylesheet href */)
{
var linkElement = document.createElement ("link");
linkElement.setAttribute ("rel", "stylesheet");
linkElement.setAttribute ("type", "text/css");
linkElement.setAttribute ("href", src);
this.addToHead (linkElement);
},
//
// Adds a DOM node to the HTTP head element. The element is
// always added as the last child an error is thrown if the
// head element can't be found.
//
addToHead : function (node /* A DOM node */)
{
var headArray = document.getElementsByTagName("head");
if (headArray.length == 0)
{
throw new Error("Couldn't find head element, bad DOM?");
}
else
{
headArray[0].appendChild (node);
}
},
//
// Dum utility function for setting the class name of an
// element. Eventually we'll move completely to XHTML, but
// this will never work in IE 6, so for now we need this
// method for setting the class name.
//
setClassName : function (element, /* DOM Element*/
name /* Class name to use */
)
{
var ieVersion = trc.util.browser.detectIEVersion();
if ((ieVersion > -1) &&
(ieVersion < 7))
{
element.className = name;
}
else
{
element.setAttribute ("class",name);
}
}
};
trc.util.text = {
//
// Useful RegExps
//
blank : new RegExp ("^\\s*$"), /* A blank string */
indent : new RegExp ("^\\s+"), /* Line indent */
lines : new RegExp ("$","m"), /* All lines */
linechars : new RegExp ("(\n|\r)"), /* EOL line characters */
tabs : new RegExp ("\t","g"), /* All tabs */
//
// We need this because microsoft browsers before IE 7, connot
// display pre-formatted text correctly win unix style line
// endings.
//
unix2dos : function(txt /* String */) {
//if already DOS...
if (txt.search(/\r\n/) != -1)
{
return txt;
}
return txt.replace (/\n/g, "\r\n");
},
//
// Useful to normalize text.
//
dos2unix : function(txt /* String */) {
//if already unix...
if (txt.search(/\r\n/) == -1)
{
return txt;
}
return txt.replace(/\r/g, "");
},
//
// Create a string with a character repeated x times.
//
repString : function (length, /* integer, size of the string to create */
ch /* string, The character to set the string to */
)
{
var ret = new String();
for (var i=0;i<length;i++) {ret=ret.concat(ch);}
return ret;
},
//
// Replace tabs in a text with strings.
//
replaceTabs : function (txt, /* String to modify */
length /* integer, tab length in spaces */
)
{
var tabs = this.repString(length, " ");
return txt.replace (this.tabs, tabs);
},
//
// Given multi-line text returns Adjust top and bottom indent
// (in lines) and right indent (in spaces)
//
setIndent : function (txt, /* String */
top, /* integer, top indent in lines */
bottom, /* integer, bottom indent in lines */
right /* integer, right indent in spaces */
)
{
//
// Can't indent an empty string..
//
if (txt.length == 0)
{
return txt;
}
//
// If not 0, bottom will be off by one...
//
if (bottom != 0)
{
bottom++;
}
var head=this.repString (top, "\n");
var tail=this.repString (bottom, "\n");
var marg=this.repString (right, " ");
var ntxt = this.dos2unix(txt);
var ntxt = this.replaceTabs (ntxt, 8);
var lines = ntxt.split (this.lines);
var origIndent=Number.MAX_VALUE;
var origIndentStr;
//
// Look up indent.
//
for (var i=0;i<lines.length;i++)
{
//
// Remove EOL characters...
//
lines[i] = lines[i].replace (this.linechars, "");
//
// Ignore blank lines
//
if (lines[i].match(this.blank) != null)
{
continue;
}
//
// Detect the indent if any...
//
var result = lines[i].match(this.indent);
if (result == null)
{
origIndent = 0;
origIndentStr = "";
}
else if (result[0].length < origIndent)
{
origIndent = result[0].length;
origIndentStr = result[0];
}
}
//
// This implys all line are blank...can't indent.
//
if (origIndent == Number.MAX_VALUE)
{
return txt;
}
if (origIndent != 0)
{
var regExStr = "^";
for (var i=0;i<origIndent;i++)
{
regExStr=regExStr.concat("\\s");
}
var indent = new RegExp(regExStr);
for (var i=0;i<lines.length;i++)
{
lines[i] = lines[i].replace(indent,marg);
}
}
else
{
for (var i=0;i<lines.length;i++)
{
lines[i] = marg.concat (lines[i]);
}
}
//
// Remove top...
//
while (lines.length != 0)
{
if (lines[0].match(this.blank))
{
lines.shift();
}
else
{
break;
}
}
//
// Remove bottom...
//
while (lines.length != 0)
{
if (lines[lines.length-1].match(this.blank))
{
lines.pop();
}
else
{
break;
}
}
var indented = lines.join("\n");
indented=head.concat(indented, tail);
return indented;
}
};
trc.util.net = {
//
// A list of possible factories for creating an XMLHTTPRequest
//
_HTTPReqFactories :
[
function() { return new XMLHttpRequest(); },
function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
],
//
// A cached XMLHTTPRequest factory that we know works in this
// browser
//
_HTTPReqFactory : null,
//
// Provides a way of getting an HTTPRequest object in a
// platform independent manner
//
getHTTPRequest : function()
{
//
// Use cache if available..
//
if (this._HTTPReqFactory != null) return this._HTTPReqFactory();
//
// Search for a factory..
//
for (var i=0; i< this._HTTPReqFactories.length; i++)
{
try {
var factory = this._HTTPReqFactories[i];
var request = factory();
if (request != null)
{
this._HTTPReqFactory = factory;
return request;
}
} catch (e) {
continue;
}
}
//
// Looks like we don't have support for XMLHttpRequest...
//
this._HTTPReqFactory = function() {throw new Error("XMLHttpRequest not supported");}
this._HTTPReqFactory();
return;
}
};
//
// Init code for trc.util.yui...
//
(function()
{
//
// Menu make sure we have the YUI loader as it's used by our
// init function to load YUI components.
//
if (!window.YAHOO)
{
//
// We are currently using YUI on YAHOO!'s servers we may
// want to change this.
//
var YUI_BASE="http://yui.yahooapis.com/2.7.0/";
trc.util.dom.addScript (YUI_BASE+"build/yuiloader/yuiloader-min.js");
}
function InitYUIUtil()
{
trc.util.yui._init();
}
trc.util.browser.addInitFunction (InitYUIUtil);
})();
trc.util.yui = {
//
// A list of dependecies to be passed to the YUI loader. This is
// essentially a hash set: dep->dep.
//
_deps : new Object(),
//
// An array of callback functions, these should be called when all
// dependecies are loaded.
//
_callbacks : new Array(),
//
// The init function simply calls the YUI loader...
//
_init : function() {
var yuiUtil = this;
//
// It takes safari a while to load the YUI Loader if it hasn't
// loaded yet keep trying at 1/4 second intervals
//
if (!window.YAHOO)
{
window.setTimeout (function() {
yuiUtil._init();
}, 250);
return;
}
//
// Collect requirements...
//
var required = new Array();
for (var req in this._deps)
{
required.push (req);
}
//
// Load YUI dependecies...
//
var loader = new YAHOO.util.YUILoader({
require: required,
loadOptional: true,
filter: "RAW",
onSuccess: function() {
yuiUtil._depsLoaded();
},
timeout: 10000,
combine: true
});
loader.insert();
},
//
// Called after all dependecies have been loaded
//
_depsLoaded : function() {
//
// Dependecies are loaded let everyone know.
//
for (var i=0;i<this._callbacks.length;i++)
{
this._callbacks[i]();
}
},
//
// Request that one or more YUI dependecies are loaded.
//
loadYUIDeps : function (deps, /*An array of dep strings */
callback /*A function to call when deps are loaded*/
)
{
for (var i=0;i<deps.length;i++)
{
this._deps[deps[i]] = deps[i];
}
if (callback != null)
{
this._callbacks.push (callback);
}
}
};

View File

@ -0,0 +1,82 @@
/*
* (C) 2009 Rackspace Hosting, All Rights Reserved.
*/
body, div, dl, dt, dd, ul, ol, li, h2, h3,
h4, h5, h6, pre, code, form, fieldset, legend,
input, button, textarea, p, blockquote, th, td {
text-align: left;
}
h1 {
font-size: 350%;
margin-bottom: 10px;
}
#Content {
border: 1px solid;
padding: 0px 40px 40px;
margin-left: 155px;
}
#SrcContent {
padding: 0px 40px 40px;
display: none;
margin-left: 155px;
}
#Controller {
position: fixed;
width: 145px;
left: 10px;
top: 10px;
}
.Sample {
display: none;
}
.EnumValue{
padding: 10px 0px;
}
.EnumDoc{
padding: 10px 10px 10px 0px;
}
.ExternHref{
padding-top: 5px;
}
.ExternDoc{
padding-right: 10px;
}
pre {
overflow: auto;
}
td {
padding: 0px 0px 0px 10px;
width: 50%;
font-size: 90%;
}
table {
width: 100%;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:link {
color: #000090;
}
a:visited {
color: #000090;
}

View File

@ -0,0 +1,151 @@
pre.sh_sourceCode {
background-color: #eeeeee;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #8080c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #ff8000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #800080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #0080c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #ff0080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #004466;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #ff0080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0080c0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0080c0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #a68500;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,151 @@
pre.sh_sourceCode {
background-color: #000040;
color: #C7C7C7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #60ff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #ffa500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #80a0ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #42cad9;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #ff80ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #d8e91b;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #d8e91b;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #26e0e7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #ffa500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #26e0e7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,139 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #208920;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #ac2020;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,151 @@
pre.sh_sourceCode {
background-color: #000044;
color: #dd00ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #f1157c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #82d66d;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #bfbfbf;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #8ee119;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #00bb00;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #e7ee5c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ff06cd;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #e7ee5c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #7aec27;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #82d66d;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #7aec27;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #ffffff;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,151 @@
pre.sh_sourceCode {
background-color: #000000;
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #00c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #808080;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #00ff00;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #ff0000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ff22b9;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #ff0000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0000c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0000c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #00ffff;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,145 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #666666;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #000000;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,66 @@
pre.sh_sourceCode {
background-color: white;
color: black;
font-style: normal;
font-weight: normal;
}
pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } /* language keywords */
pre.sh_sourceCode .sh_type { color: darkgreen; } /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } /* comments */
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: darkred; } /* e.g., <, >, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } /* TODO and FIXME */
/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: darkblue; }
pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; }
/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }
/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; }
/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; }
/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: darkgreen; }
/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: darkgreen; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }
/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: darkgreen; }
pre.sh_sourceCode .sh_difflines { color: blue; }
/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; }
/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: darkgreen; }

View File

@ -0,0 +1,139 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #696969;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #696969;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #1326a2;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #bb00ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #470000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #008800;
font-weight: normal;
font-style: normal;
}

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
targetNamespace="http://docs.openstack.org/common/api/v1.0"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"
@ -12,9 +13,58 @@
targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
<include schemaLocation="roles.xsd"/>
<include schemaLocation="token.xsd"/>
<include schemaLocation="user.xsd"/>
<!-- Elements -->
<element name="auth" type="identity:AuthenticateResponse"/>
<!-- Complex Types -->
<complexType name="Token">
<annotation>
<xsd:documentation xml:lang="EN" xmlns="http://www.w3.org/1999/xhtml">
<p>
A token is an arbitrary bit of text that is used to access
resources. Each token has a scope which describes which
resources are accessible with it. A token may be
revoked at anytime and is valid for a finite duration.
</p>
<p>
While Keystone supports token-based authentication in this release,
the intention is for it to support additional protocols in the
future. The desire is for it to be an integration service, and not
a full-fledged identity store and management solution.
</p>
</xsd:documentation>
<xsd:appinfo>
<xsdxt:samples>
<xsdxt:sample>
<xsdxt:code type="application/xml" href="../samples/token.xml" />
</xsdxt:sample>
<xsdxt:sample>
<xsdxt:code type="application/json" href="../samples/token.json" />
</xsdxt:sample>
</xsdxt:samples>
</xsd:appinfo>
</annotation>
<sequence>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="expires" type="xsd:dateTime" use="required"/>
<attribute name="id" type="xsd:string" use="required"/>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<complexType name="AuthenticateResponse">
<sequence>
<element name="token" type="identity:Token"/>
<element name="user" type="identity:UserForAuthenticateResponse"/>
<element name="serviceCatalog" type="identity:ServiceCatalog"/>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<complexType name="UserForAuthenticateResponse">
<sequence>
<element name="roles" type="identity:RoleList" />

View File

@ -50,3 +50,9 @@ class StaticFilesController(wsgi.Controller):
resp = Response()
return template.static_file(resp, req, "content/xsd/atom/" + xsd,
root=utils.get_app_root(), mimetype="application/xml")
@utils.wrap_error
def get_static_file(self, req, path, file, mimetype):
resp = Response()
return template.static_file(resp, req, path + file,
root=utils.get_app_root(), mimetype=mimetype)

View File

@ -184,6 +184,26 @@ class AdminApi(wsgi.Router):
controller=static_files_controller,
action="get_xsd_atom_contract",
conditions=dict(method=["GET"]))
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/xslt/", mimetype="application/xml",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/js/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/style/", mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/samples/", mimetype="application/text",
conditions=dict(method=["GET"]))
# Services Controller
services_controller = ServicesController(options)