Commit 0bb4b47a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Filebrowser modifications for IE6

parent 4629f23d
......@@ -123,7 +123,6 @@ function pieform_element_filebrowser(Pieform $form, $element) {
{$prefix}.filedata = {$fileliststr};";
if ($config['select']) {
$initjs .= "{$prefix}.selecteddata = {$selectedliststr};";
$initjs .= "forEach(getElementsByTagAndClassName('button', 'unselect', '{$prefix}_selectlist'), function (elem) { removeElementClass(elem, 'hidden'); });";
}
$_PIEFORM_FILEBROWSERS[$prefix]['views_js'] = $initjs;
......
......@@ -190,9 +190,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
if (!hasElementClass(editrow, 'hidden')) {
addElementClass(editrow, 'hidden');
// Reconnect the old edit button to open the form
forEach(getElementsByTagAndClassName('button', null, editrow.previousSibling), function (elem) {
forEach(getElementsByTagAndClassName('input', null, editrow.previousSibling), function (elem) {
var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$"));
if (name[1] == 'edit') {
if (name && name[1] && name[1] == 'edit') {
disconnectAll(elem);
connect(elem, 'onclick', self.edit_form);
}
......@@ -240,20 +240,22 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.browse_init = function () {
if (self.config.edit) {
forEach(getElementsByTagAndClassName('button', null, 'filelist'), function (elem) {
forEach(getElementsByTagAndClassName('input', null, 'filelist'), function (elem) {
var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$"));
if (name[1] == 'edit') {
connect(elem, 'onclick', self.edit_form);
}
else if (name[1] == 'delete') {
var id = name[2];
if (self.filedata[id].attachcount > 0) {
connect(elem, 'onclick', function (e) {
if (!confirm(get_string('detachfilewarning', self.filedata[id].attachcount))) {
e.stop();
return false;
}
});
if (name && name[1]) {
if (name[1] == 'edit') {
connect(elem, 'onclick', self.edit_form);
}
else if (name[1] == 'delete') {
var id = name[2];
if (self.filedata[id].attachcount > 0) {
connect(elem, 'onclick', function (e) {
if (!confirm(get_string('detachfilewarning', self.filedata[id].attachcount))) {
e.stop();
return false;
}
});
}
}
}
});
......@@ -405,14 +407,14 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false;
});
}
forEach(getElementsByTagAndClassName('button', 'unselect', self.id + '_selectlist'), function (elem) {
forEach(getElementsByTagAndClassName('input', 'unselect', self.id + '_selectlist'), function (elem) {
connect(elem, 'onclick', self.unselect);
});
self.connect_select_buttons();
}
this.connect_select_buttons = function () {
forEach(getElementsByTagAndClassName('button', 'select', 'filelist'), function (elem) {
forEach(getElementsByTagAndClassName('input', 'select', 'filelist'), function (elem) {
var id = elem.name.replace(/.*_select\[(\d+)\]$/, '$1');
if (self.selecteddata[id]) {
addElementClass(elem, 'hidden');
......@@ -452,7 +454,6 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
rows = [];
self.selecteddata = {};
}
// var remove = BUTTON({'type':'submit', 'class':'button small unselect', 'name':'unselect[' + id + ']', 'value':id}, get_string('remove')); // IE problem ?
var remove = INPUT({'type': 'submit', 'class':'button small unselect', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')});
connect(remove, 'onclick', self.unselect);
appendChildNodes(tbody, TR({'class': 'r' + rows.length % 2 + (highlight ? ' highlight-file' : '')},
......@@ -543,16 +544,3 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
/*
// Check if there's already a file attached to the post with the given name
function fileattached(filename) {
return some(map(function (e) { return e.childNodes[1]; }, attached.tbody.childNodes),
function (cell) { return scrapeText(cell) == filename; });
}
// Check if there's already a file attached to the post with the given id
function fileattached_id(id) {
return some(attached.tbody.childNodes, function (r) { return getNodeAttribute(r,'id') == id; });
}
*/
......@@ -63,8 +63,7 @@
{/if}
<tr>
<td colspan=2>
<button type="submit" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{$fileinfo->id}">{str tag=savechanges section=artefact.file}</button>
<input type="button" class="button hidden" name="replace" value="{str tag=overwrite}" />
<input type="submit" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{str tag=savechanges section=artefact.file}" />
<input type="submit" class="button" name="{$prefix}_canceledit" id="{$prefix}_edit_cancel" value="{str tag=cancel}" />
</td>
</tr>
......
......@@ -40,11 +40,11 @@
<td>{$file->mtime}</td>
<td>
{if $editable && !$file->isparent}
{if !isset($file->can_edit) || $file->can_edit !== 0}<button type="submit" name="{$prefix}_edit[{$file->id}]" value="{$file->id}">{str tag=edit}</button>{/if}
{if $file->childcount == 0}<button type="submit" name="{$prefix}_delete[{$file->id}]" value="{$file->id}">{str tag=delete}</button>{/if}
{if !isset($file->can_edit) || $file->can_edit !== 0}<input type="submit" name="{$prefix}_edit[{$file->id}]" value="{str tag=edit}" />{/if}
{if $file->childcount == 0}<input type="submit" name="{$prefix}_delete[{$file->id}]" value="{str tag=delete}" />{/if}
{/if}
{if $selectable && $file->artefacttype != 'folder' && $publishable}
<button type="submit" class="select small" name="{$prefix}_select[{$file->id}]" id="{$prefix}_select_{$file->id}" value="{$file->id}">{str tag=select}</button>
<input type="submit" class="select small" name="{$prefix}_select[{$file->id}]" id="{$prefix}_select_{$file->id}" value="{str tag=select}" />
{/if}
</td>
</tr>
......
......@@ -20,7 +20,7 @@
</td>
<td>{$file->description|escape}</td>
<td>
<button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<input type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{str tag=remove}" />
<input type="hidden" name="{$prefix}_selected[{$file->id}]" value="{$file->id}">
</td>
</tr>
......
......@@ -390,6 +390,7 @@ class BlockInstance {
'message' => get_string('blockinstanceconfiguredsuccessfully', 'view'),
'data' => $this->render_editing(false, false, $form->submitted_by_js()),
'blockid' => $this->get('id'),
'viewid' => $this->get('view'),
);
$redirect = '/view/blocks.php?id=' . $this->get('view');
......
......@@ -1094,6 +1094,9 @@ function blockConfigSuccess(form, data) {
eval(data.formelementsuccess + '(form, data)');
}
if (data.blockid) {
if (viewManager.isIE6 && data.viewid) {
document.location.href = config['wwwroot'] + 'view/blocks.php?id=' + data.viewid;
}
viewManager.replaceConfigureBlock(data);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment