# HG changeset patch # User rejo # Date 1199392067 0 # Node ID 6ffacb626294c01c1e7b1c0d915f63203dd021db # Parent 11804f18dfc732dcb2f0bfbf8d15fcabdfd08fed [feladat @ 107] Fixing ticket:17 (zone listing and count in user management screen incomplete). diff -r 11804f18dfc7 -r 6ffacb626294 docs/template.pot --- a/docs/template.pot Wed Jan 02 22:24:32 2008 +0000 +++ b/docs/template.pot Thu Jan 03 20:27:47 2008 +0000 @@ -16,6 +16,22 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: users.php:110 +msgid "Users may only change some of the records of zones marked with an (*)." +msgstr "" + +#: users.php:77 +msgid "access" +msgstr "" + +#: users.php:78 +msgid "owner" +msgstr "" + +#: edit.php:9 +msgid "No records where selected to assign an sub-owner." +msgstr "" + #: add_record.php:16 msgid "Add record to zone" msgstr "" diff -r 11804f18dfc7 -r 6ffacb626294 inc/record.inc.php --- a/inc/record.inc.php Wed Jan 02 22:24:32 2008 +0000 +++ b/inc/record.inc.php Thu Jan 03 20:27:47 2008 +0000 @@ -675,19 +675,78 @@ global $db; if (is_numeric($id)) { - $result = $db->query("SELECT domains.id AS domain_id, domains.name AS name FROM domains LEFT JOIN zones ON domains.id=zones.domain_id WHERE owner=$id"); + $a_zones = array(); + + // Check for zones the user has full access for (the + // user is owner of the zone. + + $res_full = $db->query("SELECT + domains.id AS domain_id, + domains.name AS name + FROM domains + LEFT JOIN zones ON domains.id=zones.domain_id + WHERE owner=$id"); + + // Process the output. - $ret = array(); + $numrows = $res_full->numRows(); + $i=1; + if ($numrows > 0) + { + $andnot=" AND NOT domains.id IN ("; + while($r = $res_full->fetchRow()) { + + // Create array of zone id's and name's the owner + // has full access to. + + $a_zones[] = array( + "id" => $r["domain_id"], + "name" => $r["name"], + "partial" => "0" + ); - // Put all the information in a big array. - while ($r = $result->fetchRow()) + // Create AND NOT for query of zones the user has + // only partial access to. In that query we just + // want to see the zones he has not full access to + // as well. + + $andnot.=$r["domain_id"]; + if ($i < $numrows) { + $andnot.=","; + $i++; + } + + } + $andnot.=")"; + } + else { - $ret[] = array( + $andnot=""; + } + + // Check for zones the user has partial access only to. + + $res_partial = $db->query("SELECT DISTINCT + records.domain_id, + domains.name + FROM records, record_owners, domains + WHERE record_owners.user_id = '".$id."' + AND records.id = record_owners.record_id + AND domains.id = records.domain_id + ".$andnot.";"); + + // Add these zones to the array as well. + + while ($r = $res_partial->fetchRow()) + { + $a_zones[] = array( "id" => $r["domain_id"], - "name" => $r["name"] + "name" => $r["name"], + "partial" => "1" ); } - return $ret; + + return $a_zones; } else { diff -r 11804f18dfc7 -r 6ffacb626294 locale/en_EN/LC_MESSAGES/en.po --- a/locale/en_EN/LC_MESSAGES/en.po Wed Jan 02 22:24:32 2008 +0000 +++ b/locale/en_EN/LC_MESSAGES/en.po Thu Jan 03 20:27:47 2008 +0000 @@ -16,6 +16,18 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: users.php:110 +msgid "Users may only change some of the records of zones marked with an (*)." +msgstr "" + +#: users.php:77 +msgid "access" +msgstr "" + +#: users.php:78 +msgid "owner" +msgstr "" + #: edit.php:9 msgid "No records where selected to assign an sub-owner." msgstr "" diff -r 11804f18dfc7 -r 6ffacb626294 locale/nl_NL/LC_MESSAGES/messages.mo Binary file locale/nl_NL/LC_MESSAGES/messages.mo has changed diff -r 11804f18dfc7 -r 6ffacb626294 locale/nl_NL/LC_MESSAGES/nl.po --- a/locale/nl_NL/LC_MESSAGES/nl.po Wed Jan 02 22:24:32 2008 +0000 +++ b/locale/nl_NL/LC_MESSAGES/nl.po Thu Jan 03 20:27:47 2008 +0000 @@ -16,6 +16,18 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: users.php:110 +msgid "Users may only change some of the records of zones marked with an (*)." +msgstr "Gebruikers kunnen slechts enkele records uit een zones gemarkeerd met een (*) wijzigen." + +#: users.php:77 +msgid "access" +msgstr "toegangelijk" + +#: users.php:78 +msgid "owner" +msgstr "eigenaar" + #: edit.php:9 msgid "No records where selected to assign an sub-owner." msgstr "Er waren geen records geselecteerd om toe te wijzen aan een beheerder." diff -r 11804f18dfc7 -r 6ffacb626294 users.php --- a/users.php Wed Jan 02 22:24:32 2008 +0000 +++ b/users.php Thu Jan 03 20:27:47 2008 +0000 @@ -74,7 +74,8 @@
echo _('Users may only change some of the records of zones marked with an (*).'); ?>
echo _('Number of users') ;?>: echo count($users); ?>.