Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.cal.textDirectory");
13
dojo.provide("dojo.cal.textDirectory");
12
dojo.require("dojo.string");
14
dojo.require("dojo.string");
13
dojo.cal.textDirectory.Property = function (line) {
15
dojo.cal.textDirectory.Property = function (line) {
14
	var left = dojo.string.trim(line.substring(0, line.indexOf(":")));
16
	var left = dojo.string.trim(line.substring(0, line.indexOf(":")));
15
	var right = dojo.string.trim(line.substr(line.indexOf(":") + 1));
17
	var right = dojo.string.trim(line.substr(line.indexOf(":") + 1));
16
	var parameters = dojo.string.splitEscaped(left, ";");
18
	var parameters = dojo.string.splitEscaped(left, ";");
17
	this.name = parameters[0];
19
	this.name = parameters[0];
18
	parameters.splice(0, 1);
20
	parameters.splice(0, 1);
19
	this.params = [];
21
	this.params = [];
20
	var arr;
22
	var arr;
21
	for (var i = 0; i < parameters.length; i++) {
23
	for (var i = 0; i < parameters.length; i++) {
22
		arr = parameters[i].split("=");
24
		arr = parameters[i].split("=");
23
		var key = dojo.string.trim(arr[0].toUpperCase());
25
		var key = dojo.string.trim(arr[0].toUpperCase());
24
		if (arr.length == 1) {
26
		if (arr.length == 1) {
25
			this.params.push([key]);
27
			this.params.push([key]);
26
			continue;
28
			continue;
27
		}
29
		}
28
		var values = dojo.string.splitEscaped(arr[1], ",");
30
		var values = dojo.string.splitEscaped(arr[1], ",");
29
		for (var j = 0; j < values.length; j++) {
31
		for (var j = 0; j < values.length; j++) {
30
			if (dojo.string.trim(values[j]) != "") {
32
			if (dojo.string.trim(values[j]) != "") {
31
				this.params.push([key, dojo.string.trim(values[j])]);
33
				this.params.push([key, dojo.string.trim(values[j])]);
32
			}
34
			}
33
		}
35
		}
34
	}
36
	}
35
	if (this.name.indexOf(".") > 0) {
37
	if (this.name.indexOf(".") > 0) {
36
		arr = this.name.split(".");
38
		arr = this.name.split(".");
37
		this.group = arr[0];
39
		this.group = arr[0];
38
		this.name = arr[1];
40
		this.name = arr[1];
39
	}
41
	}
40
	this.value = right;
42
	this.value = right;
41
};
43
};
42
dojo.cal.textDirectory.tokenise = function (text) {
44
dojo.cal.textDirectory.tokenise = function (text) {
43
	var nText = dojo.string.normalizeNewlines(text, "\n").replace(/\n[ \t]/g, "").replace(/\x00/g, "");
45
	var nText = dojo.string.normalizeNewlines(text, "\n").replace(/\n[ \t]/g, "").replace(/\x00/g, "");
44
	var lines = nText.split("\n");
46
	var lines = nText.split("\n");
45
	var properties = [];
47
	var properties = [];
46
	for (var i = 0; i < lines.length; i++) {
48
	for (var i = 0; i < lines.length; i++) {
47
		if (dojo.string.trim(lines[i]) == "") {
49
		if (dojo.string.trim(lines[i]) == "") {
48
			continue;
50
			continue;
49
		}
51
		}
50
		var prop = new dojo.cal.textDirectory.Property(lines[i]);
52
		var prop = new dojo.cal.textDirectory.Property(lines[i]);
51
		properties.push(prop);
53
		properties.push(prop);
52
	}
54
	}
53
	return properties;
55
	return properties;
54
};
56
};
55
 
57