Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
433 ddelon 1
<div class="page">
2
<?php
3
if ($HasAccessRead=$this->HasAccess("read"))
4
{
5
	if (!$this->page)
6
	{
7
		print("Cette page n'existe pas encore, voulez vous la <a href=\"".$this->href("edit")."\">créer</a> ?");
8
	}
9
	else
10
	{
11
		// comment header?
12
		if ($this->page["comment_on"])
13
		{
14
			print("<div class=\"commentinfo\">Ceci est un commentaire sur ".$this->ComposeLinkToPage($this->page["comment_on"], "", "", 0).", posté par ".$this->Format($this->page["user"])." à ".$this->page["time"]."</div>");
15
		}
16
 
17
		if ($this->page["latest"] == "N")
18
		{
19
			print("<div class=\"revisioninfo\">Ceci est une version archivée de <a href=\"".$this->href()."\">".$this->GetPageTag()."</a> à ".$this->page["time"].".</div>");
20
		}
21
 
22
 
23
		// display page
24
		print($this->Format($this->page["body"], "wakka"));
25
 
26
		// if this is an old revision, display some buttons
27
		if (($this->page["latest"] == "N") && $this->HasAccess("write"))
28
		{
29
			$latest = $this->LoadPage($this->tag);
30
			?>
31
			<br />
32
			<?php echo  $this->FormOpen("edit") ?>
33
			<input type="hidden" name="previous" value="<?php echo  $latest["id"] ?>">
34
			<input type="hidden" name="body" value="<?php echo  htmlentities($this->page["body"]) ?>">
35
			<input type="submit" value="Re-éditer cette version archivée">
36
			<?php echo  $this->FormClose(); ?>
37
			<?php
38
		}
39
	}
40
}
41
else
42
{
43
	print("<i>Vous n'êtes pas autorisé à lire cette page</i>");
44
}
45
?>
46
</div>
47
 
48
 
49
<?php
50
if ($HasAccessRead)
51
{
52
	// load comments for this page
53
	$comments = $this->LoadComments($this->tag);
54
 
55
	// store comments display in session
56
	$tag = $this->GetPageTag();
57
	if (!isset($_SESSION["show_comments"][$tag]))
58
		$_SESSION["show_comments"][$tag] = ($this->UserWantsComments() ? "1" : "0");
59
	if (isset($_REQUEST["show_comments"])){
60
	switch($_REQUEST["show_comments"])
61
	{
62
	case "0":
63
		$_SESSION["show_comments"][$tag] = 0;
64
		break;
65
	case "1":
66
		$_SESSION["show_comments"][$tag] = 1;
67
		break;
68
	}
69
	}
70
	// display comments!
71
	if ($this->page && $_SESSION["show_comments"][$tag])
72
	{
73
		// display comments header
74
		?>
75
		<div class="commentsheader">
76
			Commentaires [<a href="<?php echo  $this->href("", "", "show_comments=0") ?>">Cacher commentaires/formulaire</a>]
77
		</div>
78
		<?php
79
 
80
		// display comments themselves
81
		if ($comments)
82
		{
83
			foreach ($comments as $comment)
84
			{
85
				print("<a name=\"".$comment["tag"]."\"></a>\n");
86
				print("<div class=\"comment\">\n");
87
				print($this->Format($comment["body"])."\n");
88
				print("<div class=\"commentinfo\">\n-- ".$this->Format($comment["user"])." (".$comment["time"].")\n</div>\n");
89
				print("</div>\n");
90
			}
91
		}
92
 
93
		// display comment form
94
		print("<div class=\"commentform\">\n");
95
		if ($this->HasAccess("comment"))
96
		{
97
			?>
98
				Ajouter un commentaire à cette page:<br />
99
				<?php echo  $this->FormOpen("addcomment"); ?>
100
					<textarea name="body" rows="6" style="width: 100%"></textarea><br />
101
					<input type="submit" value="Ajouter Commentaire" accesskey="s">
102
				<?php echo  $this->FormClose(); ?>
103
			<?php
104
		}
105
		print("</div>\n");
106
	}
107
	else
108
	{
109
		?>
110
		<div class="commentsheader">
111
		<?php
112
			switch (count($comments))
113
			{
114
			case 0:
115
				print("Il n'y a pas de commentaire sur cette page.");
116
				break;
117
			case 1:
118
				print("Il y a un commentaire sur cette page.");
119
				break;
120
			default:
121
				print("Il y a ".count($comments)." commentaires sur cette page.");
122
			}
123
		?>
124
 
125
		[<a href="<?php echo  $this->href("", "", "show_comments=1") ?>">Afficher commentaires/formulaire</a>]
126
 
127
		</div>
128
		<?php
129
	}
130
}
131
?>