remove old readme
[atutor.git] / docs / themes / default / photos / pa_photo.tmpl.php
1 <div>
2         <!-- frame that holds the 604px picture -->
3         <div class="photo_panel" id="photo_panel">
4                 <!-- Photo ordering and prev/next -->
5                 <?php if($this->photo_info['ordering'] <= $this->total_photos): ?>
6                 <div class="ordering"><?php echo _AT('pa_photo').' '.$this->photo_info['ordering'].' '._AT('pa_of').' '.$this->total_photos ; ?></div>
7                 <div class="paginator">
8                         <ul>
9                                 <?php if (isset($this->prev)): ?>
10                                 <li><a href="<?php echo AT_PA_BASENAME.'photo.php?pid='.$this->prev['id'].SEP.'aid='.$this->aid;?>"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']?>/images/previous.png" alt="<?php echo _AT('previous'); ?>" title="<?php echo _AT('previous'); ?>"/></a></li>
11                                 <?php endif; ?>
12                                 <?php if (isset($this->next)): ?>
13                                 <li><a href="<?php echo AT_PA_BASENAME.'photo.php?pid='.$this->next['id'].SEP.'aid='.$this->aid;?>"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']?>/images/next.png" alt="<?php echo _AT('next'); ?>" title="<?php echo _AT('next'); ?>"/></a></li>
14                                 <?php endif; ?>                         
15                         </ul>
16                 </div>
17                 <?php endif; ?>
18                 <div style="clear:both"></div>
19
20                 <img src="<?php echo AT_PA_BASENAME.'get_photo.php?aid='.$this->aid.SEP.'pid='.$this->photo_info['id'].SEP.'size=o'.SEP.'ph='.getPhotoFilePath($this->photo_info['id'], '', $this->photo_info['created_date']);?>" title="<?php echo AT_print($this->photo_info['description'], 'input.text'); ?>" alt="<?php echo AT_print($this->photo_info['alt_text'], 'input.text') ;?>" />
21                 <?php if ($this->action_permission): ?>
22                 <div class="flc-inlineEditable"><span class="flc-inlineEdit-text"><?php echo AT_print($this->photo_info['description'], 'photos.description');?></span></div>
23                 <?php else : ?>
24                 <div><span><?php echo htmlentities_utf8($this->photo_info['description'], true);?></span></div>
25                 <?php endif; ?>
26         </div>
27
28         <!-- comments -->
29         <div class="comment_panel">
30                 <div class="comment_feeds">
31                         <?php if(!empty($this->comments)): ?>
32                         <?php foreach($this->comments as $k=>$comment_array): ?>
33                                 <div class="comment_box">
34                                         <!-- TODO: Profile link and img -->
35                                         <?php if ($this->action_permission || $comment_array['member_id']==$_SESSION['member_id']): ?>
36                                         <div class="flc-inlineEditable">
37                                                 <a href="profile.php?id=<?php echo $comment_array['member_id'];?>"><strong><?php echo AT_print(get_display_name($comment_array['member_id']), 'members.full_name'); ?></a></strong>
38                                                 <span class="flc-inlineEdit-text" id="<?php echo $comment_array['id'];?>" ><?php echo AT_print($comment_array['comment'], 'photos.comment');?></span>
39                                         </div>
40                                         <?php else: ?>
41                                         <div>
42                                                 <a href="profile.php?id=<?php echo $comment_array['member_id'];?>"><strong><?php echo AT_print(get_display_name($comment_array['member_id']), 'members.full_name'); ?></a></strong>
43                                                 <?php echo htmlentities_utf8($comment_array['comment'], true);?>
44                                         </div>
45                                         <?php endif; ?>
46
47                                         <div>
48                                                 <div class="comment_actions">
49                                                         <?php echo AT_date(_AT('forum_date_format'), $comment_array['created_date'], AT_DATE_MYSQL_DATETIME);?>
50                                                         <?php if ($this->action_permission || $comment_array['member_id']==$_SESSION['member_id']): ?>
51                                                         <a href="<?php echo AT_PA_BASENAME.'delete_comment.php?aid='.$this->aid.SEP.'pid='.$this->photo_info['id'].SEP.'comment_id='.$comment_array['id']?>"><?php echo _AT('delete');?></a>
52                                                         <?php endif; ?>
53                                                 </div>
54                                         </div>
55                                 </div>
56                         <?php endforeach; endif; ?>
57                         <!-- TODO: Add script to check, comment cannot be empty. -->
58                         <form action="<?php echo AT_PA_BASENAME;?>addComment.php" method="post" class="input-form">
59                                 <div class="row"><label for="comments"><?php echo _AT('comments');?></label></div>
60                                 <div class="row"><textarea name="comment" id="comment_template" onclick="jQuery(this).hide();c=jQuery('#comment');c.show();c.focus();" onkeyup="jQuery(this).hide();c=jQuery('#comment');c.show();c.focus();"><?php echo _AT('pa_write_a_comment'); ?></textarea></div>
61                                 <div class="row"><textarea name="comment" id="comment" style="display:none;"></textarea></div>
62                                 <div class="row">
63                                         <input type="hidden" name="pid" value="<?php echo $this->photo_info['id'];?>" />
64                                         <input type="hidden" name="aid" value="<?php echo $this->aid;?>" />
65                                         <input type="submit" name="submit" value="<?php echo _AT('comment');?>" class="button"/>
66                                 </div>
67                         </form>
68                 </div>
69                 
70                 <?php if($this->action_permission): ?>
71                 <div class="photo_actions">
72                         <a href="<?php echo AT_PA_BASENAME.'edit_photos.php?aid='.$this->aid.SEP.'pid='.$this->photo_info['id']; ?>" class="pa_tool_link"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/edit.gif" alt="" border="0"  class="pa_tool_image"/><?php echo _AT('pa_edit_photo'); ?></a><br/>
73                         <a href="<?php echo AT_PA_BASENAME.'delete_photo.php?pid='.$this->photo_info['id'].SEP.'aid='.$this->aid;?>"  class="pa_tool_link"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/x.gif" alt="" border="0" class="pa_tool_image"/><?php echo _AT('pa_delete_this_photo'); ?></a><br/>
74                         <a href="<?php echo AT_PA_BASENAME.'set_profile_picture.php?pid='.$this->photo_info['id'].SEP.'aid='.$this->aid;?>"  class="pa_tool_link"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/profile.gif" alt="" border="0" class="pa_tool_image"/><?php echo _AT('pa_set_profile_pic'); ?></a>
75                 </div>
76                 <?php else: ?>
77                 <div class="photo_actions">
78                         <p><?php echo _AT('pa_uploaded_by').': '.AT_print(get_display_name($this->photo_info['member_id']), 'members.full_name'); ?></p>
79                 </div>
80                 <?php endif; ?>
81         </div>
82 </div>
83
84 <script type="text/javascript">
85 jQuery(document).ready(function () {
86         //the ATutor undo function
87         var undo = function (that, targetContainer) {
88                                         var markup = "<span class='flc-undo' aria-live='polite' aria-relevant='all'>" +
89                                           "<span class='flc-undo-undoContainer'><a href='#' class='flc-undo-undoControl'>[<?php echo _AT('pa_undo'); ?>]</a></span>" +
90                                           "<span class='flc-undo-redoContainer'><a href='#' class='flc-undo-redoControl'>[<?php echo _AT('pa_redo'); ?>]</a></span>" +
91                                         "</span>";
92                                         var markupNode = jQuery(markup);
93                                         targetContainer.append(markupNode);
94                                         return markupNode;
95                                 };
96         var pa_click_here_to_edit = '<?php echo _AT("pa_click_here_to_edit"); ?>';
97         var pa_click_item_to_edit = '<?php echo _AT("pa_click_item_to_edit"); ?>';
98
99         /* inline edit for photo panel description */
100     fluid.inlineEdits("#photo_panel", {
101                 componentDecorators: {
102                         type: "fluid.undoDecorator",
103                         options: {
104                                 renderer: undo
105                         }
106                 },              
107                 defaultViewText: pa_click_here_to_edit,
108                 useTooltip: true,
109                 tooltipText: pa_click_item_to_edit, 
110                 listeners: {
111                         modelChanged: function(model, oldModel, source){
112                                 /* for undo/redo model change */
113                                 if (model != oldModel && source != undefined){
114                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_photos.php';?>", 
115                                                 {"submit":"ajax",
116                                                  "pid":<?php echo $this->photo_info['id'];?>, 
117                                                  "aid":<?php echo $this->aid;?>, 
118                                                  "description_<?php echo $this->photo_info['id'];?>":model.value,
119                                                  "alt_text_<?php echo $this->photo_info['id'];?>":"<?php echo trim($this->photo_info['alt_text']);?>"},
120                                                   function(data){}, 
121                                                   "json");
122                                 }
123                         },
124                         afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {
125                                 if (newValue != oldValue){
126                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_photos.php';?>", 
127                                                         {"submit":"ajax",
128                                                          "pid":<?php echo $this->photo_info['id'];?>, 
129                                                          "aid":<?php echo $this->aid;?>, 
130                                                          "description_<?php echo $this->photo_info['id'];?>":newValue,
131                                                          "alt_text_<?php echo $this->photo_info['id'];?>":"<?php echo trim($this->photo_info['alt_text']);?>"},
132                                                           function(data){}, 
133                                                           "json");
134                                 }
135                         }
136                 }
137         });
138
139         /* inline edit for photo album comments */
140         fluid.inlineEdits(".comment_feeds", {
141                 componentDecorators: {
142                         type: "fluid.undoDecorator",
143                         options: {
144                                 renderer: undo
145                         }
146                 },
147                 defaultViewText: pa_click_here_to_edit,
148                 useTooltip: true,
149                 tooltipText: pa_click_item_to_edit, 
150                 listeners: {
151                         modelChanged: function(model, oldModel, source){
152                                 /* for undo/redo model change */
153                                 if (model != oldModel && source != undefined){
154                                         commentID = source.component.locate("text").attr("id");
155                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_comment.php';?>", 
156                                                 {"submit":"submit",
157                                                  "pid":<?php echo $this->photo_info['id'];?>, 
158                                                  "aid":<?php echo $this->aid;?>, 
159                                                  "cid":commentID, 
160                                                  "comment":model.value},
161                                                   function(data){}, 
162                                                   "json");
163                                 }
164                         },
165                         afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {
166                                 if (newValue != oldValue){
167                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_comment.php';?>", 
168                                                         {"submit":"submit",
169                                                          "pid":<?php echo $this->photo_info['id'];?>, 
170                                                          "aid":<?php echo $this->aid;?>, 
171                                                          "cid":viewNode.id, 
172                                                          "comment":newValue},
173                                                           function(data){}, 
174                                                           "json");
175                                 }
176                         }
177                 }
178         });
179 });
180 </script>