Add a unique parameter to the URL to aid in cache-busting.
public unique ( ) : Horde_Url | ||
return | Horde_Url | This (modified) object, to allow chaining. |
<?php /** * Copyright 1999-2014 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.horde.org/licenses/gpl */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('ansel'); $blocks = $injector->getInstance('Horde_Core_Factory_BlockCollection')->create(array('ansel'), 'myansel_layout'); $layout = $blocks->getLayoutManager(); // Handle requested actions. $layout->handle(Horde_Util::getFormData('action'), (int) Horde_Util::getFormData('row'), (int) Horde_Util::getFormData('col')); if ($layout->updated()) { $prefs->setValue('myansel_layout', $layout->serialize()); if (Horde_Util::getFormData('url')) { $url = new Horde_Url(Horde_Util::getFormData('url')); $url->unique()->redirect(); } } $page_output->header(array('title' => _("My Photos :: Add Content"))); $notification->notify(array('listeners' => 'status')); require $registry->get('templates', 'horde') . '/portal/edit.inc'; $page_output->footer();
/** * Process a modification to the current layout. * * @param string $action TODO * @param integer $row TODO * @param integer $col TODO * @param string $url TODO * * @throws Horde_Exception */ public function handle($action, $row, $col, $url = null) { switch ($action) { case 'moveUp': case 'moveDown': case 'moveLeft': case 'moveRight': case 'expandUp': case 'expandDown': case 'expandLeft': case 'expandRight': case 'shrinkLeft': case 'shrinkRight': case 'shrinkUp': case 'shrinkDown': case 'removeBlock': try { call_user_func(array($this, $action), $row, $col); $this->_updated = true; } catch (Horde_Exception $e) { $GLOBALS['notification']->push($e); } break; // Save the changes made to a block. // Save the changes made to a block. case 'save': // Save the changes made to a block and continue editing. // Save the changes made to a block and continue editing. case 'save-resume': // Get requested block type. list($newapp, $newtype) = explode(':', Horde_Util::getFormData('app')); // Is this a new block? $new = false; if ($this->isEmpty($row, $col) || !$this->rowExists($row) || !$this->colExists($col)) { // Check permissions. $max_blocks = $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_blocks'); if ($max_blocks !== true && $max_blocks <= count($this)) { Horde::permissionDeniedError('horde', 'max_blocks', sprintf(Horde_Core_Translation::ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks)); break; } $new = true; // Make sure there is somewhere to put it. $this->addBlock($row, $col); } // Or an existing one? $exists = false; $changed = false; if (!$new) { // Get target block info. $info = $this->getBlockInfo($row, $col); $exists = $this->isBlock($row, $col); // Has a different block been selected? if ($exists && ($info['app'] != $newapp || $info['block'] != $newtype)) { $changed = true; } } if ($new || $changed) { // Change app or type. $info = array('app' => $newapp, 'block' => $newtype); $params = $this->_collection->getParams($newapp, $newtype); foreach ($params as $newparam) { $info['params'][$newparam] = $this->_collection->getDefaultValue($newapp, $newtype, $newparam); } $this->setBlockInfo($row, $col, $info); } elseif ($exists) { // Change values. $this->setBlockInfo($row, $col, array('params' => Horde_Util::getFormData('params', array()))); } $this->_updated = true; if ($action == 'save') { break; } // Make a block the current block for editing. // Make a block the current block for editing. case 'edit': $this->_currentBlock = array($row, $col); $url = null; break; } if (!empty($url)) { $url = new Horde_Url($url); $url->unique()->redirect(); } }