diff --git a/manager/actions/mutate_content.dynamic.php b/manager/actions/mutate_content.dynamic.php index 61027e1f3a..5425146f03 100644 --- a/manager/actions/mutate_content.dynamic.php +++ b/manager/actions/mutate_content.dynamic.php @@ -784,11 +784,14 @@ function decode(s) { echo "\t\t",'
',"\n"; $tvPBV = array_key_exists('tv'.$row['id'], $_POST) ? $_POST['tv'.$row['id']] : $row['value']; // post back value + + /* Changed by ProWebscape for custom tv: Added $row to end of function. Give the whole row array to the TV */ echo "\t\t",'',$row['caption'],"\n", "\t\t\t",'
',$row['description'],"\n", "\t\t\t",'',"\n", - "\t\t\t",renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, ' style="width:300px;"'),"\n", + "\t\t\t",renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, ' style="width:300px;"', $row),"\n", "\t\t\n"; + /* Changed by ProWebscape for custom tv */ } echo "\t\n"; } else { diff --git a/manager/actions/mutate_tmplvars.dynamic.php b/manager/actions/mutate_tmplvars.dynamic.php index 5186a48051..c6d7035cee 100644 --- a/manager/actions/mutate_tmplvars.dynamic.php +++ b/manager/actions/mutate_tmplvars.dynamic.php @@ -98,6 +98,9 @@ function deletedocument() { widgetParams['datagrid'] = '&cols=Column Names;string &flds=Field Names;string &cwidth=Column Widths;string &calign=Column Alignments;string &ccolor=Column Colors;string &ctype=Column Types;string &cpad=Cell Padding;int;1 &cspace=Cell Spacing;int;1 &rowid=Row ID Field;string &rgf=Row Group Field;string &rgstyle = Row Group Style;string &rgclass = Row Group Class;string &rowsel=Row Select;string &rhigh=Row Hightlight;string; &psize=Page Size;int;100 &ploc=Pager Location;list;top-right,top-left,bottom-left,bottom-right,both-right,both-left; &pclass=Pager Class;string &pstyle=Pager Style;string &head=Header Text;string &foot=Footer Text;string &tblc=Grid Class;string &tbls=Grid Style;string &itmc=Item Class;string &itms=Item Style;string &aitmc=Alt Item Class;string &aitms=Alt Item Style;string &chdrc=Column Header Class;string &chdrs=Column Header Style;string;&egmsg=Empty message;string;No records found;'; widgetParams['richtext'] = '&w=Width;string;100% &h=Height;string;300px &edt=Editor;list;'; widgetParams['image'] = '&alttext=Alternate Text;string &hspace=H Space;int &vspace=V Space;int &borsize=Border Size;int &align=Align;list;none,baseline,top,middle,bottom,texttop,absmiddle,absbottom,left,right &name=Name;string &class=Class;string &id=ID;string &style=Style;string &attrib=Attributes;string'; + /* Changed by ProWebscape for custom widget */ + widgetParams['custom_widget'] = '&output=Output;string'; + /* Changed by ProWebscape for custom widget */ // Current Params var currentParams = {}; @@ -308,6 +311,9 @@ function decode(s){ + + + @@ -331,6 +337,9 @@ function decode(s){ + + + diff --git a/manager/includes/tmplvars.format.inc.php b/manager/includes/tmplvars.format.inc.php index 74478cc927..a4ad07a619 100755 --- a/manager/includes/tmplvars.format.inc.php +++ b/manager/includes/tmplvars.format.inc.php @@ -327,6 +327,25 @@ function getTVDisplayFormat($name,$value,$format,$paramstring="",$tvtype="",$doc $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); break; + /* Changed by ProWebscape for custom widget */ + case 'custom_widget': + $widget_output = ''; + /* If we are loading a file */ + if(substr($params['output'], 0, 6) == "@FILE:") { + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); + if( !file_exists($file_name) ) { + $widget_output = "$file_name does not exist"; + } else { + /* The included file needs to set $widget_output. Can be string, array, object */ + include $file_name; + } + } else { + $widget_output = str_replace('[+value+]', $value, $params['output']); + } + $o = $widget_output; + break; + /* Changed by ProWebscape for custom widget */ + default: $value = parseInput($value); if($tvtype=='checkbox'||$tvtype=='listbox-multiple') { diff --git a/manager/includes/tmplvars.inc.php b/manager/includes/tmplvars.inc.php index c608ec8c88..754e71cc3d 100755 --- a/manager/includes/tmplvars.inc.php +++ b/manager/includes/tmplvars.inc.php @@ -1,7 +1,7 @@  '; break; + + /* Changed by ProWebscape for custom tv */ + case 'custom_tv': + $custom_output = ''; + /* If we are loading a file */ + if(substr($field_elements, 0, 6) == "@FILE:") { + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); + if( !file_exists($file_name) ) { + $custom_output = "$file_name does not exist"; + } else { + ob_start(); + include $file_name; + $custom_output = ob_get_contents(); + ob_end_clean(); + } + } else { + $replacements = array( + '[+field_type+]' => $field_type, + '[+field_id+]' => $field_id, + '[+default_text+]' => $default_text, + '[+field_value+]' => htmlspecialchars($field_value), + '[+field_style+]' => $field_style, + ); + $custom_output = str_replace(array_keys($replacements), $replacements, $field_elements); + } + $field_html .= $custom_output; + break; + /* Changed by ProWebscape for custom tv */ + default: // the default handler -- for errors, mostly $field_html .= '';