Skip to content
Snippets Groups Projects
Commit ebb29737 authored by Dominik Eckelmann's avatar Dominik Eckelmann Committed by Michael Hamann
Browse files

fixed mediamanager options + ie6 fix (FS#2074)

parent 318408a3
No related branches found
No related tags found
No related merge requests found
......@@ -206,7 +206,7 @@ var media_manager = {
media_manager.id = id;
if(!opener){
// if we don't run in popup display example
var ex = $('ex_'+id.replace(/:/g,'_'));
var ex = $('ex'+id.replace(/:/g,'_'));
if(ex.style.display == ''){
ex.style.display = 'none';
} else {
......@@ -217,10 +217,10 @@ var media_manager = {
// FIXME these lines deactivate the media options dialog and restore
// the old behavior according to FS#2047
opener.insertTags('wiki__text','{{'+id+'|','}}','');
if(!media_manager.keepopen) window.close();
opener.focus();
return false;
//opener.insertTags('wiki__text','{{'+id+'|','}}','');
//if(!media_manager.keepopen) window.close();
//opener.focus();
//return false;
media_manager.ext = false;
......@@ -242,21 +242,11 @@ var media_manager = {
media_manager.popup.style.top = event.pageY + 'px';
// set all buttons to outset
media_manager.outSet('media__linkbtn1');
media_manager.outSet('media__linkbtn2');
media_manager.outSet('media__linkbtn3');
media_manager.outSet('media__linkbtn4');
media_manager.outSet('media__alignbtn0');
media_manager.outSet('media__alignbtn1');
media_manager.outSet('media__alignbtn2');
media_manager.outSet('media__alignbtn3');
media_manager.outSet('media__sizebtn1');
media_manager.outSet('media__sizebtn2');
media_manager.outSet('media__sizebtn3');
media_manager.outSet('media__sizebtn4');
for (var i = 1; i < 5; i++) {
media_manager.outSet('media__linkbtn' + i);
media_manager.outSet('media__alignbtn' + i);
media_manager.outSet('media__sizebtn' + i);
}
if (ext == '.swf') {
media_manager.ext = 'swf';
......@@ -266,7 +256,7 @@ var media_manager = {
$('media__linkbtn2').style.display = 'none';
// set the link button to default
if (media_manager.link != false) {
if (media_manager.link !== false) {
if ( media_manager.link == '2' || media_manager.link == '1') {
media_manager.inSet('media__linkbtn3');
media_manager.link = '3';
......@@ -293,6 +283,11 @@ var media_manager = {
// disable button for original size
$('media__sizebtn4').style.display = 'none';
if (media_manager.size == 4) {
media_manager.size = 2;
DokuCookie.setValue('size', '2');
media_manager.inSet('media__sizebtn2');
}
} else {
media_manager.ext = 'img';
......@@ -306,7 +301,7 @@ var media_manager = {
if (DokuCookie.getValue('link')) {
media_manager.link = DokuCookie.getValue('link');
}
if (media_manager.link == false) {
if (!media_manager.link) {
// default case
media_manager.link = '1';
DokuCookie.setValue('link','1');
......@@ -324,23 +319,23 @@ var media_manager = {
$('media__size').style.display = 'block';
// set the align button to default
if (media_manager.align != false) {
if (media_manager.align !== false) {
media_manager.inSet('media__alignbtn'+media_manager.align);
} else if (DokuCookie.getValue('align')) {
media_manager.inSet('media__alignbtn'+DokuCookie.getValue('align'));
media_manager.align = DokuCookie.getValue('align');
} else {
// default case
media_manager.align = '0';
media_manager.inSet('media__alignbtn0');
DokuCookie.setValue('align','0');
media_manager.align = '1';
media_manager.inSet('media__alignbtn1');
DokuCookie.setValue('align','1');
}
// set the size button to default
if (DokuCookie.getValue('size')) {
media_manager.size = DokuCookie.getValue('size');
}
if (media_manager.size == false || (media_manager.size === '4' && ext === '.swf')) {
if (!media_manager.size || (media_manager.size === '4' && ext === '.swf')) {
// default case
media_manager.size = '2';
DokuCookie.setValue('size','2');
......@@ -364,7 +359,7 @@ var media_manager = {
media_manager.popup.setAttribute('id','media__popup');
var root = document.getElementById('media__manager');
if (root == null) return;
if (root === null) return;
root.appendChild(media_manager.popup);
var headline = document.createElement('h1');
......@@ -394,8 +389,7 @@ var media_manager = {
for (var i = 0 ; i < linkbtns.length ; ++i) {
var linkbtn = document.createElement('button');
linkbtn.className = 'button';
linkbtn.value = i + 1;
linkbtn.id = "media__linkbtn" + (i + 1);
linkbtn.id = "media__linkbtn" + (i+1);
linkbtn.title = LANG['media' + linkbtns[i]];
linkbtn.style.borderStyle = 'outset';
addEvent(linkbtn,'click',function(event){ return media_manager.setlink(event,this); });
......@@ -427,8 +421,7 @@ var media_manager = {
var alignimg = document.createElement('img');
alignimg.src = DOKU_BASE + 'lib/images/media_align_' + alignbtns[n] + '.png';
alignbtn.id = "media__alignbtn" + n;
alignbtn.value = n;
alignbtn.id = "media__alignbtn" + (n+1);
alignbtn.title = LANG['media' + alignbtns[n]];
alignbtn.className = 'button';
alignbtn.appendChild(alignimg);
......@@ -462,7 +455,6 @@ var media_manager = {
sizebtn.className = 'button';
sizebtn.appendChild(sizeimg);
sizebtn.value = size + 1;
sizebtn.id = 'media__sizebtn' + (size + 1);
sizebtn.title = LANG['media' + sizebtns[size]];
sizebtn.style.borderStyle = 'outset';
......@@ -516,7 +508,7 @@ var media_manager = {
optsstart = true;
}
var s = parseInt(media_manager.size);
var s = parseInt(media_manager.size, 10);
if (s && s >= 1) {
opts += (optsstart)?'&':'?';
......@@ -537,15 +529,15 @@ var media_manager = {
}
}
}
if (media_manager.align == '1') {
if (media_manager.align == '2') {
alignleft = '';
alignright = ' ';
}
if (media_manager.align == '2') {
if (media_manager.align == '3') {
alignleft = ' ';
alignright = ' ';
}
if (media_manager.align == '3') {
if (media_manager.align == '4') {
alignleft = ' ';
alignright = '';
}
......@@ -671,14 +663,15 @@ var media_manager = {
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setalign: function(event,cb){
if(cb.value){
DokuCookie.setValue('align',cb.value);
media_manager.align = cb.value;
media_manager.outSet("media__alignbtn0");
media_manager.outSet("media__alignbtn1");
media_manager.outSet("media__alignbtn2");
media_manager.outSet("media__alignbtn3");
media_manager.inSet("media__alignbtn"+cb.value);
var id = cb.id.substring(cb.id.length -1);
if(id){
DokuCookie.setValue('align',id);
media_manager.align = id;
for (var i = 1; i<=4; i++) {
media_manager.outSet("media__alignbtn" + i);
}
media_manager.inSet("media__alignbtn"+id);
}else{
DokuCookie.setValue('align','');
media_manager.align = false;
......@@ -690,23 +683,34 @@ var media_manager = {
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setlink: function(event,cb){
if(cb.value){
DokuCookie.setValue('link',cb.value);
media_manager.link = cb.value;
media_manager.outSet("media__linkbtn1");
media_manager.outSet("media__linkbtn2");
media_manager.outSet("media__linkbtn3");
media_manager.outSet("media__linkbtn4");
media_manager.inSet("media__linkbtn"+cb.value);
var id = cb.id.substring(cb.id.length -1);
if(id){
DokuCookie.setValue('link',id);
for (var i = 1; i<=4; i++) {
media_manager.outSet("media__linkbtn"+i);
}
media_manager.inSet("media__linkbtn"+id);
var size = document.getElementById("media__size");
var align = document.getElementById("media__align");
if (cb.value != '4') {
if (id != '4') {
size.style.display = "block";
align.style.display = "block";
if (media_manager.link == '4') {
media_manager.align = '1';
DokuCookie.setValue('align', '1');
media_manager.inSet('media__alignbtn1');
media_manager.size = '2';
DokuCookie.setValue('size', '2');
media_manager.inSet('media__sizebtn2');
}
} else {
size.style.display = "none";
align.style.display = "none";
}
media_manager.link = id;
}else{
DokuCookie.setValue('link','');
media_manager.link = false;
......@@ -755,13 +759,14 @@ var media_manager = {
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setsize: function(event,cb){
if (cb.value) {
DokuCookie.setValue('size',cb.value);
media_manager.size = cb.value;
for (var i = 1 ; i <= 4 ; ++i) {
var id = cb.id.substring(cb.id.length -1);
if (id) {
DokuCookie.setValue('size',id);
media_manager.size = id;
for (var i = 1 ; i <=4 ; ++i) {
media_manager.outSet("media__sizebtn" + i);
}
media_manager.inSet("media__sizebtn"+cb.value);
media_manager.inSet("media__sizebtn"+id);
} else {
DokuCookie.setValue('size','');
media_manager.width = false;
......
......@@ -5,7 +5,7 @@
display:none;
border: 1px solid __border__;
position: absolute;
width:270px;
width:280px;
}
#media__popup h1 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment