We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 18862
      • 70 Posts
      Thanks for your explanation on the alias David. I get it now. smiley

      @ Soda - I wish I wasn’t a programmer like you! (meaning if I were a tenth the programmer you are, I would feel like I could call myself a programmer)
      I’m not a programmer and my english is so bad.

      I’ve been spending hours trying to figure out how to get a placeholder set and stay set using FDM.

      I’ve finally figured out how to get jquery ajax calls to work and have successfully used it to run a query and return the document id based on the pagetitle.

      So here’s the overview of what I’m trying to accomplish. I have a select element that has 5 different options/categories. On that same page I have the call to fdm and I want to provide the "fdmparent" parameter based on the option selected in the select element. I’ve gotten this to work using the following:

      [!FDM? &tplLinks=`fdmButtons` &eform_thankyou=`fdmThankYou` &output=`0` &debug=`run`!]
      [[includeJquery]]
      [+fdmEform+]
      <script type="text/JavaScript">
       $(document).ready(function(){
      	$("#pfCategory").change(function(){
      	var category = document.getElementById('pfCategory').value;
      	var qstrHref = $("a[@title='Add Document']").attr("href");
      	$.ajax({
        type: "POST",
        url: "ajax2",
        data: "name=" + category + "&qstrHref=" + qstrHref,
        success: function(data){
        var replacestr = qstrHref.replace(/(fdmparent=)([0-9]*)/, "$1" + data);
        $("a[@title='Add Document']").attr({ href: replacestr });
      	alert( "Data Loaded: " + replacestr );
        },
        error: function(data1, data2, data3){
        alert( "There was a problem: " + data1 + " " + data2 + " " + data3);
        }
      });
      });
      });
       </script>


      I just copied what is the default for the tplLinks and added the following at the top:
      <p>Choose a category you'd like to add a project for.</p>
      {{categories}}
      (The categories chunk contains the <select> element)

      I know I could just have the value provided by the select element match the document in the back end, but I wanted to make it portable so that it wouldn’t matter if somehow the document ids changed or something.

      I attached the screenshot of this page as 1st.gif (by the way.. how do you embed images straight in the page? I thought maybe I could do
      [img]1st.gif[/img]
      after attaching it, but couldn’t)

      2nd.gif shows the returned info from the php script I have run through the jquery ajax call. (I have it grab the href="..." attribute and then using the javascript replace() function insert the modified "fdmparent=" information.

      Okay, so now the problem. I’ve tried using the $modx->setPlaceholder(’name’, $value); within the snippet from my first ajax call, but it does not survive through to the next page loaded by fdm. I’ve gone through the code in "fdm.class.inc.php" to see where I might set a placeholder in there, but I just can’t figure it out. I’ve tried assigning the value to a $_SESSION variable and I can see it goes through when I use the debug=`run` through FDM, but I can’t get it into the form.

      You can see in my attachment - 3rd.gif that the session variable is going through, but I can’t get it to display after "New Project -"
      So, I want it to display "New Project - Restaurants" in this case. Should be able to have it be "New Project - [+projectCategory+]" in the template.

      Any thoughts?

      You guys are GREAT!!! smiley
        • 25547
        • 61 Posts
        Hi again.

        Got a small problem.

        I have two dates needing inputted from one pop up calender.

        For the first date a tv called start2 I have this code:

        <fieldset>
        <legend>Date</legend>
        	<p>	<label for="date">Date</label><br />
        			<input name="tvstart2" id="tvstart2" value="[+tvstart2+]" readonly="readonly">
        <a onClick="nwev_cal1.popup();" title="Select the Date of the Event">
        		<img align="absmiddle" src="manager/media/calendar/img/cal.gif" width="16" height="16" border="0" alt="Select Event Date"></a>
                <a 	onClick="document.forms['fdmForm'].elements['tvevent_date'].value=''; return true;" >
        		<img align="absmiddle" src="manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" border="0" alt="Clear Event Date"></a>
        	</p>
        </fieldset>


        This works.

        However, to add a second date for the tv start with the same calender I use this:

        <input type="hidden" name="tvstart" id="tvstart" value="[+tvstart2+]" />

        This gives an error tempering attempt detected.

        Edit: got rid of the error ^^^ by using this.

        <input type="hidden" name="tvstart" id="tvstart" value="[+tvstart2+]" eform="::0::" />

        However, the second tv tvstart is only stored on editing the document, not when first creating it. I beleive this is because tvstart2 has no value until the form has been submitted. Any way around this?



        Thanks in advance, Ross
          • 6726
          • 7,075 Posts
          I have used the &eform_to parameter for the first time and it doesn’t work very well for me, as it does with eForm :

          • I get unformatted HTML
          • some placeholders are not set I still am trying to figure out why some do and some don’t

          Maybe it has to do with id being identical to name for each field ?

          If anyone has encountered the same issue...
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 29242
            • 3 Posts
            Hello,
            How do I make users moderate (i.e. publish/unpublish and delete) only thier own documents, not all the documents?
            what about having comphehensive rights managment (like gorupwise and per user read/write permissions)?

            The task is like I have 2 users groups, they can add their own docs and edit them, and also being able to read only docs from the opposite group (this one is easily achived). But I want the users to be able to remove and publish/unpublish their own docs, not the whole groups’.

            And how do I set a quota for a user (e.g. a number of docs he/she can create?)

            And it seems that FDM grabs data for a form (tv values) from &parent, not from &model as I expected from documentation. huh
              • 12983
              • 108 Posts
              At time 00:13 of the FDM demo video at dp-site.fr I can see some news, with edit/unpublish/delete buttons next to their titles.
              It’s not clear to me how this can be accomplished.
              Should I call FDM and then Ditto with special parameters? Or should I call FDM two times with some parameters? Please try giving me some directions, I’ve read the doc file but still can’t figure it out.

              --
              EDIT:

              Maybe, the list of news is a call to Ditto, done in a way that the generated output has a call to FDM for each article, with an id value equal to that of the article?
                • 36624
                • 535 Posts
                Quote from: insert_nick at Jun 06, 2008, 12:34 PM

                Maybe, the list of news is a call to Ditto, done in a way that the generated output has a call to FDM for each article, with an id value equal to that of the article?

                yes ! like this wink :
                [[FDM? &disableadd=`1`&id=`[+id+]` &tplLinks=`fdmTpl`  &script=`tinyMCE` ]]


                my page are cached so i use the ditto call uncached [!..!] and this fdm call in the ditto chunk is cached [[..]]
                  CTRL+SHIFT+U - Clear Cache
                  CTRL+SHIFT+H - Hiding Heft Panel
                  CTRL+SHIFT+N - Fast Create Resource
                  CTRL+ALT+P - Preview Recource (in edit resorce window)
                  CTRL+ALT+S - Save
                  • 6726
                  • 7,075 Posts
                  I am not sure this has been brought up (hard to check out with 24 pages for this thread tongue).

                  I found a little  bug in latest FDM (0.1b), &eform_subject doesn’t work when you want to be notified by email. If you specify a subject instead of the default "FDM : notification ...... " you get "0" as a subject.

                  Check fdm.class.inc.php, line 250 :

                  $this->eform[’subject’] = $this->parameters[’eform_subject’] ? $this->parameters[’eform_modified subject’] : ’FDM: notification ’.$modx->config[’site_url’];

                  There is a typo I guess, it should be

                  $this->eform[’subject’] = $this->parameters[’eform_subject’] ? $this->parameters[’eform_subject’] : ’FDM: notification ’.$modx->config[’site_url’];

                  At least it works for me now, thought I would share smiley
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 30100
                    • 58 Posts
                    I have searched for it but I can’t find a way to use the FCK RTE with FDM instead of TinyMCE for the content field of the documents. Is there an easy way to set a chunk with &script and how would that chunk look?
                      • 25551 ☆ A M B ☆
                      • 1,231 Posts
                      Hey I installed Tinymce30 that is in the downloads area and I tried the the code below but it will not load Tinymce... I changed all the tinymce303 to tinymce30 as that’s the folder in my plugins area but it will not load up. The older script worked for the default tinymce version that comes with MODx. Any ideas why it won’t load?

                      Thanks, Ross

                      Quote from: endif at Mar 18, 2008, 06:30 AM


                      <script language="javascript" type="text/javascript" src="[(base_url)]assets/plugins/tinymce303/jscripts/tiny_mce/tiny_mce.js"></script>
                      <script language="javascript" type="text/javascript" src="[(base_url)]assets/plugins/tinymce303/xconfig.js"></script>
                      <script language="javascript" type="text/javascript">
                      	tinyMCE.init({
                      		  theme : "advanced",
                      		  mode : "exact",
                      		  width : "100%",
                      		  height : "400",
                      		  relative_urls : true,
                      		  document_base_url : "/",
                      		  remove_script_host : true,
                      		  language : "de",
                      		  elements : "fdmContent",
                      		  valid_elements : tinymce_valid_elements,
                      		  extended_valid_elements : tinymce_extended_valid_elements,
                      		  invalid_elements : tinymce_invalid_elements,
                      		  entity_encoding : "named",
                      		  cleanup: true,
                      		  apply_source_formatting : true,
                      		  remove_linebreaks : false,
                      		  convert_fonts_to_spans : "true",
                      		  file_browser_callback : "myFileBrowser",
                      		  external_link_list_url : "/assets/plugins/tinymce303/tinymce.linklist.php",
                      		  theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address",
                      		  plugins : "style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media",
                      		  theme_advanced_buttons0 : "",
                      		  theme_advanced_buttons1 : "undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,link,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help",
                      		  theme_advanced_buttons2 : "bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops",
                      		  theme_advanced_buttons3 : "",
                      		  theme_advanced_buttons4 : "",
                      		  theme_advanced_toolbar_location : "top",
                      		  theme_advanced_toolbar_align : "left",
                      		  theme_advanced_path_location : "bottom",
                      		  theme_advanced_disable : "",
                      		  theme_advanced_resizing : false,
                      		  theme_advanced_resize_horizontal : false,
                      		  plugin_insertdate_dateFormat : "%Y-%m-%d",
                      		  plugin_insertdate_timeFormat : "%H:%M:%S",
                      		  button_tile_map : false 
                      
                      	});
                      	function myFileBrowser (field_name, url, type, win) {		
                      		var cmsURL = '/assets/plugins/tinymce303/mcpuk/browser.php?Connector=/assets/plugins/tinymce303/mcpuk/connectors/php/connector.php&ServerPath=/&editor=tinymce3&editorpath=/assets/plugins/tinymce303';    // script URL - use an absolute path!
                      		switch (type) {
                      			case "image":
                      				type = 'images';
                      				break;
                      			case "media":
                      				break;
                      			case "flash": 
                      				break;
                      			case "file":
                      				type = 'files';
                      				break;
                      			default:
                      				return false;
                      		}
                      		if (cmsURL.indexOf("?") < 0) {
                      		    //add the type as the only query parameter
                      		    cmsURL = cmsURL + "?type=" + type;
                      		}
                      		else {
                      		    //add the type as an additional query parameter
                      		    // (PHP session ID is now included if there is one at all)
                      		    cmsURL = cmsURL + "&type=" + type;
                      		}
                      		
                      		tinyMCE.activeEditor.windowManager.open({
                      		    file : cmsURL,
                      		    width : screen.width * 0.7,  // Your dimensions may differ - toy around with them!
                      		    height : screen.height * 0.7,
                      		    resizable : "yes",
                      		    inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
                      		    close_previous : "no"
                      		}, {
                      		    window : win,
                      		    input : field_name
                      		});
                      		return false;
                      	}
                      </script>
                      


                        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                        AugmentBLU - MODX Partner

                        BLUcart - MODX Revolution E-Commerce & Shopping Cart