Skip to content

Commit 5f3cb53

Browse files
committed
Merge branch 'hotfix-development'
Addresses #541
2 parents e57bde2 + dcb59cd commit 5f3cb53

8 files changed

Lines changed: 332 additions & 154 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Change Log
22

3+
## v0.3.1.21
4+
5+
- Use Laravel's Schema interface to create tables and default rows, instead of constructing them with SQL
6+
37
## v0.3.1.20
48

9+
- Added `pushAlert()`,`clearAlerts()` in `public/js/userfrosting.js` and updated `flashAlerts()`
510
- Revert changes to User::fresh() but leave comment regarding upgrading Eloquent
611

712
## v0.3.1.19

public/js/userfrosting.js

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//does the fetching and printing of the server-side stored alerts
2+
//every object contained content or alert(s) removed
13
(function( $ ) {
24
$.fn.flashAlerts = function() {
35
var field = $(this);
@@ -8,15 +10,7 @@
810
var alertHTML = "";
911
if (data) {
1012
jQuery.each(data, function(alert_idx, alert_message) {
11-
if (alert_message['type'] == "success"){
12-
alertHTML += "<div class='alert alert-success'>" + alert_message['message'] + "</div>";
13-
} else if (alert_message['type'] == "warning"){
14-
alertHTML += "<div class='alert alert-warning'>" + alert_message['message'] + "</div>";
15-
} else if (alert_message['type'] == "info"){
16-
alertHTML += "<div class='alert alert-info'>" + alert_message['message'] + "</div>";
17-
} else if (alert_message['type'] == "danger"){
18-
alertHTML += "<div class='alert alert-danger'>" + alert_message['message'] + "</div>";
19-
}
13+
alertHTML += getAlertHtml(alert_message['type'], alert_message['message']);
2014
});
2115
}
2216
field.html(alertHTML);
@@ -25,8 +19,49 @@
2519
return data;
2620
});
2721
};
22+
23+
}( jQuery ));
24+
25+
//does the creation of client-side = "pushed"-alerts
26+
//any existing alert preserved
27+
(function( $ ) {
28+
$.fn.pushAlert = function( alert_type, alert_message ){
29+
var field = $(this);
30+
if (alert_type && alert_message){
31+
var newAlertHTML = "";
32+
var oldAlertHtml = field.html();
33+
if (typeof oldAlertHtml !== 'undefined' && oldAlertHtml !== null)
34+
newAlertHTML += oldAlertHtml;
35+
36+
newAlertHTML += getAlertHtml(alert_type, alert_message);
37+
field.html(newAlertHTML);
38+
$("html, body").animate({ scrollTop: 0 }, "fast"); // Scroll back to top of page
39+
}
40+
41+
return field;
42+
};
43+
2844
}( jQuery ));
2945

46+
//every object contained content or alert(s) removed
47+
(function( $ ) {
48+
$.fn.clearAlerts = function(){
49+
return this.html("");
50+
};
51+
}( jQuery ));
52+
53+
//helper function to generate the alert html tags
54+
function getAlertHtml(alert_type, alert_message){
55+
if (alert_type == "success"){
56+
return "<div class='alert alert-success'>" + alert_message + "</div>";
57+
} else if (alert_type == "warning"){
58+
return "<div class='alert alert-warning'>" + alert_message + "</div>";
59+
} else if (alert_type == "info"){
60+
return "<div class='alert alert-info'>" + alert_message + "</div>";
61+
} else if (alert_type == "danger"){
62+
return "<div class='alert alert-danger'>" + alert_message + "</div>";
63+
}
64+
}
3065

