Compare commits

...

7 Commits

Author SHA1 Message Date
Pierre Goiffon
7b3d859522 N°5027 AttributeUrl handle anchors starting with digits 2022-04-19 10:57:47 +02:00
acognet
079b406f18 N°4966 - No more custom dashboard switch 2022-04-15 09:54:41 +02:00
Timothee
dbe02a42c2 N°4888 New url() placeholder 2022-04-14 12:05:41 +02:00
Molkobain
94365ea40e Update contributors stickers image to 2022! 🚀 2022-04-13 16:05:00 +02:00
Molkobain
2716f9d24c Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/config.class.inc.php
2022-04-08 13:30:42 +02:00
Pierre Goiffon
92997e3e57 💡 N°2498 add @since 2022-04-08 08:54:07 +02:00
Pierre Goiffon
631b38a160 N°5003 Change cron_max_execution_time config param help text 2022-03-25 15:56:11 +01:00
8 changed files with 43 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -789,6 +789,7 @@ class RuntimeDashboard extends Dashboard
/**
* @inheritDoc
* @return bool $bIsNew
* @throws \Exception
*/
public function Save()
@@ -798,6 +799,7 @@ class RuntimeDashboard extends Dashboard
$oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
$oUDSearch->AddCondition('menu_code', $this->sId, '=');
$oUDSet = new DBObjectSet($oUDSearch);
$bIsNew = false;
if ($oUDSet->Count() > 0)
{
// Assuming there is at most one couple {user, menu}!
@@ -811,10 +813,12 @@ class RuntimeDashboard extends Dashboard
$oUserDashboard->Set('user_id', UserRights::GetUserId());
$oUserDashboard->Set('menu_code', $this->sId);
$oUserDashboard->Set('contents', $sXml);
$bIsNew = true;
}
utils::PushArchiveMode(false);
$oUserDashboard->DBWrite();
utils::PopArchiveMode();
return $bIsNew;
}
/**

View File

@@ -489,11 +489,11 @@ class Config
'show_in_conf_sample' => true,
],
'cron_max_execution_time' => [
'type' => 'integer',
'description' => 'Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout',
'default' => 600,
'value' => 600,
'source_of_value' => '',
'type' => 'integer',
'description' => 'Duration (seconds) of the cron.php script : if exceeded the script will exit even if there are remaining tasks to process. Must be shorter than php max_execution_time setting (note than when using CLI, this is set to 0 by default which means unlimited). If cron.php is ran via web, it must be shorter than the web server response timeout.',
'default' => 600,
'value' => 600,
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'cron_task_max_execution_time' => [
@@ -886,7 +886,7 @@ class Config
'type' => 'string',
'description' => 'Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)',
'default' => /** @lang RegExp */
'(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\$_.-]*)?',
'(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.-]*)?(#[a-zA-Z0-9_.-][a-zA-Z0-9+\$_.-]*)?',
// SCHEME....... USER....................... PASSWORD.......................... HOST/IP........... PORT.......... PATH......................... GET............................................ ANCHOR..........................
// Example: http://User:passWord@127.0.0.1:8888/patH/Page.php?arrayArgument[2]=something:blah20#myAnchor
// RegExp source: http://www.php.net/manual/fr/function.preg-match.php#93824

View File

