We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23050
    • 1,842 Posts
    Hi Soda,

    I’ve tried the moduled installation and I get the following error :

    /xxx/www/assets/snippets/FDM/install/[snippet]select.php not found.


    For sure, [snippet]select.php isn’t in the .zip smiley

    I try a manual installation and come back to you if needed wink

    Later in the night... ( :p )

    Despite the error during moduled installation, all seems to work fine. smiley

    But, I have a question : what if I don’t want to use the add/edit/unpublish button bar ? I mean : I would like to display a link, like "add an article" and the user (anonymous or not), is redirected to the add article page, without seeing the button bar. Is that possible ?

    Other question : if I click on the add button, I get the form with all fields filled in with the content of the form page... Is that normal ? I mean that I get the FDM call in the content textarea.

    (If I’m not clear, i can speak french :p )

    I also tried TinyMCE call and works like a charm ! Except that, for those of you who can’t get it work, be sure that the path to tinymce.js is good : Since 0.9.6, tinymce plugin is contained in a folder called tinymce2111 wink

    Thanks for your time Soda smiley
      • 27889
      • 415 Posts
      Quote from: Perrine at Jun 21, 2007, 03:52 PM


      /xxx/www/assets/snippets/FDM/install/[snippet]select.php not found.

      Yes I remove it because eForm can’t validate such generated fields, I forget to remove it from the install module.

      what if I don’t want to use the add/edit/unpublish button bar ? I mean : I would like to display a link, like "add an article" and the user (anonymous or not), is redirected to the add article page, without seeing the button bar. Is that possible ?
      (not tested but I will do) you make a call to FDM in the page you want the link (don’t forget &model and &parent) and in the model you make your call with &disableadd.
      - if you want to change the appearence of the links, the template is in your FDM/lang/francais-utf8.inc.php in the $_lang[’links_template’] var between the two "END" (don’t add any chars to the last "END;" line or it will break the template)

      if I click on the add button, I get the form with all fields filled in with the content of the form page... Is that normal ? I mean that I get the FDM call in the content textarea.
      Normally I have escaped chunk, snippet, ... in content textarea, the problem come from utf8 I think, because I search for some string ( [[,[!, ... ) to comment them, so snippet call, and chunk, ... don’t appears, but with utf8 the problem as explained here (in french) is present.
      I will use mbstring to correct that in the next version, like most people use utf8 I think it’s better for all.

      (If I’m not clear, i can speak french :p )
      You’re clear at least like me. wink

      Edit:
      For those who can’t wait for the next version, remove these two lines in the module :
      $snippet['select']['filename']='[snippet]select.php';                                                                             
      $snippet['select']['description']='Display a listbox of value in forms';     
      
        MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
        MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
        • 23050
        • 1,842 Posts
        Aaaaah ok, I’ve just understood what the &model is ! Didn’t understand yesterday... embarrassed

        So, another question : is there a way to display a form, with all the fields blank ? Because, if I understand the parameter, the form will always contain fields filled in. Am I right ?

        (And so... my 2d question wasn’t clear because now that I understand &model, I know why all the fields are filled in :p )

        Edit
        Well, in fact I’m not sure I understand what the &model is lol .. I try to use it in a call, but the form isn’t displayed.. I only get the doc normally, like if I don’t use FDM
          • 27889
          • 415 Posts
          In your model, you can leave emty all its fields so they are filled in the edit form with ... empty string. I’m currently working to add empty doc with &model parameter set to `0`.
          &model is copied and edit form filled with this copy.

          Put a FDM call in your model
            MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
            MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
            • 17883
            • 1,039 Posts
            Line 157 in /includes/fdm.class.inc.php

            						$url=$modx->makeUrl($docObj->Get('id'),'','&fdmaction=edit');					
            					}				
            					header('Location: '.$url); // dans all ok
            					exit;
            					break;	


            doesn´t work if proper XHTML URLs enabled in config. Should work:

            						$url=$modx->makeUrl($docObj->Get('id'),'','&fdmaction=edit');					
            					}	
                                                   $url=str_replace('&','&',$url);					
            					header('Location: '.$url); // dans all ok
            					exit;
            					break;	


            Greetings
              • 29039
              • 58 Posts
              (beta)tvfields - universal snipet for tv form elements like checkboxes, dropdown lists
              just put in fdm chunk [[tvfields? &docid=’[*id*] &field_name=producer]] where field_name - name of TV
              may be used right in FDM code for TV placeholders

              <?php
              $docid=isset($value)?$docid:'214';
              $field_name=isset($field_name)?$field_name:'documentTags';
              	
              	function ParseIntputOptions($v) {
              		$a = array();
              		if(is_array($v)) return $v;
              		else if(is_resource($v)) {
              			while ($cols = mysql_fetch_row($v)) $a[] = $cols;
              		}
              		else $a = explode("||", $v);
              		return $a;
              	}
              	
              	
              	$rs = $modx->db->select("id, type, caption, description, elements, default_text", $modx->getFullTableName('site_tmplvars'), "name = '$field_name'");
              	$limit = mysql_num_rows($rs);
              	if ($limit != 1) { echo "TV с именем '$field_name' отсутствует, или произошло задвоение имен TV."; }
              	else {
              	$tvfields = mysql_fetch_assoc($rs);
              	$tvid = $tvfields['id'];
              	$field_type = $tvfields['type'];
              	$field_caption = $tvfields['caption'];
              	$field_description = $tvfields['description'];
              	$field_elements = $tvfields['elements'];
              	$field_default_text = $tvfields['default_text'];
              	}
              	
              	$rs = $modx->db->select("value", $modx->getFullTableName('site_tmplvar_contentvalues'), "tmplvarid = '$tvid' and contentid = '$docid'");
              	$limit = mysql_num_rows($rs);
              	if ($limit != 1) {echo "Ошибка значения TV";}
              	else {
              	$field = mysql_fetch_assoc($rs);
              	$field_value = $field['value'];
              	}
              	
              	$field_html ='';
              		
              		switch ($field_type) {
              
              			case "text": // handler for regular text boxes
              			case "rawtext"; // non-htmlentity converted text boxes
              			case "email": // handles email input fields
              			case "number": // handles the input of numbers
              				$field_html .=  '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" style="width:100%" />';
              				break;
              			case "textareamini": // handler for textarea mini boxes
              				$field_html .=  '<textarea id="tv'.$field_name.'" name="tv'.$field_name.'" cols="40" rows="5" style="width:100%">' . htmlspecialchars($field_value) .'</textarea>';
              				break;
              			case "textarea": // handler for textarea boxes
              			case "rawtextarea": // non-htmlentity convertex textarea boxes
              			case "htmlarea": // handler for textarea boxes (deprecated)
              			case "richtext": // handler for textarea boxes
              				$field_html .=  '<textarea id="tv'.$field_name.'" name="tv'.$field_name.'" cols="40" rows="15" style="width:100%;">' . htmlspecialchars($field_value) .'</textarea>';
              				break;
              			case "date":
              
              // select (dropdown)
              			case "dropdown":
              				$field_html .=  '<select id="tv'.$field_name.'" name="tv'.$field_name.'" size="1">';
              				$index_list = ParseIntputOptions($field_elements);
              				while (list($item, $itemvalue) = each ($index_list))
              				{
              					list($item,$itemvalue) =  (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
              					if (strlen($itemvalue)==0) $itemvalue = $item;
              					$field_html .=  '<option value="'.htmlspecialchars($itemvalue).'"'.($itemvalue==$field_value ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
              				}
              				$field_html .=  "</select>";
              				break;
              // select (listbox)
              			case "listbox":
              				$field_html .=  '<select id="tv'.$field_name.'" name="tv'.$field_name.'" size="8">';	
              				$index_list = ParseIntputOptions($field_elements);
              				while (list($item, $itemvalue) = each ($index_list))
              				{
              					list($item,$itemvalue) =  (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
              					if (strlen($itemvalue)==0) $itemvalue = $item;
              					$field_html .=  '<option value="'.htmlspecialchars($itemvalue).'"'.($itemvalue==$field_value ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
              				}
              				$field_html .=  "</select>";
              				break;
              // multiple select
              			case "listbox-multiple":
              				$field_value = explode("||",$field_value);
              				$field_html .=  '<select id="tv'.$field_name.'[]" name="tv'.$field_name.'[]" multiple="multiple" size="8">';
              				$index_list = ParseIntputOptions($field_elements);
              				while (list($item, $itemvalue) = each ($index_list))
              				{
              					list($item,$itemvalue) =  (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
              					if (strlen($itemvalue)==0) $itemvalue = $item;
              					$field_html .=  '<option value="'.htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,$field_value) ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
              				}
              				$field_html .=  "</select>";
              				break;
              // url input fields
              				case "url":
              				$urls= array(''=>'--', 'http://'=>'http://', 'https://'=>'https://', 'ftp://'=>'ftp://', 'mailto:'=>'mailto:');
              				$field_html ='<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_name.'_prefix" name="tv'.$field_name.'_prefix" onchange="documentDirty=true; setVariableModified(\''.$field_name.'\');">';
              				foreach($urls as $k => $v){
              					if(strpos($field_value,$v)===false) $field_html.='<option value="'.$v.'">'.$k.'</option>';
              					else{
              						$field_value = str_replace($v,"",$field_value);
              						$field_html.='<option value="$v" selected="selected">'.$k.'</option>';
              					}
              				}
              				$field_html .='</select></td><td>';
              				$field_html .=  '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" width="100" /></td></tr></table>';
              				break;
              // check boxes
              			case "checkbox":
              				$field_value = explode("||",$field_value);
              				$index_list = ParseIntputOptions($field_elements);
              				static $i=0;
              				while (list($item, $itemvalue) = each ($index_list))
              				{
              					list($item,$itemvalue) =  (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
              					if (strlen($itemvalue)==0) $itemvalue = $item;
              					$field_html .=  '<input type="checkbox" value="'.htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_name.'[]" '. (in_array($itemvalue,$field_value)?" checked='checked'":"").' /><label for="tv_'.$i.'">'.$item.'</label><br />';
              					$i++;
              				}
              				break;
              // radio buttons (option)
              			case "option":
              				$index_list = ParseIntputOptions($field_elements);
              				while (list($item, $itemvalue) = each ($index_list))
              				{
              					list($item,$itemvalue) =  (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
              					if (strlen($itemvalue)==0) $itemvalue = $item;
              					$field_html .=  '<input type="radio" value="'.htmlspecialchars($itemvalue).'" name="tv'.$field_name.'" '.($itemvalue==$field_value ?'checked="checked"':'').' />'.$item.'<br />';
              				}
              				break;
              // image fields (image manager)
              			case "image":
              
              			case "file": // handles the input of file uploads
              
              			default: // the default handler -- for errors, mostly
              				$field_html .=  '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" />';
              
              		} // end switch statement
              	
              
              return $field_html;	
              ?>
                • 11975
                • 2,542 Posts
                Hi,

                I’ve done something similar about tvs displaying in eform tpl
                I’ve used a set of classes I’ve written for tveditor module and tvexplorer snippet
                (@BINDINGS in Tvs are supported)

                In your eform tpl you only have to write some new placeholders
                [+tve.nameOfMyTV+]

                You can add the eform attributes using this syntax

                [+tve.nameOfMyTV:eform->param1,param2,param,param4+]

                I’m using the eform event => eformOnBeforeFormParse

                It’s still in alpha stage but let me know if you’re intested in these features

                :-)

                More about tvexplorer =>http://modxcms.com/forums/index.php/topic,15272.0.html
                tveditor module => http://modxcms.com/forums/index.php/topic,15270.0.html
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 27889
                  • 415 Posts
                  This could be a great addon.
                    MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                    MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                    • 11975
                    • 2,542 Posts
                    I’ve started to work onthis this afternoon so it still needs some work.
                    Once i’ll have posted the tvexplorer and tveditor code (with new features such as date support), I will release it.

                    :-)
                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 27889
                      • 415 Posts
                      Updated to new 0.0.9 with lot of changes. RTFM !

                      Placeholder output and empty docs for @Perrine wink

                      @MadeMyDay, Thanks, I have modified the call to makeurl.
                        MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                        MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]