Unnamed Fossil Project

Check-in [38001529be]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added first version of roll implementation.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:38001529be21650ea3ae6354fa24422c69348d47
User & Date: Spravce 2012-11-17 20:35:18
Context
2012-11-22
23:38
Added wiki. check-in: 245a3809ef user: Spravce tags: trunk
2012-11-17
20:35
Added first version of roll implementation. check-in: 38001529be user: Spravce tags: trunk
14:17
Added logger. check-in: 6cf0061409 user: Spravce tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added brick/roll.php.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
class brick_roll
{
	private $conf=array();
	private $basePath=null;

	function __construct($rollFile)
	{
		$conf = parse_ini_file($rollFile, TRUE);
		$this->basePath = dirname($rollFile);
		foreach ($conf as $name=>$item) {
			if (isset($conf[$name]["tags"])) {
				$conf[$name]["tags"] = explode(" ", $conf[$name]["tags"]);
			}
		}
		$this->conf = $conf;
	}

	function query($query)
	{
		$listed = array();
		if ($query==".") {
			$listed = $this->conf;
		} elseif (substr($query, 0, 1)=="@") {
			$tag = substr($query, 1);
			foreach ($this->conf as $name=>$item) {
				if ((isset($item["tags"])) and in_array($tag, $item["tags"])) {
					$listed[$name] = $item;
				}
			}
		} else {
			$toBeListed = explode(",", $query);
			foreach ($this->conf as $name=>$item) {
				if (in_array($name, $toBeListed))
				$listed[$name] = $item;
			}
		}
		ksort($listed);
		return $listed;
	}
	
	function down($query)
	{
		$listed = $this->query($query);
		foreach ($listed as $conf) {
			mkdir($this->basePath . DIRECTORY_SEPARATOR . $conf["local"]);
		}
	}
}

Added c/roll.php.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
class c_roll
{
	function init()
	{
		$this->backend = new brick_roll($this->framework->libPath . DIRECTORY_SEPARATOR . "roll.ini");
	}
	
	function index()
	{
		$this->init();
		$query = (isset($_GET['q']) ? $_GET['q'] : '.');
		$listing = $this->backend->query($query);
		$linkURL = $this->framework->getRouter()->getLink('roll');
		echo $this->framework->getView()->show('roll', array('listing'=>$listing, 'linkURL'=>$linkURL));
	}
	
	function down()
	{
		$this->init();
		$package = $_POST["package"];
		header('Location: '.$this->framework->getRouter()->getLink('roll'));
	}
}

Added tpl/roll.php.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<html>
<head>
<title>ROLL</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<?php foreach ($listing as $name=>$item): ?>
<h3>[<?php echo $name; ?>]</h3>
<p><?php if (isset($item["info"])) echo $item["info"]; ?></p>
<?php
if (isset($item["tags"])){
	echo 'tags: ';
	foreach ($item["tags"] as $tag) {
		echo '<a href="'. $linkURL .'?q=@' . $tag . '">' . $tag .'</a> ';
	}
	echo '<br />';
}
?>
<form method="POST" action="<?php echo $linkURL; ?>/down">
	<input type="hidden" name="package" value="<?php echo $name; ?>">
	<input type="submit" value="Download/Upgrade">
</form>
<?php endforeach;?>
</body>
</html>