summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/html.php52
-rw-r--r--inc/lang/en/lang.php16
-rw-r--r--inc/media.php50
-rw-r--r--inc/pageutils.php2
-rw-r--r--lib/tpl/default/mediamanager.css155
5 files changed, 231 insertions, 44 deletions
diff --git a/inc/html.php b/inc/html.php
index 29e40174c..738ee6d75 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -415,20 +415,28 @@ function html_locked(){
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Ben Coburn <btcoburn@silicodon.net>
+ * @author Kate Arzamastseva <pshns@ukr.net>
*/
-function html_revisions($first=0){
+function html_revisions($first=0, $media_id = false){
global $ID;
global $INFO;
global $conf;
global $lang;
+ $id = $ID;
/* we need to get one additionally log entry to be able to
* decide if this is the last page or is there another one.
* see html_recent()
*/
- $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ if (!$media_id) $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ else {
+ $revisions = getRevisions($media_id, $first, $conf['recent']+1, 8192, true);
+ $id = $media_id;
+ }
+
if(count($revisions)==0 && $first!=0){
$first=0;
- $revisions = getRevisions($ID, $first, $conf['recent']+1);;
+ if (!$media_id) $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ else $revisions = getRevisions($media_id, $first, $conf['recent']+1, 8192, true);
}
$hasNext = false;
if (count($revisions)>$conf['recent']) {
@@ -436,14 +444,19 @@ function html_revisions($first=0){
array_pop($revisions); // remove extra log entry
}
- $date = dformat($INFO['lastmod']);
+ if (!$media_id) $date = dformat($INFO['lastmod']);
+ else $date = dformat(@filemtime(mediaFN($id)));
- print p_locale_xhtml('revisions');
+ if (!$media_id) print p_locale_xhtml('revisions');
$form = new Doku_Form(array('id' => 'page__revisions'));
$form->addElement(form_makeOpenTag('ul'));
- if($INFO['exists'] && $first==0){
- if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+
+ if (!$media_id) $exists = $INFO['exists'];
+ else $exists = @file_exists(mediaFN($id));
+
+ if($exists && $first==0){
+ if (!$media_id && isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
else
$form->addElement(form_makeOpenTag('li'));
@@ -461,8 +474,8 @@ function html_revisions($first=0){
$form->addElement(form_makeOpenTag('a', array(
'class' => 'wikilink1',
- 'href' => wl($ID))));
- $form->addElement($ID);
+ 'href' => wl($id))));
+ $form->addElement($id);
$form->addElement(form_makeCloseTag('a'));
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
@@ -471,6 +484,7 @@ function html_revisions($first=0){
$form->addElement(form_makeCloseTag('span'));
$form->addElement(form_makeOpenTag('span', array('class' => 'user')));
+ ///
$form->addElement((empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']));
$form->addElement(form_makeCloseTag('span'));
@@ -481,8 +495,9 @@ function html_revisions($first=0){
foreach($revisions as $rev){
$date = dformat($rev);
- $info = getRevisionInfo($ID,$rev,true);
- $exists = page_exists($ID,$rev);
+ $info = getRevisionInfo($id,$rev,true);
+ if (!$media_id) $exists = page_exists($id,$rev);
+ else $exists = @file_exists(mediaFN($id,$rev));
if ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
@@ -503,7 +518,8 @@ function html_revisions($first=0){
$form->addElement(form_makeCloseTag('span'));
if($exists){
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
+ ///
+ $form->addElement(form_makeOpenTag('a', array('href' => wl($id,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
$form->addElement(form_makeTag('img', array(
'src' => DOKU_BASE.'lib/images/diff.png',
'width' => 15,
@@ -511,13 +527,13 @@ function html_revisions($first=0){
'title' => $lang['diff'],
'alt' => $lang['diff'])));
$form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
- $form->addElement($ID);
+ ///
+ $form->addElement(form_makeOpenTag('a', array('href' => wl($id,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
+ $form->addElement($id);
$form->addElement(form_makeCloseTag('a'));
}else{
$form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />');
- $form->addElement($ID);
+ $form->addElement($id);
}
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
@@ -549,12 +565,12 @@ function html_revisions($first=0){
$first -= $conf['recent'];
if ($first < 0) $first = 0;
print '<div class="pagenav-prev">';
- print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
+ print html_btn('newer',$id,"p",array('do' => 'revisions', 'first' => $first));
print '</div>';
}
if ($hasNext) {
print '<div class="pagenav-next">';
- print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
+ print html_btn('older',$id,"n",array('do' => 'revisions', 'first' => $last));
print '</div>';
}
print '</div>';
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 51fd8f645..5dca273c3 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -48,6 +48,7 @@ $lang['btn_recover'] = 'Recover draft';
$lang['btn_draftdel'] = 'Delete draft';
$lang['btn_revert'] = 'Restore';
$lang['btn_register'] = 'Register';
+$lang['btn_apply'] = 'Apply';
$lang['loggedinas'] = 'Logged in as';
$lang['user'] = 'Username';
@@ -179,6 +180,9 @@ $lang['external_edit'] = 'external edit';
$lang['summary'] = 'Edit summary';
$lang['noflash'] = 'The <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a> is needed to display this content.';
$lang['download'] = 'Download Snippet';
+$lang['pages_changes'] = 'Show pages changes';
+$lang['media_changes'] = 'Show media files changes';
+$lang['both_changes'] = 'Show both';
$lang['mail_newpage'] = 'page added:';
$lang['mail_changed'] = 'page changed:';
@@ -318,5 +322,17 @@ $lang['seconds'] = '%d seconds ago';
$lang['wordblock'] = 'Your change was not saved because it contains blocked text (spam).';
+$lang['media_uploadtab'] = 'Upload';
+$lang['media_searchtab'] = 'Search';
+$lang['media_viewtab'] = 'View';
+$lang['media_edittab'] = 'Edit';
+$lang['media_historytab'] = 'History';
+$lang['media_thumbsview'] = 'Thumnails';
+$lang['media_listview'] = 'List';
+$lang['media_sort'] = 'Sort';
+$lang['media_search'] = 'Search';
+$lang['media_view'] = 'View';
+$lang['media_edit'] = 'Edit';
+$lang['media_history'] = 'These are the older revisons of the file.';
//Setup VIM: ex: et ts=2 :
diff --git a/inc/media.php b/inc/media.php
index d98e225b9..5f443a1f7 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -357,9 +357,7 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov
global $lang;
$old = @filemtime($fn);
- $oldRev = getRevisions($id, -1, 1, 1024, true); // from changelog
- $oldRev = (int)(empty($oldRev)?0:$oldRev[0]);
- if(!@file_exists(mediaFN($id, $old)) && @file_exists($fn) && $old>=$oldRev) {
+ if(!@file_exists(mediaFN($id, $old)) && @file_exists($fn)) {
// add old revision to the attic if missing
media_saveOldRevision($id);
}
@@ -530,21 +528,21 @@ function media_tabs_files($selected=false){
'" rel=".mediamanager-tab-files"';
if (!empty($selected) && $selected == 'files') $class = 'files selected';
else $class = 'files';
- $tab .= ' class="'.$class.'" >Files</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['mediaselect'].'</a>';
echo $tab;
$tab = '<a href="'.media_managerURL(array('tab_files' => 'upload')).
'" rel=".mediamanager-tab-upload"';
if (!empty($selected) && $selected == 'upload') $class = 'upload selected';
else $class = 'upload';
- $tab .= ' class="'.$class.'" >Upload</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['media_uploadtab'].'</a>';
echo $tab;
$tab = '<a href="'.media_managerURL(array('tab_files' => 'search')).
'" rel=".mediamanager-tab-search"';
if (!empty($selected) && $selected == 'search') $class = 'search selected';
else $class = 'search';
- $tab .= ' class="'.$class.'" >Search</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['media_searchtab'].'</a>';
echo $tab;
echo '<div class="mediamanager-clear">&nbsp;</div>';
@@ -565,21 +563,21 @@ function media_tabs_details($selected=false){
'" rel=".mediamanager-tab-view"';
if (!empty($selected) && $selected == 'view') $class = 'view selected';
else $class = 'view';
- $tab .= ' class="'.$class.'" >View</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['media_viewtab'].'</a>';
echo $tab;
$tab = '<a href="'.media_managerURL(array('tab_details' => 'edit')).
'" rel=".mediamanager-tab-edit"';
if (!empty($selected) && $selected == 'edit') $class = 'edit selected';
else $class = 'edit';
- $tab .= ' class="'.$class.'" >Edit</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['media_edittab'].'</a>';
echo $tab;
$tab = '<a href="'.media_managerURL(array('tab_details' => 'history')).
'" rel=".mediamanager-tab-history"';
if (!empty($selected) && $selected == 'history') $class = 'history selected';
else $class = 'history';
- $tab .= ' class="'.$class.'" >History</a>';
+ $tab .= ' class="'.$class.'" >'.$lang['media_historytab'].'</a>';
echo $tab;
echo '<div class="mediamanager-clear">&nbsp;</div>';
@@ -597,14 +595,14 @@ function media_tab_files_options(){
echo '<div class="background-container">';
echo '<div id="id-mediamanager-tabs-files" style="display: inline;">';
echo '<a href="'.media_managerURL(array('view' => 'thumbs')).'"
- rel=".mediamanager-files-thumbnails-tab" class="mediamanager-link-thumbnails">
- Thumbs</a>';
+ rel=".mediamanager-files-thumbnails-tab" class="mediamanager-link-thumbnails">'.
+ $lang['media_thumbsview'].'</a>';
echo '<a href="'.media_managerURL(array('view' => 'list')).'"
rel=".mediamanager-files-list-tab" class="mediamanager-link-list"
- title="View as list">List</a>';
+ title="View as list">'.$lang['media_listview'].'</a>';
echo '</div>';
- echo '<div class="mediamanager-block-sort">Sort';
+ echo '<div class="mediamanager-block-sort">'.$lang['media_sort'];
//select
echo '</div>';
echo '<div class="mediamanager-clear">&nbsp;</div>';
@@ -675,7 +673,7 @@ function media_tab_search($ns,$auth=null) {
echo '<div class="mediamanager-tab-search">';
echo '<div class="background-container">';
- echo 'Search';
+ echo $lang['media_search'];
echo'</div>';
echo '<div class="scroll-container">';
@@ -699,16 +697,16 @@ function media_tab_view($image, $ns, $auth=null) {
echo '<div class="mediamanager-tab-detail-view">';
echo '<div class="background-container">';
- echo 'Preview of image';
+ echo $lang['media_view'];
echo '</div>';
echo '<div class="scroll-container">';
- if($auth < AUTH_READ) return false;
-
- $info = new JpegMeta(mediaFN($image));
- $w = (int) $info->getField('File.Width');
- $src = ml($image);
- echo '<img src="'.$src.'" alt="" width="99%" style="max-width: '.$w.'px;" />';
+ if ($auth >= AUTH_READ && $image) {
+ $info = new JpegMeta(mediaFN($image));
+ $w = (int) $info->getField('File.Width');
+ $src = ml($image);
+ echo '<img src="'.$src.'" alt="" width="99%" style="max-width: '.$w.'px;" />';
+ }
echo '</div>';
echo '</div>';
}
@@ -724,11 +722,11 @@ function media_tab_edit($image, $ns, $auth=null) {
echo '<div class="mediamanager-tab-detail-edit">';
echo '<div class="background-container">';
- echo 'Edit';
+ echo $lang['media_edit'];
echo '</div>';
echo '<div class="scroll-container">';
- media_metaform($image,$auth,true);
+ if ($image) media_metaform($image,$auth,true);
echo '</div>';
echo '</div>';
}
@@ -744,11 +742,12 @@ function media_tab_history($image, $ns, $auth=null) {
echo '<div class="mediamanager-tab-detail-history">';
echo '<div class="background-container">';
- echo 'History';
+ echo $lang['media_history'];
echo '</div>';
echo '<div class="scroll-container">';
-
+ $first = isset($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
+ html_revisions($first, $image);
echo '</div>';
echo '</div>';
}
@@ -764,6 +763,7 @@ function media_tab_history($image, $ns, $auth=null) {
function media_searchlist($query,$ns,$auth=null,$fullscreen=false){
global $conf;
global $lang;
+
$ns = cleanID($ns);
if ($query) {
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 09a23cbdd..81dcb66e7 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -347,7 +347,7 @@ function mediaFN($id, $rev=''){
$fn = $conf['mediadir'].'/'.utf8_encodeFN($id);
}else{
$ext = mimetype($id);
- $name = substr($id,0, -1*strlen($ext[0]));
+ $name = substr($id,0, -1*strlen($ext[0])-1);
$fn = $conf['mediaolddir'].'/'.utf8_encodeFN($name .'.'.( (int) $rev ).'.'.$ext[0]);
}
return $fn;
diff --git a/lib/tpl/default/mediamanager.css b/lib/tpl/default/mediamanager.css
new file mode 100644
index 000000000..2001bc5f9
--- /dev/null
+++ b/lib/tpl/default/mediamanager.css
@@ -0,0 +1,155 @@
+.float-image {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ width: 100px;
+ height: 180px;
+ background-color: #DEE7EC;
+ padding: 10px;
+ text-align: center;
+}
+
+.float-image:hover {
+ background-color: #dadada;
+}
+
+/* --- Tree formatting --- */
+
+#media-menu img {
+ float: left;
+ padding: 0.5em 0.3em 0 0;
+}
+
+#media-menu ul {
+ list-style-type: none;
+ list-style-image: none;
+ margin-left: 1.5em;
+}
+
+#media-menu li {
+ clear: left;
+ list-style-type: none;
+ list-style-image: none;
+}
+
+/* -------------- */
+
+.mediamanager {
+ width: 100%;
+ overflow-y: auto;
+}
+
+.mediamanager .mediamanager-slider {
+ width: auto;
+}
+
+.mediamanager .mediamanager-slider .layout {
+ float: left;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+.mediamanager .scroll-container {
+ /*height: 0px;*/
+ overflow-y: auto;
+ overflow-x: hidden;
+ padding: 0;
+ margin: 0;
+}
+
+.background-container {
+ background-color: #DEE7EC;
+ margin-bottom: 10px;
+ padding: 10px;
+ text-align: left;
+}
+
+.mediamanager-link-thumbnails {
+ background: url('icon-thumb.png') 0 -4px no-repeat;
+ padding-left: 30px;
+ display: block;
+ float: left;
+ /*width: 0;*/
+ /*overflow: hidden;*/
+}
+
+.mediamanager-link-list {
+ background: url('icon-list.png') 0 -4px no-repeat;
+ padding-left: 30px;
+ display: block;
+ float: left;
+ /*width: 0;*/
+ /*overflow: hidden;*/
+}
+
+.mediamanager-block-sort {
+ background: url('icon-sort.png') 0 -4px no-repeat;
+ padding-left: 30px;
+ display: block;
+ float: right;
+}
+
+.mediamanager-link-thumbnails:hover,
+.mediamanager-link-list:hover {
+ width: auto;
+ margin-right: 10px;
+}
+
+.mediamanager-clear {
+ clear: both;
+ line-height: 0;
+ font-size: 0;
+}
+
+.mediamanager-link-upload {
+ background: url('icon-upload.png') 0 -4px no-repeat;
+ padding-left: 30px;
+}
+
+.mediamanager-link-search {
+ background: url('icon-search.png') 0 -4px no-repeat;
+ padding-left: 30px;
+}
+
+.mediamanager-tabs a {
+ font-weight: bold;
+ display: block;
+ float: left;
+ padding: 10px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+
+ margin-right: 2px;
+
+ -moz-border-radius-topright: 10px;
+ -webkit-border-top-right-radius: 10px;
+ -moz-border-radius-topleft: 10px;
+ -webkit-border-top-left-radius: 10px;
+ border-top-right-radius: 10px;
+ border-top-left-radius: 10px;
+}
+
+.mediamanager-tabs .selected {
+ background-color: #DEE7EC;
+}
+
+.mediamanager-tabs a:hover {
+ background-color: #DEE7EC;
+ opacity: 0.5;
+}
+
+.mediamanager-table td {
+ padding: 5px;
+}
+
+.mediamanager-table tr:nth-child(2n+1){
+ background-color: #f5f5f5;
+}
+
+.mediamanager-table {
+ background: expression(this.rowIndex % 2 == 0 ? "#ffffff" : "#f5f5f5");
+}
+
+.mediamanager-table tr:hover {
+ background-color: #DEE7EC;
+} \ No newline at end of file