--- nfo/php/libs/org.netfrag.app/WebExplorer/MVC.php 2003/11/22 18:46:33 1.20 +++ nfo/php/libs/org.netfrag.app/WebExplorer/MVC.php 2003/12/14 01:51:29 1.21 @@ -1,9 +1,12 @@ array( query_arg => 'ecdm' ), // extended meta, e.g. 2nd parent identifier 'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), + 'ecom_data_meta_xe' => array( query_arg => 'ecdmxe' ), // filter the data: e.g. // - an xpath-query (xpq), // - an abstract/custom filter string or @@ -192,6 +196,8 @@ 'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), // ... required for expanded data items. 'ecom_data_action_expand_edit' => array( query_arg => 'ecdfee' ), + // ... required for selecting existing objects as reference + 'ecom_data_action_select' => array( query_arg => 'ecdfsel' ), // Special argument (should become a non-data-action). // Triggers 'selectSource' at backend api (remote api) which causes a database handle switch. @@ -275,8 +281,10 @@ $label = $_in[ecom_label]; switch ($_in[ecom_abstract_type]) { case "list": - if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } - if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } + if($pre_out[options][ecoms][$label][ecom_mode] != "select") { + if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } + if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } + } break; // 2003-04-16: required for xmltree-to-item transition // if we dont do this the "dotted" filter expression would persist across views @@ -443,6 +451,33 @@ $_out[options][ecoms][$label][ecom_abstract_type] = "item"; } + // Action.Select + if($_in[ecom_data_action_select]) { + if(is_array($_in[ecom_data_form_checkbox])) { + $cnt = sizeof($_in[ecom_data_form_checkbox]); + $tmp = array(); + foreach($_in[ecom_data_form_checkbox] as $ident) { + if($ident) { array_push($tmp, $ident); } + } + if($cnt == 1) { + print "Single selection, ident : " . $tmp[0] . "
"; + $_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; + $_out[options][ecoms][$label][ecom_abstract_type] = "item"; + } elseif($cnt > 1) { + // TODO: implement multi-selection actions on rows(items) here!! + print "Cannot do Multi-Selections with Action SELECT!!" . "
"; + } + + $requestTracker = mkObject("Application::Request::Tracker"); + $page_state = $requestTracker->getPointer(); + $pre_out = $page_state[options]; + //print "pre_out: " . Dumper($pre_out); + + $_out[options][ecoms][$label][ecom_mode] = "select"; + $_out[options][ecoms][$label][ecom_data_meta_xe] = $pre_out[options][ecoms][$label][ecom_data_meta]; + $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; + } + } '), // propagate datasources to ecoms