Unnamed Fossil Project

Check-in [a8ad69229f]
Login

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

Overview
Comment:serializace
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a8ad69229fb19cdf52d3e9334a6a29af26b36577
User & Date: Spravce 2012-12-24 21:24:42
Context
2013-03-30
13:47
Fatal handling. check-in: e9c0f864af user: Spravce tags: trunk
2012-12-24
21:24
serializace check-in: a8ad69229f user: Spravce tags: trunk
2012-11-22
23:38
Added wiki. check-in: 245a3809ef user: Spravce tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to c/wiki.php.

48
49
50
51
52
53
54









55
56
57
58
59
60
61
..
67
68
69
70
71
72
73
74
75
76

77




78
79
80
81
82
83
84
85
86
				'action'=>$this->_getLink('wiki','edit',array($page)),
				'content'=>$content,
				'preview'=>$preview
			)
		);
		$this->_showContent($editor);
	}









	
	private function _showContent($content)
	{
		echo $this->_show(
			'bootstrap',
			array(
				'brand'=>$this->title,
................................................................................
		);
	
	}
	
	private function _setMenu($mode, $page)
	{
		$out='<div class="pull-right btn-group">';
		if ($mode=="show") {
			$out.='<a href="'.$this->_getLink('wiki', 'edit', array($page)).'" class="btn"><i class="icon-pencil"></i></a>';
		}

		$out.='<a href="'.$this->_getLink('wiki', 'history', array($page)).'" class="btn" title="history"><i class="icon-film"></i></a>';




		$out.='</div>';
		$this->menu = $out;
	}
	
	function _model()
	{
		return new model_wiki($this->framework->indexPath . DIRECTORY_SEPARATOR . 'doc');
	}
}







>
>
>
>
>
>
>
>
>







 







|
|

>
|
>
>
>
>









48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
				'action'=>$this->_getLink('wiki','edit',array($page)),
				'content'=>$content,
				'preview'=>$preview
			)
		);
		$this->_showContent($editor);
	}
	
	function history($page="index")
	{
		$m=$this->_model();
		$history = $m->getHistory($page);
		$content = $this->_show('wiki_history', array('history'=>$history));
		$this->_setMenu('history', $page);
		$this->_showContent($content);
	}
	
	private function _showContent($content)
	{
		echo $this->_show(
			'bootstrap',
			array(
				'brand'=>$this->title,
................................................................................
		);
	
	}
	
	private function _setMenu($mode, $page)
	{
		$out='<div class="pull-right btn-group">';
		if ($mode!="show") {
			$out.='<a href="'.$this->_getLink('wiki', 'show', array($page)).'" class="btn" title="show"><i class="icon-eye-open"></i></a>';
		}
		if ($mode!="history") {
			$out.='<a href="'.$this->_getLink('wiki', 'history', array($page)).'" class="btn" title="history"><i class="icon-film"></i></a>';
		}
		if ($mode!="edit") {
			$out.='<a href="'.$this->_getLink('wiki', 'edit', array($page)).'" class="btn" title="edit"><i class="icon-pencil"></i></a>';
		}
		$out.='</div>';
		$this->menu = $out;
	}
	
	function _model()
	{
		return new model_wiki($this->framework->indexPath . DIRECTORY_SEPARATOR . 'doc');
	}
}

Changes to model/wiki.php.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	
	function savePage($page, $newText, $author='', $comment='')
	{
		$oldText = $this->getPage($page);
		if ($newText != $oldText) {
			$history = $this->getHistory($page);
			$revision = count($history);
			if (file_put_contents($this->_pageFN($page), $newText)) {
				file_put_contents($this->_revFN($page, $revision), $newText);
				$history[] = array(
					'date'=>date('Y-m-d'),
					'time'=>date('H:i:s'),
					'author'=>$author,
					'comment'=>$comment
				);
................................................................................
			}
		}
	}
	
	function getHistory($page)
	{
		if (file_exists($this->_logFN($page))) {
			return json_decode(file_get_contents($this->_logFN($page)));
		} else {
			return array();
		}
	}
	
	
}







|







 







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	
	function savePage($page, $newText, $author='', $comment='')
	{
		$oldText = $this->getPage($page);
		if ($newText != $oldText) {
			$history = $this->getHistory($page);
			$revision = count($history);
			if (file_put_contents($this->_pageFN($page), $newText) ) {
				file_put_contents($this->_revFN($page, $revision), $newText);
				$history[] = array(
					'date'=>date('Y-m-d'),
					'time'=>date('H:i:s'),
					'author'=>$author,
					'comment'=>$comment
				);
................................................................................
			}
		}
	}
	
	function getHistory($page)
	{
		if (file_exists($this->_logFN($page))) {
			return json_decode(file_get_contents($this->_logFN($page)), true);
		} else {
			return array();
		}
	}
	
	
}