3166
/** format an ISO date using Moment.js
3267
* http://momentjs.com/

userfrosting/config-userfrosting-example.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
'cache_limiter' => false
4141
],
4242
'db' => [
43-
'db_host' => 'localhost',
44-
'db_port' => '', // Leave blank to use the default port for your database driver (eg. 3306 for MySQL)
45-
'db_name' => 'userfrosting',
46-
'db_user' => 'admin',
47-
'db_pass' => 'password',
48-
'db_prefix'=> 'uf_'
43+
'db_driver' => 'mysql',
44+
'db_host' => 'localhost',
45+
'db_port' => '', // Leave blank to use the default port for your database driver (eg. 3306 for MySQL)
46+
'db_name' => 'userfrosting',
47+
'db_user' => 'admin',
48+
'db_pass' => 'password',
49+
'db_prefix' => 'uf_'
4950
],
5051
'mail' => 'smtp',
5152
'smtp' => [
@@ -90,12 +91,13 @@
9091
'cache_limiter' => false
9192
],
9293
'db' => [
93-
'db_host' => 'localhost',
94-
'db_port' => '', // Leave blank to use the default port for your database driver (eg. 3306 for MySQL)
95-
'db_name' => 'userfrosting',
96-
'db_user' => 'admin',
97-
'db_pass' => 'password',
98-
'db_prefix'=> 'uf_'
94+
'db_driver' => 'mysql',
95+
'db_host' => 'localhost',
96+
'db_port' => '', // Leave blank to use the default port for your database driver (eg. 3306 for MySQL)
97+
'db_name' => 'userfrosting',
98+
'db_user' => 'admin',
99+
'db_pass' => 'password',
100+
'db_prefix' => 'uf_'
99101
],
100102
'mail' => 'smtp',
101103
'smtp' => [

userfrosting/controllers/InstallController.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,22 @@ public function setupMasterAccount(){
230230

231231
// Create the master user
232232
$user = new User($data);
233+
233234
$user->id = $this->_app->config('user_id_master');
234235

236+
// If using SQL Server or Azure SQL Server, store the user now.
237+
if (\Illuminate\Database\Capsule\Manager::connection()->getPdo()->getAttribute(\PDO::ATTR_DRIVER_NAME) == "sqlsrv") {
238+
// Manually insert master user to overcome session IDENTITY_INSERT restriction caused by AUTO_NUMBER specification.
239+
$tableName = $user->getTable();
240+
$values = $user->export();
241+
$values['created_at'] = \Carbon\Carbon::now();
242+
$values['updated_at'] = \Carbon\Carbon::now();
243+
\Illuminate\Database\Capsule\Manager::statement("SET IDENTITY_INSERT [$tableName] ON; INSERT INTO [$tableName] (id, user_name, display_name, email, password, flag_verified, locale, primary_group_id, title, created_at, updated_at) VALUES (:id, :user_name, :display_name, :email, :password, :flag_verified, :locale, :primary_group_id, :title, :created_at, :updated_at);", $values);
244+
245+
// Get master user back from database
246+
$user = User::where('id', $this->_app->config('user_id_master'))->first();
247+
}
248+
235249
// Add user to default groups, including default primary group
236250
$defaultGroups = Group::where('is_default', GROUP_DEFAULT)->get();
237251
$user->addGroup($primaryGroup->id);

userfrosting/initialize.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@
5151
'prefix' => ''
5252
];
5353

54-
// This is for backwards compatibility. Pre-0.3.1.19 configuration files won't have $dbx['db_port'] defined at all.
55-
if (isset($dbx['db_port']))
56-
{
54+
// This is for backwards compatibility. Pre-0.3.1.19 configuration files won't have $dbx['db_port'] or $dbx['db_driver'] defined at all.
55+
if (isset($dbx['db_port'])) {
5756
$connection_array['port'] = $dbx['db_port'];
5857
}
5958

59+
if (isset($dbx['db_driver'])) {
60+
$connection_array['driver'] = $dbx['db_driver'];
61+
}
62+
6063
$capsule->addConnection($connection_array);
6164

6265
// Register as global connection
@@ -155,7 +158,7 @@
155158
'guest_theme' => 'default',
156159
'minify_css' => '0',
157160
'minify_js' => '0',
158-
'version' => '0.3.1.20',
161+
'version' => '0.3.1.21',
159162
'author' => 'Alex Weissman',
160163
'show_terms_on_register' => '1',
161164
'site_location' => 'The State of Indiana'

0 commit comments

Comments
 (0)