mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* a guide is a wrapper around an article providing management tools. * administration is limited to the review process. Needs to be expanded. * articles on DB pages are seperate. Editor will be added in the future.
85 lines
2.4 KiB
PHP
85 lines
2.4 KiB
PHP
var _ = [
|
|
{
|
|
id: 'description',
|
|
name: LANG.ct_dialog_description,
|
|
type: 'text',
|
|
align: 'left',
|
|
value: 'description',
|
|
after: 'title',
|
|
width: '50%',
|
|
compute: function(guide, td, tr) {
|
|
td.innerText = guide.description;
|
|
},
|
|
sortFunc: function(a, b, col) {
|
|
return $WH.strcmp(a.description, b.description);
|
|
},
|
|
getVisibleText: function(guide) {
|
|
return guide.description;
|
|
}
|
|
},
|
|
{
|
|
id: 'manage',
|
|
name: 'Manage',
|
|
type: 'text',
|
|
align: 'center',
|
|
value: 'subject',
|
|
sortable: false,
|
|
compute: function(guide, td, tr) {
|
|
let wrapper = $WH.ce('div');
|
|
|
|
let send = function (el, id, status)
|
|
{
|
|
let message = '';
|
|
if (status == 4) // rejected
|
|
{
|
|
while (message === '')
|
|
message = prompt('Please provide your reasoning.');
|
|
|
|
if (message === null)
|
|
return false;
|
|
}
|
|
|
|
$.ajax({cache: false, url: '?admin=guide', type: 'POST',
|
|
error: function() {
|
|
alert('Operation failed.');
|
|
},
|
|
success: function(json) {
|
|
if (json != 1)
|
|
alert('Operation failed.');
|
|
else
|
|
$WH.de(el.parentNode);
|
|
},
|
|
data: { id: id, status: status, msg: message }
|
|
})
|
|
|
|
return true;
|
|
};
|
|
|
|
let a = $WH.ce('a');
|
|
a.style.fontFamily = 'Verdana, sans-serif';
|
|
a.style.marginLeft = '10px';
|
|
a.href = '#';
|
|
|
|
_ = a.cloneNode();
|
|
_.className = 'icon-edit';
|
|
_.href = '?guide=edit&id=' + guide.id;
|
|
g_addTooltip(_, 'Edit');
|
|
$WH.ae(wrapper, _);
|
|
|
|
_ = a.cloneNode();
|
|
_.className = 'icon-tick';
|
|
_.onclick = send.bind(this, td, guide.id, 3);
|
|
g_addTooltip(_, 'Approve');
|
|
$WH.ae(wrapper, _);
|
|
|
|
_ = a.cloneNode();
|
|
_.className = 'icon-delete';
|
|
_.onclick = send.bind(this, td, guide.id, 4);
|
|
g_addTooltip(_, 'Reject');
|
|
$WH.ae(wrapper, _);
|
|
|
|
$WH.ae(td, wrapper);
|
|
}
|
|
}
|
|
];
|