Commit 82568356 authored by BohdanDmytryshyn's avatar BohdanDmytryshyn
Browse files

Release 5.1.1

parent 7b48e8a0
......@@ -26,9 +26,9 @@ class CRM_CiviMobileAPI_Install_Entity_ApplicationQrCode implements CRM_CiviMobi
$path = $directoryName . DIRECTORY_SEPARATOR . $imageName;
if ($currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_JOOMLA ) {
$siteUrl = str_replace("/administrator/", "", CIVICRM_UF_BASEURL);
$siteUrl = str_replace("/administrator/", "/", $config->userFrameworkBaseURL);
} else {
$siteUrl = CIVICRM_UF_BASEURL;
$siteUrl = $config->userFrameworkBaseURL;
}
$params = [
'attachFile_1' => [
......
......@@ -8,6 +8,7 @@ class CRM_CiviMobileAPI_Page_Checklist extends CRM_Core_Page {
public function run() {
$checklist = new CRM_CiviMobileAPI_Utils_Checklist();
$checklist->checkAllAvailableItems();
$config = CRM_Core_Config::singleton();
$currentContact = CRM_Contact_BAO_Contact::findById(CRM_Core_Session::singleton()->getLoggedInContactID());
$apiKey = $currentContact->api_key ? $currentContact->api_key : CRM_CiviMobileAPI_Authentication_Login::setApiKey($currentContact->id);
......@@ -15,7 +16,7 @@ class CRM_CiviMobileAPI_Page_Checklist extends CRM_Core_Page {
$authUrl = CRM_Utils_System::url('civicrm/civimobile/auth', NULL, TRUE);
$restPathUrl = self::concatenateUrl(
str_replace("/administrator/", "", CIVICRM_UF_BASEURL) . substr((new CRM_CiviMobileAPI_Utils_RestPath())->get(),1),
str_replace("/administrator/", "", $config->userFrameworkBaseURL) . (new CRM_CiviMobileAPI_Utils_RestPath())->get(),
$paramsToRest);
$restUrl = self::concatenateUrl((new CRM_CiviMobileAPI_Utils_RestPath())->getAbsoluteUrl(), $paramsToRest);
......
......@@ -209,19 +209,17 @@ class CRM_CiviMobileAPI_Utils_Checklist {
*/
public function _checkCron() {
$checkCron = CRM_Utils_Check_Component_Env::checkLastCron();
$this->checkedItems['last_cron']['title'] = 'Is CRON running correct?';
$this->checkedItems['last_cron']['message'] = $checkCron[0]->getTitle() . "<br>" . $checkCron[0]->getMessage();
switch ($checkCron[0]->getLevel()) {
case CRM_Utils_Check::severityMap(\Psr\Log\LogLevel::INFO):
$this->checkedItems['last_cron']['status'] = 'success';
$this->checkedItems['last_cron']['message'] = 'CRON is running correct.';
break;
case CRM_Utils_Check::severityMap(\Psr\Log\LogLevel::WARNING):
$this->checkedItems['last_cron']['status'] = 'warning';
break;
case CRM_Utils_Check::severityMap(\Psr\Log\LogLevel::ERROR):
$this->checkedItems['last_cron']['status'] = 'error';
$this->checkedItems['last_cron']['status'] = 'warning';
$this->checkedItems['last_cron']['message'] = 'CRON isn`t running. If CRON isn`t enabled, it can clog your database.';
break;
}
......@@ -284,4 +282,15 @@ class CRM_CiviMobileAPI_Utils_Checklist {
];
}
/**
* Adds baseURL to $systemInfo
*/
public function _siBaseUrl() {
$config = CRM_Core_Config::singleton();
$this->systemInfo[] = [
'title' => 'userFrameworkBaseURL(Config)',
'message' => $config->userFrameworkBaseURL,
];
}
}
......@@ -33,15 +33,16 @@ class CRM_CiviMobileAPI_Utils_Cms {
*/
public static function getCmsRssUrl() {
$currentCMS = CRM_CiviMobileAPI_Utils_CmsUser::getInstance()->getSystem();
$config = CRM_Core_Config::singleton();
if ($currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_WORDPRESS && function_exists('get_feed_link')) {
return get_feed_link('rss2');
}
elseif ($currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_JOOMLA ) {
return str_replace("/administrator/", "", CIVICRM_UF_BASEURL) . "/?format=feed&type=rss";
return str_replace("/administrator/", "/", $config->userFrameworkBaseURL) . "?format=feed&type=rss";
}
elseif ($currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_DRUPAL6 || $currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_DRUPAL7) {
return CIVICRM_UF_BASEURL . "/rss.xml";
return $config->userFrameworkBaseURL . "rss.xml";
}
return '';
......
......@@ -71,6 +71,7 @@ class CRM_CiviMobileAPI_Utils_File {
public static function getFileUrl($entityId, $entityTable, $filename) {
$url = '';
$files = CRM_Core_BAO_File::getEntityFile($entityTable, $entityId);
$config = CRM_Core_Config::singleton();
foreach ($files as $file) {
if ((!empty($file['fileName']) && $file['fileName'] == $filename)
......@@ -82,6 +83,8 @@ class CRM_CiviMobileAPI_Utils_File {
if (substr($url, 0, 1) == '/') {
$url = substr($url, 1);
}
//CiviCRM sometimes generate url with domain
$url = str_replace($config->userFrameworkBaseURL, "", $url);
$url = urldecode($url);
......@@ -91,10 +94,10 @@ class CRM_CiviMobileAPI_Utils_File {
}
if ($currentCMS == CRM_CiviMobileAPI_Utils_CmsUser::CMS_JOOMLA ) {
$url = str_replace("administrator/", "", CIVICRM_UF_BASEURL) . $url;
$url = str_replace("administrator/", "", $config->userFrameworkBaseURL) . $url;
$url = str_replace("administrator/", "index.php", $url);
} else {
$url = CIVICRM_UF_BASEURL . $url;
$url = $config->userFrameworkBaseURL . $url;
}
$url = htmlspecialchars_decode($url);
......
......@@ -81,7 +81,7 @@ class CRM_CiviMobileAPI_Utils_RestPath {
* @return string
*/
private function getJoomlaRestPath() {
return '/administrator' . Civi::paths()->getUrl("[civicrm.root]/extern/rest.php");
return '/administrator' . str_replace('/administrator','', Civi::paths()->getUrl("[civicrm.root]/extern/rest.php"));
}
/**
......
<?php
/**
* Class provide Website helper methods
*/
class CRM_CiviMobileAPI_Utils_Website {
/**
* Returns protocol 'https://' or 'http://'
*
* @return string
*/
public static function getProtocol() {
$protocol = 'http://';
if (defined('CIVICRM_UF_BASEURL') && !empty(CIVICRM_UF_BASEURL)
&& !(stripos(CIVICRM_UF_BASEURL, 'https') === false)) {
$protocol = 'https://';
}
return $protocol;
}
}
......@@ -26,11 +26,11 @@ The **CiviMobileAPI** extension (`com.agiliway.civimobileapi`) is a CiviCRM comp
- **Settings** - users can configure a set of parameters customizing the view and work of the application.
- **9 locales** - supports: English, German, French, Italian, Spanish, Dutch, Hungarian, Polish and Ukrainian.
More details about how to install CiviMobileAPI extension and start using CiviMobile can be found at official CiviMobile website [https://civimobile.org](https://civimobile.org).
More details about how to install CiviMobileAPI extension and start using CiviMobile can be found at official CiviMobile website [https://civimobile.org](https://civimobile.org).
Also, our step-by-step videos will lead you through the process of installing the CiviMobileAPI on [Drupal](https://www.youtube.com/watch?v=jNVMLSfU1ug), [Joomla](https://www.youtube.com/watch?v=mli8HkxVu60) and [WordPress](https://www.youtube.com/watch?v=mDjHEglfVT4&t=4s).
Also, our step-by-step videos will lead you through the process of installing the CiviMobileAPI on [Drupal](https://www.youtube.com/watch?v=jNVMLSfU1ug), [Joomla](https://www.youtube.com/watch?v=mli8HkxVu60) and [WordPress](https://www.youtube.com/watch?v=mDjHEglfVT4&t=4s).
The latest CiviMobile application can be downloaded from [AppStore](https://itunes.apple.com/us/app/civimobile/id1404824793?mt=8) of [Google PlayMarket](https://play.google.com/store/apps/details?id=com.agiliway.civimobile), which should be accessed from the mobile devices of users.
The latest CiviMobile application can be downloaded from [AppStore](https://itunes.apple.com/us/app/civimobile/id1404824793?mt=8) of [Google PlayMarket](https://play.google.com/store/apps/details?id=com.agiliway.civimobile), which should be accessed from the mobile devices of users.
## Requirements
......@@ -38,7 +38,7 @@ The latest CiviMobile application can be downloaded from [AppStore](https://itun
- CiviCRM v4.7.x+
- PHP v5.4+
- Drupal 7.x
- Joomla 3.x
- Joomla 3.x (CiviCRM 5.1+)
- WordPress 4.8+
*WordPress API patch is required. Please install ["CiviCRM WP REST API Wrapper" plugin](https://github.com/mecachisenros/civicrm-wp-rest) or [contact us](mailto:civicrm@agiliway.com) for details.
......
......@@ -14,8 +14,8 @@
<url desc="Support">https://agiliway.com</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-05-04</releaseDate>
<version>5.1.0</version>
<releaseDate>2020-05-21</releaseDate>
<version>5.1.1</version>
<compatibility>
<ver>4.7</ver>
<ver>5.20</ver>
......
......@@ -34,13 +34,15 @@
{literal}
<script>
var authUrl = '{/literal}{$authUrl}{literal}';
var restPathUrl = '{/literal}{$restPathUrl}{literal}';
var restUrl = '{/literal}{$restUrl}{literal}';
var authUrl = '{/literal}{$authUrl}{literal}'.replace(/&amp;/g, '&');
var restPathUrl = '{/literal}{$restPathUrl}{literal}'.replace(/&amp;/g, '&');
var restUrl = '{/literal}{$restUrl}{literal}'.replace(/&amp;/g, '&');
CRM.$(function ($) {
$.get(authUrl).always(function(data) {
if (data.responseJSON.is_error !== null) {
$.get(authUrl, function () {
$("#checklist-items-block").append(generateCheckBlock('Is auth link correct?', 'Auth link is incorrect.', 'error'));
}).fail(function(data) {
if (data.responseJSON && data.responseJSON.is_error !== null) {
$("#checklist-items-block").append(generateCheckBlock('Is auth link correct?', 'Auth link is correct.', 'success'));
} else {
$("#checklist-items-block").append(generateCheckBlock('Is auth link correct?', 'Auth link is incorrect.', 'error'));
......@@ -50,20 +52,24 @@
CRM.api3('CiviMobileSystem', 'get', {
"sequential": 1
}).then(function(result) {
$.get(restUrl).always(function(data) {
$.get(restUrl, function(data) {
if (JSON.stringify(result) === JSON.stringify(data)) {
$("#checklist-items-block").append(generateCheckBlock('Is rest url correct?', 'Rest url is not correct.', 'success'));
} else {
$("#checklist-items-block").append(generateCheckBlock('Is rest url correct?', 'Rest url is not correct.', 'error'));
}
}).fail(function() {
$("#checklist-items-block").append(generateCheckBlock('Is rest url correct?', 'Rest url is not correct.', 'error'));
});
$.get(restPathUrl).always(function(data) {
$.get(restPathUrl, function(data) {
if (JSON.stringify(result) === JSON.stringify(data)) {
$("#checklist-items-block").append(generateCheckBlock('Is rest path correct?', 'Rest path is not correct.', 'success'));
} else {
$("#checklist-items-block").append(generateCheckBlock('Is rest path correct?', 'Rest path is not correct.', 'error'));
}
}).fail(function() {
$("#checklist-items-block").append(generateCheckBlock('Is rest path correct?', 'Rest path is not correct.', 'error'));
});
});
......
......@@ -57,7 +57,7 @@
bottom: 0;
right: 0;
display: block;
z-index: 100;
z-index: 1050;
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.13);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment