summaryrefslogtreecommitdiff
path: root/inc/template.php
diff options
context:
space:
mode:
authormatthiasgrimm <matthiasgrimm@users.sourceforge.net>2005-06-16 18:34:25 +0200
committermatthiasgrimm <matthiasgrimm@users.sourceforge.net>2005-06-16 18:34:25 +0200
commitd67ca2c0f7f6b75608386c226d33afdda872757c (patch)
tree6865ecca6d30cf4ae70a68ca85f8f22161176f33 /inc/template.php
parentb59a406b93334a3a9ba2c1f2529a3bc7123361f4 (diff)
downloadrpg-d67ca2c0f7f6b75608386c226d33afdda872757c.tar.gz
rpg-d67ca2c0f7f6b75608386c226d33afdda872757c.tar.bz2
media reference check part 2
Part 1 only checks for the existance of references. Part 2 will show where this references are so that the user could easily find them. Both parts are configurable: refcheck darcs-hash:20050616163425-7ef76-a7fce6cd1ef5d2cc2e4ac3b869969a65c671770a.gz
Diffstat (limited to 'inc/template.php')
-rw-r--r--inc/template.php47
1 files changed, 41 insertions, 6 deletions
diff --git a/inc/template.php b/inc/template.php
index bc2bc561b..b37d335a8 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -247,17 +247,20 @@ function tpl_getparent($ID){
* edit - edit/create/show button
* history - old revisions
* recent - recent changes
- * login - login/logout button - if ACL enabled
- * index - The index
- * admin - admin page - if enough rights
- * top - a back to top button
- * back - a back to parent button - if available
+ * login - login/logout button - if ACL enabled
+ * index - The index
+ * admin - admin page - if enough rights
+ * top - a back to top button
+ * back - a back to parent button - if available
+ * backtomedia - returns to the mediafile upload dialog
+ * after references have been displayed
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
function tpl_button($type){
global $ID;
+ global $NS;
global $INFO;
global $conf;
@@ -295,6 +298,9 @@ function tpl_button($type){
if($INFO['perm'] == AUTH_ADMIN)
print html_btn(admin,$ID,'',array('do' => 'admin'));
break;
+ case 'backtomedia':
+ print html_backtomedia_button(array('ns' => $NS),'b');
+ break;
default:
print '[unknown button type]';
}
@@ -589,7 +595,6 @@ function tpl_mediafilelist(){
$del = '';
}
-
if($item['isimg']){
$w = $item['info'][0];
$h = $item['info'][1];
@@ -615,6 +620,36 @@ function tpl_mediafilelist(){
}
/**
+ * show references to a media file
+ * References uses the same visual as search results and share
+ * their CSS tags except pagenames won't be links.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+function tpl_showreferences(&$data){
+ global $lang;
+
+ $hidden=0; //count of hits without read permission
+
+ if(count($data)){
+ usort($data,'sort_search_fulltext');
+ foreach($data as $row){
+ if(auth_quickaclcheck($row['id']) >= AUTH_READ){
+ print '<div class="search_result">';
+ print '<span class="mediaref_ref">'.$row['id'].'</span>';
+ print ': <span class="search_cnt">'.$row['count'].' '.$lang['hits'].'</span><br />';
+ print '<div class="search_snippet">'.$row['snippet'].'</div>';
+ print '</div>';
+ }else
+ $hidden++;
+ }
+ if ($hidden){
+ print '<div class="mediaref_hidden">'.$lang['ref_hidden'].'</div>';
+ }
+ }
+}
+
+/**
* Print the media upload form if permissions are correct
*
* @author Andreas Gohr <andi@splitbrain.org>