mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Fix broken link in to module in document, comment, file list when module belongs to a different domain
This commit is contained in:
parent
ae8a8662b1
commit
e3fea89dbc
8 changed files with 87 additions and 10 deletions
|
|
@ -3,6 +3,7 @@
|
|||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="domain_srl" />
|
||||
<column name="module_srl" />
|
||||
<column name="mid" />
|
||||
<column name="browser_title" />
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
{@ $comment = $val->getContentText(200)}
|
||||
<td>
|
||||
<block cond="isset($module_list[$val->module_srl])">
|
||||
<a href="{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a> -
|
||||
<a href="{ModuleModel::getDomainByModuleSrl($val->module_srl)}{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a> -
|
||||
</block>
|
||||
<a href="{getUrl('','document_srl',$val->document_srl,'comment_srl',$val->comment_srl)}#comment_{$val->comment_srl}" target="_blank"><!--@if(strlen($comment))-->{$comment}<!--@else--><em>{$lang->no_text_comment}</em><!--@end--></a>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="domain_srl" />
|
||||
<column name="module_srl" />
|
||||
<column name="mid" />
|
||||
<column name="browser_title" />
|
||||
|
|
|
|||
|
|
@ -50,11 +50,15 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
<tr loop="$document_list => $no, $oDocument">
|
||||
|
||||
<td class="title">
|
||||
<a href="{$oDocument->getPermanentUrl()}" target="_blank"><!--@if(trim($oDocument->getTitleText()) !== '')-->{escape($oDocument->getTitleText(), false)}<!--@else--><em>{$lang->no_title_document}</em><!--@end--></a>
|
||||
|
||||
<span cond="isset($module_list[$oDocument->get('module_srl')])">
|
||||
- <a href="{getUrl('', 'mid', $module_list[$oDocument->get('module_srl')]->mid)}" target="_blank">{$module_list[$oDocument->get('module_srl')]->browser_title}</a>
|
||||
</span></td>
|
||||
<a href="{$oDocument->getPermanentUrl()}" target="_blank"><!--@if(trim($oDocument->getTitleText()) !== '')-->{escape($oDocument->getTitleText(), false)}<!--@else--><em>{$lang->no_title_document}</em><!--@end--></a>
|
||||
<span cond="isset($module_list[$oDocument->get('module_srl')])">
|
||||
<!--@if($module_list[$oDocument->get('module_srl')]->domain_srl == -1 || $module_list[$oDocument->get('module_srl')]->domain_srl == $site_module_info->domain_srl)-->
|
||||
- <a href="{getUrl('', 'mid', $module_list[$oDocument->get('module_srl')]->mid)}" target="_blank">{$module_list[$oDocument->get('module_srl')]->browser_title}</a>
|
||||
<!--@else-->
|
||||
- <a href="{ModuleModel::getDomainByModuleSrl($oDocument->get('module_srl'))}{getUrl('', 'mid', $module_list[$oDocument->get('module_srl')]->mid)}" target="_blank">{$module_list[$oDocument->get('module_srl')]->browser_title}</a>
|
||||
<!--@endif-->
|
||||
</span>
|
||||
</td>
|
||||
<td class="nowr">
|
||||
<span cond="$oDocument->get('member_srl') <= 0">{$oDocument->getNickName()}</span>
|
||||
<a href="#popup_menu_area" class="member_{abs($oDocument->get('member_srl'))}" cond="$oDocument->get('member_srl') < 0">({$member_nick_name[abs($oDocument->get('member_srl'))]})</a>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="domain_srl" />
|
||||
<column name="module_srl" />
|
||||
<column name="mid" />
|
||||
<column name="browser_title" />
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
<!--@if(preg_match('/^(?:ev:)?doc$/', $val->upload_target_type) && $document_list[$document_srl] && $document_list[$document_srl]->get('module_srl') == $document_list[$document_srl]->get('member_srl'))-->[{$lang->cmd_temp_save}] <!--@end-->
|
||||
<!--@if(preg_match('/^(?:ev:)?doc$/', $val->upload_target_type) && $document_list[$document_srl] && $document_list[$document_srl]->get('module_srl') == 0)-->[{$lang->cmd_trash}] <!--@end-->
|
||||
<!--@if($val->module_srl && isset($module_list[$val->module_srl]))-->
|
||||
<a href="{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a>
|
||||
<a href="{ModuleModel::getDomainByModuleSrl($val->module_srl)}{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a>
|
||||
<!--@end-->
|
||||
<!--@if($document_list[$document_srl] && preg_match('/^(?:ev:)?(?:doc|com)$/', $val->upload_target_type))-->
|
||||
- <!--@if($document_list[$document_srl]->get('module_srl') != $document_list[$document_srl]->get('member_srl'))--><a href="{$move_uri}" target="_blank">{$document_list[$document_srl]->getTitle()}</a><!--@else-->{$document_list[$document_srl]->getTitle()}<!--@end-->
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class ModuleModel extends Module
|
|||
*/
|
||||
public static $_mid_map = [];
|
||||
public static $_module_srl_map = [];
|
||||
public static $_domain_map = [];
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
|
|
@ -708,13 +709,13 @@ class ModuleModel extends Module
|
|||
$mid = Rhymix\Framework\Cache::get('site_and_module:module_srl_mid:' . $module_srl);
|
||||
if (isset($mid))
|
||||
{
|
||||
return $mid;
|
||||
return self::$_module_srl_map[$module_srl] = $mid;
|
||||
}
|
||||
|
||||
$args = new stdClass;
|
||||
$args->module_srls = $module_srl;
|
||||
$output = executeQuery('module.getModuleInfoByModuleSrl', $args, ['mid']);
|
||||
if ($output->data)
|
||||
if (is_object($output->data))
|
||||
{
|
||||
$mid = self::$_module_srl_map[$module_srl] = $output->data->mid;
|
||||
Rhymix\Framework\Cache::set('site_and_module:module_srl_mid:' . $module_srl, $mid, 0, true);
|
||||
|
|
@ -726,6 +727,63 @@ class ModuleModel extends Module
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the domain (including scheme and port) by module_srl
|
||||
*
|
||||
* @param int $module_srl
|
||||
* @return ?string
|
||||
*/
|
||||
public static function getDomainByModuleSrl(int $module_srl): ?string
|
||||
{
|
||||
$module_srl = intval($module_srl);
|
||||
if (isset(self::$_domain_map[$module_srl]))
|
||||
{
|
||||
return self::$_domain_map[$module_srl];
|
||||
}
|
||||
|
||||
$prefix = Rhymix\Framework\Cache::get('site_and_module:module_srl_prefix:' . $module_srl);
|
||||
if (isset($prefix))
|
||||
{
|
||||
self::$_domain_map[$module_srl] = $prefix;
|
||||
return $prefix;
|
||||
}
|
||||
|
||||
$args = new stdClass;
|
||||
$args->module_srls = $module_srl;
|
||||
$args->include_domain_info = true;
|
||||
$output = executeQuery('module.getModuleInfoByModuleSrl', $args);
|
||||
if (is_object($output->data))
|
||||
{
|
||||
$info = self::$_module_srl_map[$module_srl] = $output->data;
|
||||
if (!$info->domain_srl || $info->domain_srl == -1 || !isset($info->domain))
|
||||
{
|
||||
$prefix = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix = $info->security === 'always' ? 'https://' : 'http://';
|
||||
$prefix .= $info->domain;
|
||||
if ($info->security === 'always' && $info->https_port)
|
||||
{
|
||||
$prefix .= ':' . $info->https_port;
|
||||
}
|
||||
if ($info->security !== 'always' && $info->http_port)
|
||||
{
|
||||
$prefix .= ':' . $info->http_port;
|
||||
}
|
||||
}
|
||||
Rhymix\Framework\Cache::set('site_and_module:module_srl_prefix:' . $module_srl, $prefix, 0, true);
|
||||
return $prefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$domain = $module_info->domain ?: Context::getCurrentDomain();
|
||||
return sprintf('%s://%s/%s', $module_info->scheme, $domain, $module_info->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get forward value by the value of act
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
<query id="getModuleInfoByModuleSrl" action="select">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
<table name="domains" type="left join" if="include_domain_info">
|
||||
<conditions>
|
||||
<condition operation="equal" column="domains.domain_srl" var="modules.domain_srl" />
|
||||
</conditions>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="modules.*" />
|
||||
<column name="domains.domain" if="include_domain_info" />
|
||||
<column name="domains.security" if="include_domain_info" />
|
||||
<column name="domains.http_port" if="include_domain_info" />
|
||||
<column name="domains.https_port" if="include_domain_info" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="module_srl" var="module_srls" notnull="notnull" />
|
||||
<condition operation="in" column="modules.module_srl" var="module_srls" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue