From 4cefd2161b53492fb26682c4068002040986b7e4 Mon Sep 17 00:00:00 2001
From: Michael Klier <chi@chimeric.de>
Date: Tue, 27 Jan 2009 22:50:01 +0100
Subject: [PATCH] tpl_license() more flexible for template authors

darcs-hash:20090127215001-23886-194fb0b92b259bd915f27eeb3300dba2bc330d26.gz
---
 inc/template.php           | 16 +++++++++-------
 lib/tpl/default/design.css |  9 +++++----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/inc/template.php b/inc/template.php
index 71eec0e6a..e108a843b 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1303,7 +1303,7 @@ function tpl_actiondropdown($empty='',$button='&gt;'){
  * @param  string $img    - print image? (|button|badge)
  * @param  bool   $return - when true don't print, but return HTML
  */
-function tpl_license($img='badge',$return=false){
+function tpl_license($img='badge',$imgonly=false,$return=false){
     global $license;
     global $conf;
     global $lang;
@@ -1311,7 +1311,7 @@ function tpl_license($img='badge',$return=false){
     if(!is_array($license[$conf['license']])) return '';
     $lic = $license[$conf['license']];
 
-    $out  = '<p class="license">';
+    $out  = '<div class="license">';
     if($img){
         $src = license_img($img);
         if($src){
@@ -1320,11 +1320,13 @@ function tpl_license($img='badge',$return=false){
             $out .= '><img src="'.DOKU_BASE.$src.'" class="medialeft lic'.$img.'" alt="'.$lic['name'].'" /></a> ';
         }
     }
-    $out .= $lang['license'];
-    $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"';
-    if($conf['target']['external']) $out .= ' target="'.$conf['target']['external'].'"';
-    $out .= '>'.$lic['name'].'</a>';
-    $out .= '</p>';
+    if(!$imgonly) {
+        $out .= $lang['license'];
+        $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"';
+        if($conf['target']['external']) $out .= ' target="'.$conf['target']['external'].'"';
+        $out .= '>'.$lic['name'].'</a>';
+        $out .= '</div>';
+    }
 
     if($return) return $out;
     echo $out;
diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css
index b2af3f448..d8e4ddad9 100644
--- a/lib/tpl/default/design.css
+++ b/lib/tpl/default/design.css
@@ -171,14 +171,15 @@ div.dokuwiki div#draft__status {
   color: __text_alt__;
 }
 
-div.dokuwiki form#dw__editform div.license {
-  clear: left;
+div.dokuwiki div.license {
+  padding: 0.5em;
   font-size: 90%;
+  text-align: center;
 }
 
-div.dokuwiki p.license {
+div.dokuwiki form#dw__editform div.license {
+  clear: left;
   font-size: 90%;
-  text-align: center;
 }
 
 /* --------- buttons ------------------- */
-- 
GitLab