Gallery 2.3 bug? Itemdelete (album/singles) update

jacbri.com

Joined: 2011-04-22
Posts: 1
Posted: Fri, 2011-04-22 21:55

http://gallery.menalto.com/node/71899

Found working solution for this.

Add this

Quote:
/**
* This view will prompt for confirmation on the deletion of an item
*/
class ItemDeleteSingleView extends GalleryView {

/**
* @see GalleryView::loadTemplate
*/
function loadTemplate(&$template, &$form) {
$itemId = GalleryUtilities::getRequestVariables('itemId');

if ($form['formName'] != 'ItemDeleteSingle') {
$form['destination'] = '';
$form['formName'] = 'ItemDeleteSingle';
}

list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
if ($ret) {
return array($ret, null);
}

/* Get child counts */
list ($ret, $childCountTable) = GalleryCoreApi::fetchDescendentCounts(array($itemId));
if ($ret) {
return array($ret, null);
}
$childCount = isset($childCountTable[$itemId]) ? $childCountTable[$itemId] : 0;

$ItemDeleteSingle = array();
$ItemDeleteSingle['itemTypeNames'] = $item->itemTypeName();
$ItemDeleteSingle['childCount'] = $childCount;

$template->setVariable('ItemDeleteSingle', $ItemDeleteSingle);
$template->setVariable('controller', 'core.ItemDeleteSingle');
return array(null, array('body' => 'modules/core/templates/ItemDeleteSingle.tpl'));

}

/**
* @see GalleryView::getViewDescription
*/
function getViewDescription() {
list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
if ($ret) {
return array($ret, null);
}

list ($ret, $item) = $this->getItem();
if ($ret) {
return array($ret, null);
}

$itemTypeNames = $item->itemTypeName(true);

return array(null, $core->translate(array('text' => 'delete %s',
'arg1' => $itemTypeNames[1])));
}
}

to file /modules/core/ItemDeleteSingle.inc

worked for me :D