Author: richter Date: Sun Nov 9 13:14:40 2014 New Revision: 1637675 URL: http://svn.apache.org/r1637675 Log: Constrains for selectdyn
Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm?rev=1637675&r1=1637674&r2=1637675&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Sun Nov 9 13:14:40 2014 @@ -104,31 +104,37 @@ my $class = $self -> {class} ; my $doctypes ; my $datasrc = $self -> {datasrc} ; -if ($datasrc && !$self -> {no_new}) +if ($datasrc) { my %doctypes ; - my $datasource = CouchDB::AppServ::DataSource -> get_datasource ($datasrc) ; - my $docclasses = $datasource -> get_doctypes_for_datasrc () ; - foreach my $doctype (@$docclasses) + my $datasource = $self -> {datasrcobj} ||= CouchDB::AppServ::DataSource -> get_datasource ($datasrc) ; + if (!$self -> {no_new}) { - my $docclass = CouchDB::AppServ::Docclass -> find_docclass ($doctype) ; - next if (!$docclass || $docclass -> abstract_doctype eq ref $docclass) ; - #next if ($subclass -> is_allowed ('new', $reqdata, $reqdata -> {document}) != 1) ; - $doctypes{$docclass -> title ($req -> {i18n})} = $docclass -> doctype ; + my $docclasses = $datasource -> get_doctypes_for_datasrc (undef, ['no_new', 'indirect']) ; + foreach my $doctype (@$docclasses) + { + my $docclass = CouchDB::AppServ::Docclass -> find_docclass ($doctype) ; + next if (!$docclass || $docclass -> abstract_doctype eq ref $docclass) ; + #next if ($subclass -> is_allowed ('new', $reqdata, $reqdata -> {document}) != 1) ; + $doctypes{$docclass -> title ($req -> {i18n})} = $docclass -> doctype ; + } + $doctypes = join (',', map {( $doctypes{$_}, $_) } sort keys %doctypes) ; } - $doctypes = join (',', map {( $doctypes{$_}, $_) } sort keys %doctypes) ; + + my ($constrain, $without_constrain) = $datasource -> get_constrain_value ($req, $self) ; + $datasrc .= '&constrain=' . $epreq->Escape ($constrain,6) . '&without_constrain=' . ($without_constrain?1:0) if ($constrain) ; } - + $] <input name="_opt_[+ $name +]" [+ do { local $escmode = 0 ; $self -> get_std_control_attr($req, undef, undef, 'ef-context-menu ' . ($self -> {no_button}?'':'ef-control-selectdyn-has-ctrl' )) } +] -type="text" _ef_attach="ef_selectdyn" +type="text" _ef_attach="ef_selectdyn" [$if $self -> {size} $]size="[+ $self->{size} +]" [$endif$] [$if $self -> {showurl} $]_ef_show_url="[+ $self -> {showurl} +]" [$endif$] [$if $self -> {showurl_append} $]_ef_show_url_append="[+ $self -> {showurl_append} +]" [$endif$] [$if $self -> {popupurl} $]_ef_popup_url="[+ $self -> {popupurl} +]" [$endif$] [$if $self -> {datasrcurl} $]_ef_datasrc_url="[+ $self -> {datasrcurl} +]" [$endif$] [$if $self -> {datasrcurl_append} $]_ef_datasrc_url_append="[+ $self -> {datasrcurl_append} +]" [$endif$] -[$if $self -> {datasrc} $]_ef_datasrc_nam="[+ $self -> {datasrc} +]" [$endif$] +[$if $self -> {datasrc} $]_ef_datasrc_nam="[+ $datasrc +]" [$endif$] [$if $self -> {datasrctermmax} $]_ef_datasrc_term_max="[+ $self -> {datasrctermmax} +]" [$endif$] [$if $self -> {use_ajax} $]_ef_use_ajax="[+ $self -> {use_ajax} +]" [$endif$] [$if $self -> {show_on_select} $]_ef_show_on_select="[+ $self -> {show_on_select}?'1':'' +]" [$endif$] --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org