summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/html.php30
-rw-r--r--inc/lang/de/lang.php5
-rw-r--r--inc/lang/en/lang.php5
-rw-r--r--inc/search.php2
-rw-r--r--inc/template.php47
5 files changed, 81 insertions, 8 deletions
diff --git a/inc/html.php b/inc/html.php
index 785172b84..3c724865d 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -171,7 +171,35 @@ function html_topbtn(){
}
/**
- * Displays a button (using it's own form)
+ * Just the back to media window button in its own form
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+function html_backtomedia_button($params,$akey=''){
+ global $conf;
+ global $lang;
+
+ $ret = '<form class="button" method="get" action="'.DOKU_BASE.'lib/exe/media.php">';
+
+ reset($params);
+ while (list($key, $val) = each($params)) {
+ $ret .= '<input type="hidden" name="'.$key.'" ';
+ $ret .= 'value="'.htmlspecialchars($val).'" />';
+ }
+
+ $ret .= '<input type="submit" value="'.htmlspecialchars($lang['btn_backtomedia']).'" class="button" ';
+ if($akey){
+ $ret .= 'title="ALT+'.strtoupper($akey).'" ';
+ $ret .= 'accesskey="'.$akey.'" ';
+ }
+ $ret .= '/>';
+ $ret .= '</form>';
+
+ return $ret;
+}
+
+/**
+ * Displays a button (using its own form)
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php
index 7e3e46469..ae7932806 100644
--- a/inc/lang/de/lang.php
+++ b/inc/lang/de/lang.php
@@ -32,6 +32,7 @@ $lang['btn_admin'] = 'Admin';
$lang['btn_update'] = 'Updaten';
$lang['btn_delete'] = 'Löschen';
$lang['btn_back'] = 'Zurück';
+$lang['btn_backtomedia'] = 'Zurück zur Dateiauswahl';
$lang['loggedinas'] = 'Angemeldet als';
$lang['user'] = 'Benutzername';
@@ -77,6 +78,10 @@ $lang['mediainuse'] = 'Die Datei "%s" wurde nicht gelöscht - sie wird noch ver
$lang['namespaces'] = 'Namensräume';
$lang['mediafiles'] = 'Vorhandene Dateien in';
+$lang['reference'] = 'Verwendung von';
+$lang['ref_inuse'] = 'Diese Datei kann nicht gelöscht werden, da sie noch von folgenden Seiten benutzt wird:';
+$lang['ref_hidden'] = 'Einige Verweise sind auf Seiten für die Sie keine Leseberechtigung haben.';
+
$lang['hits'] = 'Treffer';
$lang['quickhits'] = 'Passende Seitennamen';
$lang['toc'] = 'Inhaltsverzeichnis';
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 235eeff80..93f43d089 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -31,6 +31,7 @@ $lang['btn_admin'] = 'Admin';
$lang['btn_update'] = 'Update';
$lang['btn_delete'] = 'Delete';
$lang['btn_back'] = 'Back';
+$lang['btn_backtomedia'] = 'Back to Mediafile Selection';
$lang['loggedinas'] = 'Logged in as';
$lang['user'] = 'Username';
@@ -75,6 +76,10 @@ $lang['mediainuse'] = 'The file "%s" hasn\'t been deleted - it is still in use.
$lang['namespaces'] = 'Namespaces';
$lang['mediafiles'] = 'Available files in';
+$lang['reference'] = 'References for';
+$lang['ref_inuse'] = 'The file can\'t be deleted, because it\'s still used by the following pages:';
+$lang['ref_hidden'] = 'Some references are on pages you don\'t have permission to read';
+
$lang['hits'] = 'Hits';
$lang['quickhits'] = 'Matching pagenames';
$lang['toc'] = 'Table of Contents';
diff --git a/inc/search.php b/inc/search.php
index 0caae3d7c..e61d04491 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -355,7 +355,7 @@ function search_reference(&$data,$base,$file,$type,$lvl,$opts){
//'false' will skip subdirectories to speed search up.
if(count($data) >= $conf['refcount']) return false;
- $reg = '{{ *'.$opts['query'].' *(\|.*)?}}';
+ $reg = '\{\{ *\:?'.$opts['query'].' *(\|.*)?\}\}';
search_regex($data,$base,$file,$reg,array($opts['query']));
return true;
}
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>