Skip to content

Commit

Permalink
allow admin to search for users on userscope page; fix bug with live …
Browse files Browse the repository at this point in the history
…translate mode
  • Loading branch information
Jesse Young committed Dec 1, 2011
1 parent a25031d commit ce1f0a1
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion config/default.php
Expand Up @@ -30,7 +30,7 @@
'queue:port' => 22133,

'cache:backend' => "Cache_Database",
'cache:version' => 200, // increment when all cached objects need to be invalidated (rare)
'cache:version' => 201, // increment when all cached objects need to be invalidated (rare)

'analytics:backend' => "Analytics_Null",

Expand Down
1 change: 0 additions & 1 deletion config/default_mail.php
Expand Up @@ -14,7 +14,6 @@
'mail:reply_email' => "reply@localhost",
'mail:status_email' => '',
'mail:email_from' => "web@localhost",
'mail:email_pass' => "",

'mail:error_emails_enabled' => false,

Expand Down
6 changes: 3 additions & 3 deletions engine/controller/smsgateway.php
Expand Up @@ -28,8 +28,8 @@ function action_app()
$this->set_status(403);
$this->set_content("Invalid request signature");
throw new RequestAbortedException();
}
}

$request = EnvayaSMS::get_request();

$app_log = $request->log;
Expand All @@ -55,7 +55,7 @@ function action_app()
{
case EnvayaSMS::ACTION_INCOMING:
return $this->receive_sms($provider);
case EnvayaSMS::ACTION_OUTGOING:
case EnvayaSMS::ACTION_OUTGOING:
$messages = $provider->get_outgoing_messages();

$message_ids = array_map(function ($m) { return $m->id; }, $messages);
Expand Down
2 changes: 2 additions & 0 deletions engine/controller/user.php
Expand Up @@ -128,6 +128,8 @@ function index_widget($widget)
{
$user_actions_menu->add_link("Email Subscriptions", EmailSubscription::get_all_settings_url($user->email));
}

$user_actions_menu->add_link('User Properties', $user->get_admin_url());
}

if (Permission_UseAdminTools::has_for_entity($widget))
Expand Down
3 changes: 2 additions & 1 deletion mod/envaya_org/engine/action/admin/editfeaturedphoto.php
Expand Up @@ -22,7 +22,8 @@ function process_input()

if (get_input('delete'))
{
$photo->delete();
$photo->disable();
$photo->save();

SessionMessages::add(__("featured:photo:deleted"));
$this->redirect("/admin/envaya/featured_photos");
Expand Down
28 changes: 13 additions & 15 deletions mod/translate/module.php
Expand Up @@ -69,23 +69,21 @@ static function patch_Language()

if (Config::get('translate:live_interface'))
{
Engine::add_autoload_action('Language', function() {
$language = Language::current();
$language = Language::current();

$translation_language = TranslationLanguage::get_by_code($language->get_code());

$translation_language = TranslationLanguage::get_by_code($language->get_code());
$language->load_all();
$language->load_all();

$interface_keys = $translation_language->query_keys()->where("best_translation <> ''")->filter();

$interface_keys = $translation_language->query_keys()->where("best_translation <> ''")->filter();

$translations = array();
foreach ($interface_keys as $interface_key)
{
$translations[$interface_key->name] = $interface_key->best_translation;
}

$language->add_translations($translations);
});
$translations = array();
foreach ($interface_keys as $interface_key)
{
$translations[$interface_key->name] = $interface_key->best_translation;
}

$language->add_translations($translations);
}
}

Expand Down
5 changes: 5 additions & 0 deletions scripts/fake_emails.php
Expand Up @@ -23,6 +23,11 @@
$user->save();
}

foreach (EmailSubscription::query()->filter() as $subscription)
{
$subscription->email = $admin_email;
}

// also disable sms subscriptions
foreach (SMSSubscription::query()->filter() as $subscription)
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup/sources.sh
Expand Up @@ -7,7 +7,7 @@ fi

# overwrite sources.list with our own sources

if ! grep -q envaya /etc/php5/fpm/php.ini ; then
if ! grep -q envaya /etc/apt/sources.list ; then

cat <<EOF >> /etc/apt/sources.list
Expand Down
22 changes: 21 additions & 1 deletion views/default/admin/entity/userscope.php
Expand Up @@ -20,17 +20,36 @@

$users_query = $scope->query_users();

$q = get_input('q');

if ($q)
{
$users_query->fulltext($q);
}

$limit = 20;
$offset = (int)get_input('offset');
$num_users = $users_query->count();

if ($num_users || $q)
{
echo "<div style='float:right'>";
echo "<form method='GET' action='{$scope->get_admin_url()}'>";
echo view('input/text', array('name' => 'q', 'value' => $q, 'style' => 'width:150px'));
echo view('input/submit', array('name' => '', 'style' => 'margin:0px', 'value' => __('search')));
echo "</form>";
echo "</div>";

echo "<h4>Users ($num_users)</h4>";

}

if ($num_users)
{
$users = $users_query
->limit($limit, $offset)
->order_by('time_created desc')
->filter();
echo "<h4>Users ($num_users)</h4>";

$items = array();
foreach ($users as $user)
Expand All @@ -49,4 +68,5 @@
'offset' => $offset,
'count' => $num_users
));
echo "<br />";
}
1 change: 1 addition & 0 deletions views/default/org/search_form.php
Expand Up @@ -16,6 +16,7 @@

<?php
echo view('input/submit', array(
'name' => '',
'value' => __('search:submit')
));
?>
Expand Down

0 comments on commit ce1f0a1

Please sign in to comment.