Gére quand un domaines type n'existe pas (plus ?) pour un sous domaine

This commit is contained in:
Alan Garcia 2014-03-17 13:19:02 +00:00
parent b758a5c083
commit 5b10a1d1b7
3 changed files with 28 additions and 4 deletions

View File

@ -151,12 +151,16 @@ for($i=0;$i<$r["nsub"];$i++) {
$disabled_class=in_array(strtoupper($r['sub'][$i]['enable']),array('DISABLED','DISABLE') )?'sub-disabled':'';
?>
<tr class="lst">
<tr class="lst" data-fqdn="<?php echo $r["sub"][$i]["fqdn"]; ?>">
<?php if ( $r['sub'][$i]['web_action'] =='DELETE') { echo "<td colspan='2' />"; } else { ?>
<td class="center">
<?php if (!(!$isinvited && $dt[strtolower($r["sub"][$i]["type"])]["enable"] != "ALL" )) { ?>
<div class="ina edit"><a href="dom_subedit.php?sub_domain_id=<?php echo urlencode($r["sub"][$i]["id"]) ?>"><?php __("Edit"); ?></a></div>
<?php } ?>
<?php if ( isset($problems[$r["sub"][$i]["fqdn"]])) { // if this subdomain have problem, can't modify it, only delete it
__("Forbidden");
} else { ?>
<div class="ina edit"><a href="dom_subedit.php?sub_domain_id=<?php echo urlencode($r["sub"][$i]["id"]) ?>"><?php __("Edit"); ?></a></div><?php
} // isset problems
} ?>
</td><td class="center">
@ -215,6 +219,12 @@ $disabled_class=in_array(strtoupper($r['sub'][$i]['enable']),array('DISABLED','D
</tr>
<?php } ?>
</table>
<?php
// Add a class on the sub_domains who have a problem
foreach ($problems as $pr => $lm) { // $problems can be empty but can't be null/false
echo "<script type='text/javascript'>$(\"tr[data-fqdn='".$pr."']\").addClass('alert-danger-tr');</script>\n";
}
?>
</div>

View File

@ -344,6 +344,10 @@ img {
.alert-danger a{
color: #6F2B2A;
}
.alert-danger-tr {
background-color: #F2DEDE !important;
}
/* Alert icons */
#content .alert {

View File

@ -1105,7 +1105,8 @@ class m_dom {
$db->next_record();
$r["nsub"]=$db->Record["cnt"];
$db->free();
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND domaine='$dom' AND UPPER(dt.name)=UPPER(sd.type) ORDER BY sd.sub,sd.type");
#$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND domaine='$dom' AND UPPER(dt.name)=UPPER(sd.type) ORDER BY sd.sub,sd.type");
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd LEFT JOIN domaines_type dt on UPPER(dt.name)=UPPER(sd.type) WHERE compte='$cuid' AND domaine='$dom' ORDER BY sd.sub,sd.type ;");
// Pas de webmail, on le cochera si on le trouve.
$r["sub"]=array();
for($i=0;$i<$r["nsub"];$i++) {
@ -2075,6 +2076,15 @@ function generate_apacheconf($p = null) {
}
}
}
// Check if we know each type of subdomain
// Example: we may not know WEBMAIL if we upgrade from a previous setup
foreach ( $da['sub'] as $sub ) {
if (is_null($sub['type_desc'])) {
$errors[$sub['fqdn']]=sprintf(_("Problem on %s: we do not know domain's type <b>%s</b>."),$sub['fqdn'], $sub['type']);
}
}
// TODO: add a full compatibility check.
return $errors;