Skip to content

Commit

Permalink
Integration of bootswatch themes for bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinBM committed Mar 15, 2024
1 parent 52a978b commit 761a846
Show file tree
Hide file tree
Showing 70 changed files with 1,926 additions and 1,123 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"league/commonmark": "^2.4",
"symfony/dotenv": "^4.3 || 5.4",
"twbs/bootstrap": "^5.3",
"twbs/bootstrap-icons": "^1.11"
"twbs/bootstrap-icons": "^1.11",
"thomaspark/bootswatch": "^5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3.0"
Expand Down
47 changes: 46 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions modules/2fa/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function output() {
if (array_key_exists('2fa_enable', $settings)) {
$enabled = $settings['2fa_enable'];
}
$res = '<tr><td colspan="2" data-target=".tfa_setting" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
$res = '<tr><td colspan="2" data-target=".tfa_setting" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-unlock-fill fs-5 me-2"></i>'.$this->trans('2 Factor Authentication').'</td></tr>';

$res .= '<tr class="tfa_setting"><td><label class="form-check-label">'.$this->trans('Enable 2 factor authentication').'</label>'.
Expand Down Expand Up @@ -255,7 +255,7 @@ protected function output() {
<label for="2fa_code">'.$this->trans('Login code').'</label>
</div>
<div class="d-grid">
<input type="submit" class="btn btn-success btn-lg" value="'.$this->trans('Submit').'">
<input type="submit" class="btn btn-primary btn-lg" value="'.$this->trans('Submit').'">
</div>
<input type="hidden" name="hm_page_key" value="'.$this->get('2fa_key').'">
</form>
Expand Down
2 changes: 1 addition & 1 deletion modules/account/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ protected function output() {
<label for="new_pass2">'.$this->trans('New password again').'</label>
</div>
<input type="submit" name="change_password" class="btn btn-success" value="'.$this->trans('Update').'">
<input type="submit" name="change_password" class="btn btn-primary" value="'.$this->trans('Update').'">
</form>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion modules/advanced_search/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ protected function output() {
$this->targets().
$this->times().
$this->other().
'<div class="submit_section px-5"><input type="button" class="btn btn-success" id="adv_search" value="'.$this->trans('Search').'" />'.
'<div class="submit_section px-5"><input type="button" class="btn btn-primary" id="adv_search" value="'.$this->trans('Search').'" />'.
' <input class="btn btn-light border" type="button" class="adv_reset" value="'.$this->trans('Reset').'" />';
}

Expand Down
2 changes: 1 addition & 1 deletion modules/calendar/hm-calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private function output_event($day) {
});
$res = '';
foreach ($this->events[$day] as $event) {
$res .= '<div class="cal_event text-secondary">'.
$res .= '<div class="cal_event">'.
$this->output_event_details($event).
$this->output_mod->html_safe(date('H:i', $event['ts'])).
' <a class="cal_title cursor-pointer">'.$this->output_mod->html_safe($event['title']).
Expand Down
2 changes: 1 addition & 1 deletion modules/calendar/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected function output() {
<div class="mb-3 row">
<div class="col-md-2"></div>
<div class="col-md-10">
<button type="submit" class="btn btn-success">'.$this->trans('Create').'</button>
<button type="submit" class="btn btn-primary">'.$this->trans('Create').'</button>
</div>
</div>
</form>
Expand Down
8 changes: 4 additions & 4 deletions modules/carddav_contacts/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected function output() {
if (count($settings) == 0) {
return;
}
$res = '<tr><td data-target=".carddav_settings" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
$res = '<tr><td data-target=".carddav_settings" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-people-fill fs-5 me-2"></i>'.
$this->trans('CardDav Addressbooks').'</td></tr>';
foreach ($settings as $name => $vals) {
Expand All @@ -273,7 +273,7 @@ protected function output() {
if ($pass) {
$res .= 'disabled="disabled" placeholder="'.$this->trans('Password saved').'" ';
$res .= 'name="carddav_passwords['.$this->html_safe($name).']" /> <input type="button" ';
$res .= 'value="'.$this->trans('Unlock').'" class="carddav_password_change btn btn-success" /></td></tr>';
$res .= 'value="'.$this->trans('Unlock').'" class="carddav_password_change btn btn-primary" /></td></tr>';
}
else {
$res .= 'autocomplete="new-password" placeholder="'.$this->trans('Password').'" ';
Expand All @@ -298,7 +298,7 @@ protected function output() {
return '';
}
$form_class = 'contact_form';
$button = '<input class="add_contact_submit btn btn-success" type="submit" name="add_contact" value="'.$this->trans('Add').'" />';
$button = '<input class="add_contact_submit btn btn-primary" type="submit" name="add_contact" value="'.$this->trans('Add').'" />';
$title = $this->trans('Add Carddav');
$current = $this->get('current_carddav_contact', array());
$current_source = false;
Expand All @@ -316,7 +316,7 @@ protected function output() {
$form_class = 'contact_update_form mt-3';
$title = sprintf($this->trans('Update Carddav - %s'), $this->html_safe($current['source']));
$button = '<input type="hidden" name="contact_id" value="'.$this->html_safe($current['id']).'" />'.
'<input class="edit_contact_submit btn btn-success" type="submit" name="edit_contact" value="'.$this->trans('Update').'" />';
'<input class="edit_contact_submit btn btn-primary" type="submit" name="edit_contact" value="'.$this->trans('Update').'" />';
}
if ($current_source) {
$target = '<input type="hidden" name="carddav_email_id" value="'.$this->html_safe($current['carddav_email_id']).'" />'.
Expand Down
2 changes: 1 addition & 1 deletion modules/contacts/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ protected function output() {
foreach ($backends as $val) {
$res .= '<option value="'.$this->html_safe($val).'">'.$this->html_safe($val).'</option>';
}
$res .= '</select></div> <div class="col"><input onclick="return add_contact_from_message_view()" class="add_contact_button w-100 btn btn-success btn-sm" '.
$res .= '</select></div> <div class="col"><input onclick="return add_contact_from_message_view()" class="add_contact_button w-100 btn btn-primary btn-sm" '.
'type="button" value="'.$this->trans('Add Contact').'"></div></div></div></div>';
$headers = $headers.$res;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public function process() {
$headers['X-XSS-Protection'] = '1; mode=block';
$headers['X-Content-Type-Options'] = 'nosniff';
$headers['Expires'] = gmdate('D, d M Y H:i:s \G\M\T', strtotime('-1 year'));
$headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self' 'unsafe-inline'; ".
"connect-src 'self'; font-src 'self'; img-src ".$img_src." data:; style-src 'self' 'unsafe-inline';";
$headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self' 'unsafe-inline'; " .
"connect-src 'self'; font-src 'self' https://fonts.gstatic.com; img-src " . $img_src . " data:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;";
if ($this->request->type == 'AJAX') {
$headers['Content-Type'] = 'application/json';
}
Expand Down
32 changes: 17 additions & 15 deletions modules/core/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function output() {
' <label class="screen_reader" for="search_since">'.$this->trans('Search Since').'</label>'.
message_since_dropdown($this->get('search_since', DEFAULT_SINCE), 'search_since', $this).
combined_sort_dialog($this).
' | <input type="submit" class="search_update btn btn-success btn-sm" value="'.$this->trans('Update').'" />'.
' | <input type="submit" class="search_update btn btn-primary btn-sm" value="'.$this->trans('Update').'" />'.
' <input type="button" class="search_reset btn btn-light border btn-sm" value="'.$this->trans('Reset').'" />';
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ protected function output() {
</div>'.
'<div class="d-grid">'.$stay_logged_in.
'<input type="hidden" name="hm_page_key" value="'.Hm_Request_Key::generate().'" />
<input type="submit" id="login" class="btn btn-success btn-lg" value="'.$this->trans('Login').'">
<input type="submit" id="login" class="btn btn-primary btn-lg" value="'.$this->trans('Login').'">
</div>
</div>
</div>
Expand Down Expand Up @@ -294,8 +294,8 @@ protected function output() {
</div>
<div class="modal-footer">
<input class="cancel_logout save_settings btn btn-secondary" data-bs-dismiss="modal" type="button" value="'.$this->trans('Cancel').'" />
<input class="save_settings btn btn-success" id="logout_without_saving" type="submit" name="logout" value="'.$this->trans('Just Logout').'" />
<input class="save_settings btn btn-success" type="submit" name="save_and_logout" value="'.$this->trans('Save and Logout').'" />
<input class="save_settings btn btn-primary" id="logout_without_saving" type="submit" name="logout" value="'.$this->trans('Just Logout').'" />
<input class="save_settings btn btn-primary" type="submit" name="save_and_logout" value="'.$this->trans('Save and Logout').'" />
</div>
</div>
</div>
Expand Down Expand Up @@ -502,7 +502,9 @@ protected function output() {
$res = '';
$mods = $this->get('router_module_list');
if (DEBUG_MODE) {
$res .= '<link href="vendor/twbs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />';
if ($this->get('theme') == '') {
$res .= '<link href="' . WEB_ROOT . 'modules/themes/assets/default/css/default.css?v=' . CACHE_ID . '" media="all" rel="stylesheet" type="text/css" />';
}
$res .= '<link href="vendor/twbs/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet" type="text/css" />';
foreach (glob(APP_PATH.'modules'.DIRECTORY_SEPARATOR.'**', GLOB_ONLYDIR | GLOB_MARK) as $name) {
$rel_name = str_replace(APP_PATH, '', $name);
Expand Down Expand Up @@ -867,7 +869,7 @@ class Hm_Output_start_flagged_settings extends Hm_Output_Module {
* Settings in this section control the flagged messages view
*/
protected function output() {
return '<tr><td data-target=".flagged_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".flagged_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-flag-fill fs-5 me-2"></i>'.
$this->trans('Flagged').'</td></tr>';
}
Expand All @@ -885,7 +887,7 @@ protected function output() {
if ($this->get('single_server_mode')) {
return '';
}
return '<tr><td data-target=".all_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".all_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-box2-fill fs-5 me-2"></i>'.
$this->trans('Everything').'</td></tr>';
}
Expand All @@ -900,7 +902,7 @@ class Hm_Output_start_unread_settings extends Hm_Output_Module {
* Settings in this section control the Unread view
*/
protected function output() {
return '<tr><td data-target=".unread_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".unread_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-envelope-fill fs-5 me-2"></i>'.
$this->trans('Unread').'</td></tr>';
}
Expand All @@ -922,7 +924,7 @@ protected function output() {
if ($this->get('single_server_mode')) {
return '';
}
return '<tr><td data-target=".email_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".email_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-envelope-fill fs-5 me-2"></i>'.
$this->trans('All Email').'</td></tr>';
}
Expand All @@ -937,7 +939,7 @@ class Hm_Output_start_general_settings extends Hm_Output_Module {
* General settings like langauge and timezone will go here
*/
protected function output() {
return '<tr><td data-target=".general_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".general_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-gear-wide-connected fs-5 me-2"></i>'.
$this->trans('General').'</td></tr>';
}
Expand Down Expand Up @@ -1224,7 +1226,7 @@ class Hm_Output_end_settings_form extends Hm_Output_Module {
*/
protected function output() {
return '<tr><td class="submit_cell" colspan="2">'.
'<input class="save_settings btn btn-success" type="submit" name="save_settings" value="'.$this->trans('Save').'" />'.
'<input class="save_settings btn btn-primary" type="submit" name="save_settings" value="'.$this->trans('Save').'" />'.
'</td></tr></table></div></form>'.
'<div class="px-3 d-flex justify-content-end"><form method="POST"><input type="hidden" name="hm_page_key" value="'.$this->html_safe(Hm_Request_Key::generate()).'" />'.
'<input class="reset_factory_button btn btn-light border" type="submit" name="reset_factory" value="'.$this->trans('Restore Defaults').'" /></form></div>'.
Expand Down Expand Up @@ -1475,7 +1477,7 @@ protected function output() {
'<input type="text" value="'.$this->html_safe($this->get('username', 'cypht_user')).'" autocomplete="username" style="display: none;"/>'.
'<label class="screen_reader" for="password">Password</label><input required id="password" '.
'name="password" autocomplete="current-password" class="save_settings_password form-control mb-2" type="password" placeholder="'.$this->trans('Password').'" />'.
'<input class="save_settings btn btn-success me-2" type="submit" name="save_settings_permanently" value="'.$this->trans('Save').'" />'.
'<input class="save_settings btn btn-primary me-2" type="submit" name="save_settings_permanently" value="'.$this->trans('Save').'" />'.
'<input class="save_settings btn btn-outline-secondary me-2" type="submit" name="save_settings_permanently_then_logout" value="'.$this->trans('Save and Logout').'" />'.
'</form><form method="post"><input type="hidden" name="hm_page_key" value="'.$this->html_safe(Hm_Request_Key::generate()).'" />'.
'<input class="save_settings btn btn-outline-secondary" type="submit" name="logout" value="'.$this->trans('Just Logout').'" />'.
Expand Down Expand Up @@ -1886,7 +1888,7 @@ class Hm_Output_start_junk_settings extends Hm_Output_Module {
* Settings in this section control the flagged messages view
*/
protected function output() {
return '<tr><td data-target=".junk_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".junk_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-envelope-x-fill fs-5 me-2"></i>'.
$this->trans('Junk').'</td></tr>';
}
Expand Down Expand Up @@ -1945,7 +1947,7 @@ class Hm_Output_start_trash_settings extends Hm_Output_Module {
* Settings in this section control the flagged messages view
*/
protected function output() {
return '<tr><td data-target=".trash_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".trash_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-trash3-fill fs-5 me-2"></i>'.
$this->trans('Trash').'</td></tr>';
}
Expand Down Expand Up @@ -2004,7 +2006,7 @@ class Hm_Output_start_drafts_settings extends Hm_Output_Module {
* Settings in this section control the flagged messages view
*/
protected function output() {
return '<tr><td data-target=".drafts_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2 text-secondary">'.
return '<tr><td data-target=".drafts_setting" colspan="2" class="settings_subtitle cursor-pointer border-bottom p-2">'.
'<i class="bi bi-pencil-square fs-5 me-2"></i>'.
$this->trans('Drafts').'</td></tr>';
}
Expand Down
Loading

0 comments on commit 761a846

Please sign in to comment.