Skip to content

Commit

Permalink
Inject all variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 5, 2014
1 parent b783d2a commit 15d381e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 31 deletions.
21 changes: 12 additions & 9 deletions turba/browse.php
Expand Up @@ -26,19 +26,22 @@
}

$params = array(
'vars' => Horde_Variables::getDefaultVariables(),
'prefs' => &$prefs,
'notification' => &$notification,
'registry' => &$registry,
'browse_source_count' => $browse_source_count,
'copymoveSources' => $copymoveSources,
'addSources' => $addSources,
'cfgSources' => $cfgSources,
'attributes' => $attributes,
'turba_shares' => $injector->getInstance('Turba_Shares'),
'browse_source_count' => $browse_source_count,
'browser' => $browser,
'cfgSources' => $cfgSources,
'copymoveSources' => $copymoveSources,
'conf' => $conf,
'factory' => $injector->getInstance('Turba_Factory_Driver'),
'history' => $injector->getInstance('Horde_History'),
'notification' => $notification,
'page_output' => $page_output,
'prefs' => $prefs,
'registry' => $registry,
'source' => Turba::$source,
'browser' => $browser
'turba_shares' => $injector->getInstance('Turba_Shares'),
'vars' => Horde_Variables::getDefaultVariables(),
);

$browse = new Turba_View_Browse($params);
Expand Down
33 changes: 11 additions & 22 deletions turba/lib/View/Browse.php
Expand Up @@ -44,9 +44,7 @@ public function run()
$notification->push(_("There are no browseable address books."), 'horde.warning');
} else {
try {
$driver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($source);
$driver = $factory->create($source);
} catch (Turba_Exception $e) {
$notification->push($e, 'horde.error');
unset($driver);
Expand Down Expand Up @@ -136,9 +134,7 @@ public function run()
$targetSource = $vars->get('targetAddressbook');

try {
$targetDriver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($targetSource);
$targetDriver = $factory->create($targetSource);
} catch (Turba_Exception $e) {
$notification->push($e, 'horde.error');
break;
Expand Down Expand Up @@ -167,9 +163,7 @@ public function run()

// Try and load the driver for the source.
try {
$sourceDriver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($objectSource);
$sourceDriver = $factory->create($objectSource);
} catch (Turba_Exception $e) {
$notification->push($e, 'horde.error');
continue;
Expand Down Expand Up @@ -212,9 +206,10 @@ public function run()
// Get 'data' value if object type is image, the
// direct value in other case.
$objAttributes[$info_key] =
isset($GLOBALS['attributes'][$info_key]) &&
$GLOBALS['attributes'][$info_key]['type'] == 'image' ?
$objectValue['load']['data'] : $objectValue;
isset($attributes[$info_key]) &&
$attributes[$info_key]['type'] == 'image'
? $objectValue['load']['data']
: $objectValue;
}
}
unset($objAttributes['__owner']);
Expand Down Expand Up @@ -256,8 +251,7 @@ public function run()
* because otherwise the delete log would be after the
* add log. */
try {
$GLOBALS['injector']->getInstance('Horde_History')
->log('turba:' . $targetDriver->getName() . ':' . $objAttributes['__uid'],
$history->log('turba:' . $targetDriver->getName() . ':' . $objAttributes['__uid'],
array('action' => 'add'),
true);
} catch (Exception $e) {
Expand All @@ -282,9 +276,7 @@ public function run()
}

try {
$targetDriver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($targetSource);
$targetDriver = $factory->create($targetSource);
} catch (Turba_Exception $e) {
$notification->push($e, 'horde.error');
break;
Expand All @@ -299,9 +291,7 @@ public function run()
} else {
$targetSource = $vars->get('targetAddressbook');
try {
$targetDriver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($targetSource);
$targetDriver = $factory->create($targetSource);
} catch (Turba_Exception $e) {
$notification->push($e, 'horde.error');
break;
Expand Down Expand Up @@ -416,7 +406,7 @@ public function run()
// We might get here from the search page but are not allowed to browse
// the current address book.
if ($actionID && empty($cfgSources[$source]['browse'])) {
Horde::url($GLOBALS['prefs']->getValue('initial_page'), true)
Horde::url($prefs->getValue('initial_page'), true)
->redirect();
}
}
Expand Down Expand Up @@ -492,7 +482,6 @@ public function run()
$templates[] = '/browse/header.inc';
}

global $page_output;
$page_output->addScriptFile('quickfinder.js', 'horde');
$page_output->addScriptFile('scriptaculous/effects.js', 'horde');
$page_output->addScriptFile('redbox.js', 'horde');
Expand Down

0 comments on commit 15d381e

Please sign in to comment.