Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F772199
choose_modules.tpl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Feb 1, 5:35 AM
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Feb 3, 5:35 AM (3 h, 23 m)
Engine
blob
Format
Raw Data
Handle
555735
Attached To
rINP In-Portal
choose_modules.tpl
View Options
<?php
ob_start();
?>
<
tr
class
=
"table-color2"
>
<
td
class
=
"text"
colspan
=
"2"
valign
=
"middle"
>
<
table
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
valign
=
"top"
>
<
input
type
=
"checkbox"
%
3
$
s
name
=
"modules[]"
id
=
"module_%1
$
s"
value
=
"%1
$
s"
style
=
"margin-top: 8px;"
/>
</
td
>
<
td
valign
=
"top"
>
<
label
for
=
"module_%1
$
s"
style
=
""
>
%2
$
s
</
label
>
<
div
style
=
"font-weight: bold; color: red;"
>
%4
$
s
</
div
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
<?php
$
module_tpl = ob_get_clean();
echo '<br/><p> <strong>Please select Modules you would like to install:</strong></p>';
$
fi
rst_time =
$
this->GetVar('step') !=
$
this->currentStep; // data from this step was not submitted yet
$
selected =
$
this->GetVar('modules');
if (!
$
selected) {
// preselect interface modules
$
selected = Array ('core');
}
$
modules_helper =&
$
this->Application->recallObject('ModulesHelper');
/* @var
$
modules_helper kModulesHelper */
$
licensed_modules = array_map('strtolower',
$
modules_helper->_GetModules());
$
modules =
$
this->ScanModules();
foreach (
$
modules as
$
module) {
$
module_version =
$
this->toolkit->GetMaxModuleVersion(
$
module);
$
prerequisites_errors =
$
this->toolkit->CheckPrerequisites(
$
module . '/', Array (
$
module_version), 'install');
$
license_module =
$
module;
if (!in_array(strtolower(
$
license_module),
$
licensed_modules)) {
// when module isn't licensed user can't install it
continue; // option #1: don't show non-licensed modules
array_unshift(
$
prerequisites_errors, 'Module not licensed'); // option #2: show warning under module name
}
if (
$
prerequisites_errors) {
// disable checkbox, when some of prerequisites not passed
$
checked = 'disabled';
}
else {
// preserve user selected checked status
$
checked = in_array(
$
module,
$
selected) ||
$
fi
rst_time ? 'checked="checked"' : '';
}
$
error_msg =
$
prerequisites_errors ? implode('<br />',
$
prerequisites_errors) : '';
$
module_string =
$
this->toolkit->getModuleString(
$
module,
$
module_version);
echo sprintf(
$
module_tpl,
$
module,
$
module_string,
$
checked,
$
error_msg);
}
?>
Event Timeline
Log In to Comment