public function deleteAjaxAction(\Difra\Param\AnyInt $id) { $this->subInit(); try { $class = \Difra\Unify\Storage::getClass('WidgetsDirectory'); $object = $class::get((string) $id); if ($object->directory != static::directory) { throw new \Difra\Exception('This item does not exist in this directory.'); } $object->delete(); } catch (\Difra\Exception $ex) { } \Difra\Ajaxer::getInstance()->load('#DirectoryWindow', $this->renderWindow()); }
public function action($value) { $escapedValue = addslashes(htmlspecialchars($value)); \Difra\Ajaxer::getInstance()->exec(<<<SCRIPT \t\t\tvar person = \$( '.widgets-directory.last' ); \t\t\tif( person.length ) { \t\t\t\tvar id = person.closest( 'tr' ).find( '.portfolio-role' ).attr( 'ts' ); \t\t\t\tperson.before( \t\t\t\t\t'<div class="portfolio-person">' + \t\t\t\t\t '{$escapedValue}' + \t\t\t\t\t '<input type="hidden" name="roles[' + id + '][]" value="{$escapedValue}">' + \t\t\t\t\t '<a href="#" class="action delete" onclick="\$(this).parent().remove();"></a>' + \t \t\t\t'</div>' \t \t\t); \t \t} SCRIPT ); }
public function action($value) { $escapedValue = addslashes(htmlspecialchars($value)); $ts = microtime(true); \Difra\Ajaxer::getInstance()->exec(<<<SCRIPT \t\t\tif( \$( '.widgets-directory.last' ).closest( '#add-role' ).length ) { \t\$( '#add-role' ).before( \t\t'<tr>' + \t\t '<td>' + \t\t '<a href="#" class="action delete" onclick="\$(this).parent().parent().remove()"></a> ' + \t\t '{$escapedValue}' + \t\t '<input type="hidden" name="roles[{$ts}][role]" value="{$escapedValue}" class="portfolio-role" ts="{$ts}">' + \t '</td>' + \t\t '<td class="add-person"><a href="/adm/content/portfolio/persons" class="action add ajaxer widgets-directory"></a></td>' + \t\t'</tr>' \t); } SCRIPT ); }
public function deleteAction(\Difra\Param\AnyInt $id) { \Difra\Plugins\Announcements\Additionals::delete($id->val()); \Difra\Ajaxer::getInstance()->refresh(); }