Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2131

Přidáno uživatelem Ondřej Fibich před asi 11 roky(ů)

Upravy:

- refs #563: Dokumentace k AXO (vylepseni skriptu pro generovani + pridani komentaru k metodam a objektum v DTD)

Zobrazit rozdíly:

freenetis/branches/1.1/application/vendors/axo_doc/axo_doc.dtd
type (controller|helper|library|view) #REQUIRED
name CDATA #REQUIRED
hide (true|false) "false"
comment-en CDATA
comment-cs CDATA
>
<!--- Method of the object -->
......
<!ATTLIST method
name CDATA #REQUIRED
hide (true|false) "false"
comment-en CDATA
comment-cs CDATA
>
<!--- An AXO calll -->
......
value CDATA #REQUIRED
section CDATA #REQUIRED
action (edit|new|delete|confirm|view) #REQUIRED
usage_type (unknown|access|breadcrumbs|links) #REQUIRED
usage_type (unknown|access|breadcrumbs|links|grid-action) #REQUIRED
>
<!-- Comment in a defines language for the AXo call -->
<!-- Comment in a defined language for the AXO call -->
<!ELEMENT comment EMPTY>
<!ATTLIST comment
lang (en|cs) #REQUIRED
freenetis/branches/1.1/application/vendors/axo_doc/utils/generate_axo_doc.pl
# Methods name
my @methods_names = ();
my @methods_go_throught = ();
my $methods_names_index = 0;
while ($source =~ m/((?:[a-z0-9_*]+\s+)*)function\s+([a-zA-Z0-9_]+)\s*\(/g)
{
my ($method_details, $method_name, $methos_attrs) = ($1, $2, $3);
$methods_names[$methods_names_index] = $method_name;
$methods_go_throught[$methods_names_index] = (
!($method_details =~ m/static/g) &&
!($method_details =~ m/private/g) &&
!($method_details =~ m/protected/g) &&
!($method_name =~ /^valid_/)
);
$methods_names_index = $methods_names_index + 1;
}
......
# Reset counter
$parsed_acl_call_item_method_count = 0;
# For each ACL method call
while ($method_body =~ m/acl_check_(edit|new|delete|confirm|view)\s*\(\s*["']([^"']+)["']\s*,\s*["']([^"']+)["']\s*(,)?/g)
# If enabled for checking of AXO
if ($methods_go_throught[$methods_names_index])
{
# get values from the matched regex
my ($action, $axo_section, $axo_value, $is_own) = ($1, $2, $3, defined($4) ? "true" : "false");
# create tag method?
if ($parsed_acl_call_item_method_count == 0)
# For each ACL method call
while ($method_body =~ m/acl_check_(edit|new|delete|confirm|view)\s*\(\s*((["']([^"']+)["'])|(get_class\s*\(\s*[\$]{1}this\s*\)\s*))\s*,\s*["']([^"']+)["']\s*(,)?/g)
{
$xml_writer->startTag("method", "name" => $methods_names[$methods_names_index]);
# comment with source code
if ($comments)
# get values from the matched regex
my ($action, $axo_section, $axo_value, $is_own) = ($1, $2, $6, defined($7) ? "true" : "false");
# section this
if ($axo_section =~ m/get_class\s*\(\s*[\$]{1}this\s*/g)
{
my $method_body_comments = $method_body;
$method_body_comments =~ s/[-][-]//mg; # remove --
$xml_writer->comment($methods_names[$methods_names_index] . "(" . $method_body_comments);
if (!("controller" eq $tag))
{
print STDERR "get_class in view: " . $file_name . " : " . $tag . "\n";
next; # skip
}
my $old = $axo_section;
$axo_section = ucfirst($file_name) . "_Controller";
print STDERR $old . " >> " . $axo_section . "\n";
}
else
{
$axo_section = substr($axo_section, 1, -1);
}
# create tag method?
if ($parsed_acl_call_item_method_count == 0)
{
$xml_writer->startTag("method", "name" => $methods_names[$methods_names_index]);
# comment with source code
if ($comments)
{
my $method_body_comments = $method_body;
$method_body_comments =~ s/[-][-]//mg; # remove --
$xml_writer->comment($methods_names[$methods_names_index] . "(" . $method_body_comments);
}
}
# increase counter
$parsed_acl_call_count = $parsed_acl_call_count + 1;
$parsed_acl_call_item_method_count = $parsed_acl_call_item_method_count + 1;
# Create AXo tag
$xml_writer->startTag(
"axo",
"usage_type" => "unknown",
"section" => $axo_section,
"value" => $axo_value,
"action" => $action,
"own" => $is_own
);
# End AXO tag
$xml_writer->endTag();
}
# increase counter
$parsed_acl_call_count = $parsed_acl_call_count + 1;
$parsed_acl_call_item_method_count = $parsed_acl_call_item_method_count + 1;
# Create AXo tag
$xml_writer->startTag(
"axo",
"section" => $axo_section,
"value" => $axo_value,
"action" => $action,
"own" => $is_own,
"usage_type" => "unknown"
);
# End AXO tag
$xml_writer->endTag();
# end method tag?
if ($parsed_acl_call_item_method_count > 0)
{
$xml_writer->endTag();
}
elsif ($tag eq "controller")
{
$xml_writer->startTag("method", "name" => $methods_names[$methods_names_index]);
$xml_writer->endTag();
}
}
# end method tag?
if ($parsed_acl_call_item_method_count > 0)
{
$xml_writer->endTag();
}
elsif ($tag eq "controller")
{
$xml_writer->startTag("method", "name" => $methods_names[$methods_names_index]);
$xml_writer->endTag();
}
# next index
$methods_names_index = $methods_names_index + 1;
}

Také k dispozici: Unified diff