@@ -4386,14 +4386,22 @@ abstract class DBObject implements iDisplay
$sAttCode = $sPlaceholderAttCode;
}
if ($sVerb == 'hyperlink')
if (in_array($sVerb, ['hyperlink', 'url']))
{
$sPortalId = ($sAttCode === '') ? 'console' : $sAttCode;
if (!array_key_exists($sPortalId, self::$aPortalToURLMaker))
{
throw new Exception("Unknown portal id '$sPortalId' in placeholder '$sPlaceholderAttCode''");
}
$ret = $this->GetHyperlink(self::$aPortalToURLMaker[$sPortalId], false);
if($sVerb == 'hyperlink')
{
$ret = $this->GetHyperlink(self::$aPortalToURLMaker[$sPortalId], false);
}
else
{
$ret = ApplicationContext::MakeObjectUrl(get_class($this), $this->GetKey(), self::$aPortalToURLMaker[$sPortalId], false);
}
}
else
{

View File

@@ -943,8 +943,6 @@ try
}
$oDashboard->Render($oPage, false, $aExtraParams);
}
//$oPage->add_ready_script("$('.ibo-dashboard table.listResults').tableHover(); $('.ibo-dashboard table.listResults')
//.tablesorter( { widgets: ['myZebra', 'truncatedList']} );");
break;
case 'reload_dashboard':
@@ -963,12 +961,11 @@ try
}
$oDashboard->Render($oPage, false, $aExtraParams);
}
//$oPage->add_ready_script("$('.ibo-dashboard table.listResults').tableHover(); $('.ibo-dashboard table.listResults')
//.tablesorter( { widgets: ['myZebra', 'truncatedList']} );");
break;
case 'save_dashboard':
$sDashboardId = utils::ReadParam('dashboard_id', '', false, 'context_param');
$aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data');
$sReloadURL = utils::ReadParam('reload_url', '', false, 'raw_data');
appUserPreferences::SetPref('display_original_dashboard_'.$sDashboardId, false);
@@ -982,14 +979,23 @@ try
$oDashboard = new RuntimeDashboard($sDashboardId);
$oDashboard->FromParams($aParams);
$oDashboard->Save();
$bIsNew = $oDashboard->Save();
$sDashboardFile = addslashes(utils::ReadParam('file', '', false, 'string'));
$sDashboardDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $sDashboardId);
// trigger a reload of the current page since the dashboard just changed
$oPage->add_script(
<<<JS
$sOperation = 'reload_dashboard';
if ($bIsNew)
{
$oPage->add_script(
<<<JS
window.location.reload();
JS
);
}
else// trigger a reload of the current page since the dashboard just changed
{
$oPage->add_script(
<<<JS
$('.ibo-dashboard#{$sDashboardDivId}').block();
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php',
{ operation: 'reload_dashboard', dashboard_id: '{$sDashboardId}', file: '{$sDashboardFile}', extra_params: {$sJSExtraParams}, reload_url: '{$sReloadURL}'},
@@ -999,7 +1005,8 @@ try
}
);
JS
);
);
}
break;
case 'revert_dashboard':

View File

@@ -3585,6 +3585,8 @@ EOF;
* @param $sRelativeDir
*
* @throws \Exception
*
* @since 2.7.0 N°2498
*/
protected function WriteStaticOnlyHtaccess($sTempTargetDir)
{
@@ -3626,6 +3628,8 @@ EOF;
* @param $sModuleVersion
*
* @throws \Exception
*
* @since 2.7.0 N°2498
*/
protected function WriteStaticOnlyWebConfig($sTempTargetDir)
{

View File

@@ -9,6 +9,6 @@ class AttributeURLDefaultPattern extends AttributeURL {
{
/** @noinspection OneTimeUseVariablesInspection */
$oConfig = utils::GetConfig();
return $oConfig->GetDefault('url_validation_pattern');
return '^'.$oConfig->GetDefault('url_validation_pattern').'$';
}
}

View File

@@ -39,6 +39,7 @@ class AttributeURLTest extends ItopTestCase {
'Sharepoint URL 2' => ['https://mydomain2.sharepoint.com/:u:/r/sites/DIS/ITSM/00_Admin_iTOP/iTop%20-%20Upgrade%20manuel/Procedure%20upgrade%20Combodo.url?csf=1&web=1&e=DAF0i3', 1],
'Alfresco URL 2' => ['http://alfresco.mydomain3.org/share/page/site/books/document-details?nodeRef=workspace://SpacesStore/6274f55f-a25b-4762-a863-77f7066f2034', 1],
'SF URL' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/707145b859/?limit=25#f53c', 1],
'SF URL anchor starting with digit' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/b0a2d474ba/?limit=25#2b35', 1],
];
}
}