@@ -590,8 +610,7 @@ function forena_fields_form($form_state) {
}
}
$form=array();
$form=array();
$form['head']=array(
'#type'=>'hidden',
...
...
@@ -609,9 +628,12 @@ function forena_fields_form($form_state) {
);
$form['fields']=array('#tree'=>TRUE,);
/*Now check the fields in the body against the xml*/
/*Now check the fields in the body against the xml*/
$i=0;
foreach($fieldsas$field){
$form['fields'][$field]=array(
$i++;
$field_ids[$i]=$field;
$form['fields'][$i]=array(
'#tree'=>TRUE,
'#type'=>'fieldset',
'#title'=>$field,
...
...
@@ -622,7 +644,13 @@ function forena_fields_form($form_state) {
$path='frx:fields/frx:field[@id="'.$field.'"]';
$node=$head->xpath($path);
$attr=$node[0];
$form['fields'][$field]['format']=array(
$form['fields'][$i]['id']=array(
'#type'=>'value',
'#value'=>$field,
);
$form['fields'][$i]['format']=array(
'#type'=>'textfield',
'#title'=>t('format'),
'#default_value'=>$attr['format'],
...
...
@@ -631,7 +659,7 @@ function forena_fields_form($form_state) {
'#description'=>t('Format a date and time field by entering the name of a supported format function. Enter a "*" to see all available formats.')
);
$form['fields'][$field]['format-string']=array(
$form['fields'][$i]['format-string']=array(
'#type'=>'textfield',
'#title'=>t('format-string'),
'#default_value'=>$attr['format-string'],
...
...
@@ -639,15 +667,15 @@ function forena_fields_form($form_state) {
'#description'=>t('The display type of your format.')
);
$form['fields'][$field]['link']=array(
$form['fields'][$i]['link']=array(
'#type'=>'textfield',
'#title'=>t('link'),
'#default_value'=>$attr['link'],
'#size'=>30,
'#size'=>100,
'#description'=>t('Create a link that incorporates this field, e.g "profile/{field_name}" will create a link to this field_name\'s profile. *Note the field must be wrapped in {}.')
);
$form['fields'][$field]['target']=array(
$form['fields'][$i]['target']=array(
'#type'=>'textfield',
'#title'=>t('target'),
'#default_value'=>$attr['target'],
...
...
@@ -655,14 +683,13 @@ function forena_fields_form($form_state) {
'#description'=>t('Link target eg. _BLANK')
);
$form['fields'][$field]['default']=array(
$form['fields'][$i]['default']=array(
'#type'=>'textfield',
'#title'=>t('default value'),
'#default_value'=>$attr,
'#size'=>30,
'#description'=>t('The value to be displayed in the report in the place of the field.')
);
);
}
$form['submit']=array(
'#type'=>'submit',
...
...
@@ -684,11 +711,11 @@ function forena_fields_form_submit($form, &$form_state) {
$values=$form_state['values'];
$head=$values['head'];
$body=$values['body'];
$fields=$values['fields'];
$fields=$values['fields'];
$xml='<html xmlns:frx="urn:FrxReports">'."\n";
$xml.=' <head>'."\n";
/*walk through all the children of the head and build the xml*/
foreach($head->children()as$node){
$xml.=' '.$node[0]->asXML()."\n";
...
...
@@ -698,39 +725,30 @@ function forena_fields_form_submit($form, &$form_state) {
@@ -1182,7 +1208,7 @@ function forena_admin_params_form($form_state) {
'#description'=>t('Requires a value for this parameter to display the report. If there is not a default value, the user will be prompted to enter a value.')