Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
$this->addYesNo('enable_bootstrap_css', ts('Use Bootstrap CSS'));
<tr class="crm-url-form-block-enable_bootstrap_css"> <td class="label"> {$form.enable_bootstrap_css.label} {help id='id-bootstrap_help'} </td> <td> {$form.enable_bootstrap_css.html} <p class="description font-red">{ts}{$enable_bootstrap_css_description}{/ts}</p> </td> </tr>
if ($config->enable_bootstrap_css === 1 && strpos($config->userFramework, 'Drupal') === 0) { CRM_Core_BAO_Setting::updateSettingsFromMetaData(); CRM_Core_BAO_Setting::setItem('1', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_bootstrap_css'); }
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,'enable_bootstrap_css')) { $this->addstyleFile('bootstrap', 'css/bootstrap.css', -99, $region); }
'enable_bootstrap_css' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'enable_bootstrap_css', 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => '0', 'add' => '4.5', 'title' => 'Use Bootstrap CSS', 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Enables Bootsrap CSS files', 'help_text' => 'This is a work in progress. It might break default CSS. Check documentation at wiki.civicrm.org/confluence/display/BootstrapUI for more details', ),
"default" => '0' is assigned but the variable value is 1 and always stays 1.
This is great progress - I think to get the new setting to take place you need to either do an upgrade from 4.4 to 4.5 or else do a new installation of 4.5 so that the setting gets added/retained in database. Xavier - do you have any other suggestions on this or does it sound like we are on the right track?
(https://www.drupal.org/project/bootstrap). At the very least, this needs to be included in the documentation for this project if we are going to be dependent on it to give us the main container element.
@import "less/bootstrap.less";.table-borderless td,.table-borderless th { border: 0; }
<table class="table table-borderless form-layout">
1. I am trying to get the back end option of Enabling Bootstrap CSS function. As Xavier and Emily suggested, I have re-installed CiviCRM 4.5 Beta 2. But here was no no result. The same problem is being faced again.
2. Changing the templates of CiviCRM to Bootstrap: Firstly I am doing Advance Search, as the total page consist of tables, converting them into bootstrap without replacing tables with divs is really becoming a tough task and in few cases its impossible.
I don't recall the detail of what to change to save a new setting
table tr {border: 0;}
/*** This class generates form components for Site Url**/class CRM_Admin_Form_Setting_Url extends CRM_Admin_Form_Setting { protected $_settings = array( 'cvv_backoffice_required' => CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'disable_core_css' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_bootstrap_css' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, ); /*** Function to build the form** @return void* @access public*/ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Resource URLs')); $settingFields = civicrm_api('setting', 'getfields', array( 'version' => 3 )); $this->addElement('text', 'userFrameworkResourceURL', ts('CiviCRM Resource URL')); $this->addElement('text', 'imageUploadURL', ts('Image Upload URL')); $this->addElement('text', 'customCSSURL', ts('Custom css URL')); $this->addYesNo('enable_bootstrap_css', ts('Use Bootstrap CSS')); $this->addElement('text', 'extensionsURL', ts('Extension Resource URL')); $this->addYesNo('enableSSL', ts('Force Secure URLs (SSL)')); $this->addYesNo('verifySSL', ts('Verify SSL Certs')); // FIXME: verifySSL should use $_settings instead of manually adding fields $this->assign('verifySSL_description', $settingFields['values']['verifySSL']['description']); $this->addFormRule(array('CRM_Admin_Form_Setting_Url', 'formRule')); parent::buildQuickForm(); }
/*** @param $rev*/ function upgrade_4_4_1($rev) { $config = CRM_Core_Config::singleton(); // CRM-13327 upgrade handling for the newly added name badges $ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'name_badge', 'id', 'name'); $nameBadges = array_flip(array_values(CRM_Core_BAO_OptionValue::getOptionValuesAssocArrayFromName('name_badge'))); unset($nameBadges['Avery 5395']); if (!empty($nameBadges)) { $dimension = '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}'; $query = "UPDATE civicrm_option_valueSET value = '{$dimension}'WHERE option_group_id = %1 AND name = 'Fattorini Name Badge 100x65'"; CRM_Core_DAO::executeQuery($query, array(1 => array($ogID, 'Integer'))); } else { $dimensions = array( 1 => '{"paper-size":"a4","orientation":"landscape","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":1,"metric":"mm","lMargin":25,"tMargin":27,"SpaceX":0,"SpaceY":35,"width":106,"height":150,"lPadding":5,"tPadding":5}', 2 => '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}', 3 => '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":2,"metric":"mm","lMargin":10,"tMargin":28,"SpaceX":0,"SpaceY":0,"width":96,"height":121,"lPadding":5,"tPadding":5}', ); $insertStatements = array( 1 => "($ogID, %1, '{$dimensions[1]}', %1, NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL)", 2 => "($ogID, %2, '{$dimensions[2]}', %2, NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL)", 3 => "($ogID, %3, '{$dimensions[3]}', %3, NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL)", ); $queryParams = array( 1 => array('A6 Badge Portrait 150x106', 'String'), 2 => array('Fattorini Name Badge 100x65', 'String'), 3 => array('Hanging Badge 3-3/4" x 4-3"/4', 'String'), ); foreach ($insertStatements as $values) { $query = 'INSERT INTO civicrm_option_value (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES' . $values; CRM_Core_DAO::executeQuery($query, $queryParams); } } // CRM-12578 - Prior to this version a CSS file under drupal would disable core css if (!empty($config->customCSSURL) && strpos($config->userFramework, 'Drupal') === 0) { // The new setting doesn't exist yet - need to create it first CRM_Core_BAO_Setting::updateSettingsFromMetaData(); CRM_Core_BAO_Setting::setItem('1', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'disable_core_css'); } // CRM-13701 - Fix $config->timeInputFormat $sql = "SELECT time_formatFROM civicrm_preferences_dateWHERE time_format IS NOT NULLAND time_format <> ''LIMIT 1"; $timeInputFormat = CRM_Core_DAO::singleValueQuery($sql); if ($timeInputFormat && $timeInputFormat != $config->timeInputFormat) { $params = array('timeInputFormat' => $timeInputFormat); CRM_Core_BAO_ConfigSetting::add($params); } // CRM-13698 - add 'Available' and 'No-show' activity statuses $insertStatus = array(); $nsinc = $avinc = $inc = 0; if (!CRM_Core_OptionGroup::getValue('activity_status', 'Available', 'name')) { $insertStatus[] = "(%1, 'Available', %2, 'Available', NULL, 0, NULL, %3, 0, 0, 1, NULL, NULL)"; $avinc = $inc = 1; } if (!CRM_Core_OptionGroup::getValue('activity_status', 'No_show', 'name')) { $insertStatus[] = "(%1, 'No-show', %4, 'No_show', NULL, 0, NULL, %5, 0, 0, 1, NULL, NULL)"; $nsinc = $inc + 1; } if (!empty($insertStatus)) { $acOptionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_status', 'id', 'name'); $maxVal = CRM_Core_DAO::singleValueQuery("SELECT MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = $acOptionGroupID"); $maxWeight = CRM_Core_DAO::singleValueQuery("SELECT MAX(weight) FROM civicrm_option_value WHERE option_group_id = $acOptionGroupID"); $p[1] = array($acOptionGroupID, 'Integer'); if ($avinc) { $p[2] = array($avinc+$maxVal, 'Integer'); $p[3] = array($avinc+$maxWeight, 'Integer'); } if ($nsinc) { $p[4] = array($nsinc+$maxVal, 'Integer'); $p[5] = array($nsinc+$maxWeight, 'Integer'); } $insertStatus = implode(',', $insertStatus); $sql = "INSERT INTOcivicrm_option_value (`option_group_id`, label, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)VALUES {$insertStatus}"; CRM_Core_DAO::executeQuery($sql, $p); } $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.1')), 'task_4_4_x_runSql', $rev); $this->addTask('Patch word-replacement schema', 'wordReplacements_patch', $rev); }
if ($config->enable_bootstrap_css === 1 && strpos($config->userFramework, 'Drupal') === 1) { CRM_Core_BAO_Setting::updateSettingsFromMetaData(); CRM_Core_BAO_Setting::setItem('1', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_bootstrap_css'); }
function upgrade_4_4_1($rev) {