Dec 04, 2008, 03:40 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Poll
Question: Is the FDM working for you ?
Yes - 47 (81%)
No - 11 (19%)
Total Voters: 58

Pages: 1 ... 28 29 [30] 31 32 ... 34   Go Down
  Print  
Author Topic: [snippet] Front End Document Manager (FDM) v0.1b  (Read 78776 times)
0 Members and 1 Guest are viewing this topic.
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #435 on: Aug 29, 2008, 10:57 AM »

Not with any certainty. You could query the database and determine the last auto-generated ID, and presume that this document would be the next, but there's no way to insure that would be the case.

It would be possible to create a new, empty document, then use that ID, and use the form's POST value to update the newly created document.
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
insert_nick
Member
**
Posts: 71



WWW
« Reply #436 on: Aug 30, 2008, 05:52 AM »

It would be possible to create a new, empty document, then use that ID, and use the form's POST value to update the newly created document.

This is somehow blurred in my mind, but I will try. Thanks for your suggestion, any help in this direction will be appreciated (e.g. a short tutorial to accomplish that and have certainty)
Logged
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #437 on: Aug 30, 2008, 06:25 AM »

I don't know about a tutorial, but what would have to happen is that the modified FDM snippet would have to create a new document as its first function, and collect the new ID, then generate the form. The new ID could be passed on as a hidden input field's value in the form so the submission of the form would have it, and the processing of the submitted POST values would use that submission to update the document (using that id) instead of inserting a new document.

Probably the best thing to do would be to use the $modx->setPlaceholder() function to store the new ID in the placeholder array as soon as the new document is created, then access it as you wish via the $modx->getPlaceholder() function.

Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
insert_nick
Member
**
Posts: 71



WWW
« Reply #438 on: Aug 30, 2008, 06:51 AM »

Ok, now it's a little more clear. Of course the modified FDM will have to delete the created document when the user presses the Cancel button, but if the user just presses the browser's back button it's a problem, as an orphan document will remain laying there. This is not very good, so I'll find other ways to accomplish what I want, avoiding the need to anticipately know the will-be-created document id. Thanks.
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #439 on: Sep 03, 2008, 12:44 PM »

I do now have another issue which I didn't have before. Every new page now always has the menu index of the model document when it is created, but perhaps it is one of my changes that has done this, but I can't figure out why.

Michal.

EDIT: I have fixed this using the following code that I placed in fdm.class.inc.php, in the fillDoc function, near the top, in the block that starts with if ($_SESSION['fdm']['action']=='add' )
Code:
// Set maxindex to be one greater than other indices
$parentID = $_SESSION['fdm']['parent'];
$siblingIndices = $modx->getAllChildren($parentID,'menuindex','ASC','menuindex');
$maxIndex = $siblingIndices[sizeof($siblingIndices)-1]['menuindex'];
$docObj->Set('menuindex',$maxIndex + 1);


Hey Michal thanks a lot for that piece of code!!
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #440 on: Sep 08, 2008, 03:35 PM »

Hi Smiley

I think FDM should have its own folder.  It's getting harder to accumulate all the posts in this sole thread.

Well I have a couple of proplems, I hope someone can help:

1) TinyMCE won't load after a posting:  suppose you are creating a new document with TinyMCE enabled for the content.  Let's say you submit the new document, but you forgot to fill a required field.   An error messager will appear, but TinyMCE won't load anymore!.   I checked the source code and the these lines are missing:
Code:
<script language="javascript" type="text/javascript" src="assets/plugins/tinymce3101/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">

// Configuration detail check http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
tinyMCE.init({
etc
etc
etc

Do you have the same problem?  How can we solve it?

2) Duplicaded rows on table site_tmplvar_contentvalues:  Well, this one is not really a problem I guess, but I noticed that every time a new document is created, the data inserted on table site_tmplvar_contentvalues is being duplicated (double inserted).  Something like this:
idtmplvaridcontentidvalue
752   18170hi there
753   19170hello
754   18170hi there
755   19170hello

At first, this duplication looks like an error.  I don't know if it's afffecting the behavior of the documents, because so far I didn't notice any problem.   What do you think?

Please, your help will be appreciated.

Mc
Logged
Paprikas
Member
**
Posts: 96


RA3!


« Reply #441 on: Sep 08, 2008, 04:47 PM »

2mcclausky
I'm using Tiny + FDM by inserting my Tiny JS code into fdmEform chunk.
be happy  Grin
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #442 on: Sep 08, 2008, 06:25 PM »

2mcclausky
I'm using Tiny + FDM by inserting my Tiny JS code into fdmEform chunk.
be happy  Grin

Yes, I did exactly that.  It works just fine when the page loads.  But if you forget a required field, and the page posts back, then TinyMCE just doesn't load anymore.
Logged
Paprikas
Member
**
Posts: 96


RA3!


« Reply #443 on: Sep 08, 2008, 06:55 PM »

Yes, I did exactly that.  It works just fine when the page loads.  But if you forget a required field, and the page posts back, then TinyMCE just doesn't load anymore.
Ok. can you show me your fdmEform chunk?

My chunk:
Code:
<script language="javascript" type="text/javascript" src="/assets/plugins/tinymce3101/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "exact",
    theme : "advanced",
    elements : "content",
    plugins : "safari,style,layer,table,advhr,advimage,advlink,iespell,insertdatetime,media,searchreplace,paste,fullscreen,visualchars,nonbreaking,pagebreak",
    theme_advanced_buttons1_add_before : "newdocument,separator",
    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
    theme_advanced_buttons2_add : "separator,insertdate,inserttime,separator,forecolor,backcolor",
    theme_advanced_buttons2_add_before: "pastetext,pasteword,separator,search,replace,separator",
    theme_advanced_buttons3_add_before : "tablecontrols,separator",
    theme_advanced_buttons3_add : "iespell,media,advhr,separator,fullscreen",
    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,attribs,|,visualchars,nonbreaking,pagebreak,|,insertfile,insertimage",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    plugin_insertdate_dateFormat : "%Y-%m-%d",
    plugin_insertdate_timeFormat : "%H:%M:%S",
    external_link_list_url : "/assets/plugins/tinymce3101/tinymce.linklist.php",
    theme_advanced_resize_horizontal : false,
    theme_advanced_resizing : true,
    language : "ru",
    height : "300",
    width : "100%",
   
    relative_urls : true,
    document_base_url : "/",
    convert_urls : false,
    pagebreak_separator : "<!-- splitter -->",
   
    file_browser_callback : "myFileBrowser",
    apply_source_formatting : true
});
function myFileBrowser (field_name, url, type, win) {
    var cmsURL = '/manager/media/browser/mcpuk/browser.php?Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/&editor=tinymce3&editorpath=/assets/plugins/tinymce3101';
    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 : "no",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous : "no"
    }, {
        window : win,
        input : field_name
    });
    return false;
}
</script>
[+validationmessage+]
<form method="post" action="[~[*id*]~]"  id="fdmForm">
  <input type="hidden" name="formid" value="fdmForm" />
  <input type="hidden" name="fdmid" value="[+fdmid+]" eform="::0::" />
  Pagetitle:<br />
  <input name="pagetitle" id="pagetitle" value="[+pagetitle+]" type="text" size="80" class="inputs" eform="Pagetitle:string:1" /><br />
   Content:<br />
  <textarea name="content" id="content" rows="5" cols="61" class="inputs" eform="Content:html:1">[+content+]</textarea><br />
  <input name="fdmsubmit" value="Send" type="submit" />
</form>
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #444 on: Sep 08, 2008, 11:01 PM »

Sure,

Here's the FDM call:
Code:
[!FDM? &parent=`[*parent*]` &disableedit=`1` &disablepublish=`1` &disableunpublish=`1` &disabledelete=`1` &model=`149`  &editorpageid=`137` &id=`137` &eform_tpl=`McfdmEform_Events` &canpost=`Web - Site Admins` &script=`loadTinymce`  !]

Here's the McfdmEform_Events template chunk:
Code:
[+validationmessage+]
<form method="post" action="[~[*id*]~]"  id="fdmForm">

<input type="hidden" name="formid" value="fdmForm" />
<input type="hidden" name="fdmid" value="[+fdmid+]" eform="::0::" />
  <h1>New Event</h1>
    <br>
        Event Name:<input name="pagetitle" type="text" id="pagetitle" value="[+pagetitle+]" size="35" eform="Name cannot be empty:string:1" />
        <br>
  Event Start Date:
  <input name="tvEasyEvents_Start" id="tvEasyEvents_Start" value="[+tvEasyEvents_Start+]" type="text" readonly="readonly" eform="Start Date cannot be empty:string:1" />
<a href="#" onClick="javascript: displayCalendar('tvEasyEvents_Start');" title="Click to display calendar">
        <img align="absmiddle" src="manager/media/calendar/img/cal.gif" width="16" height="16" border="0" alt="Click to display calendar" /></a>
        <a href="#" onClick="document.forms['fdmForm'].elements['tvEasyEvents_Start'].value=''; return true;" >
        <img align="absmiddle" src="manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" border="0" alt="Click to erase date"></a>
        <br>
 Event End Date:
  <input name="tvEasyEvents_End" id="tvEasyEvents_End" value="[+tvEasyEvents_End+]" type="text" readonly="readonly" />
        <a href="#" onClick="javascript: displayCalendar('tvEasyEvents_End');" title="Click to display calendar">
        <img align="absmiddle" src="manager/media/calendar/img/cal.gif" width="16" height="16" border="0" alt="Click to display calendar" /></a>
        <a href="#" onClick="document.forms['fdmForm'].elements['tvEasyEvents_End'].value=''; return true;" >
      <img align="absmiddle" src="manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" border="0" alt="Click to erase date"></a>
        <br>
        <br>
  Hide time:
  <select name="tvEasyEvents_HideTime" id="tvEasyEvents_HideTime">
      <option value="">NO</option>
      <option value="Hide">YES</option>
  </select>
  <br>
  CONTENT:
  <textarea name="content" cols="55" rows="15" id="content" eform="Content cannot be empty:html:1">[+content+]</textarea>
  <br>

    <input name="fdmsubmit" value="Publish Event" type="submit" />
    <a href="[~[*parent*]~]" tile="Cancel">Cancel</a> 

</form>



<script language="JavaScript" src="manager/media/script/datefunctions.js"></script>
<script type="text/javascript">
function displayCalendar(fieldName)
{
var elm_txt = {}; // dummy
var pub = document.forms["fdmForm"].elements["" + fieldName + ""];
var nwpub_cal1 = new calendar1(pub,elm_txt);
nwpub_cal1.path="[(base_url)]manager/media/";
nwpub_cal1.year_scroll = true;
nwpub_cal1.time_comp = true;
nwpub_cal1.popup();
}

</script>



And....here's the loadTinymce chunk:
Code:
<script language="javascript" type="text/javascript" src="assets/plugins/tinymce3101/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">

// Configuration detail check http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
tinyMCE.init({
theme : "advanced",
mode : "exact", // textareas:    Converts all textarea elements to editors when the page loads. exact: Converts elements of the specified names, as listed in the elements option.
// This option should contain a comma separated list of element id's to convert into editor instances. This option is only used if mode is set to "exact".
// ie: elements : "elm1,elm2"
       elements : "content",
       relative_urls : true,
       external_link_list_url : "[(base_url)]assets/plugins/tinymce3101/tinymce.linklist.php",
       file_browser_callback : "myFileBrowser",
       theme_advanced_toolbar_location : "top",
       theme_advanced_toolbar_align : "left",
       theme_advanced_statusbar_location : "bottom",
       plugins : "style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media,table",
       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,code",
       theme_advanced_buttons2 : "bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,table,forecolor,backcolor,styleprops",
       theme_advanced_buttons3 : "styleselect,formatselect,fontselect,fontsizeselect"
});

function myFileBrowser (field_name, url, type, win) {
       var cmsURL = '/manager/media/browser/mcpuk/browser.php?Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/&editor=tinymce3&editorpath=/assets/plugins/tinymce3101';

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>


Thanks.

Mc
Logged
Paprikas
Member
**
Posts: 96


RA3!


« Reply #445 on: Sep 09, 2008, 05:32 AM »

And??
I wrote
Quote
I'm using Tiny + FDM by inserting my Tiny JS code into fdmEform chunk.
Kill &script=`loadTinymce`
Kill loadTinymce chunk.
Move code frome loadTinymce chunk to McfdmEform_Events!!
Something like this:
Code:
<script language="javascript" type="text/javascript" src="assets/plugins/tinymce3101/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">

// Configuration detail check http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
tinyMCE.init({
theme : "advanced",
mode : "exact", // textareas:    Converts all textarea elements to editors when the page loads. exact: Converts elements of the specified names, as listed in the elements option.
// This option should contain a comma separated list of element id's to convert into editor instances. This option is only used if mode is set to "exact".
// ie: elements : "elm1,elm2"
       elements : "content",
       relative_urls : true,
       external_link_list_url : "[(base_url)]assets/plugins/tinymce3101/tinymce.linklist.php",
       file_browser_callback : "myFileBrowser",
       theme_advanced_toolbar_location : "top",
       theme_advanced_toolbar_align : "left",
       theme_advanced_statusbar_location : "bottom",
       plugins : "style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media,table",
       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,code",
       theme_advanced_buttons2 : "bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,table,forecolor,backcolor,styleprops",
       theme_advanced_buttons3 : "styleselect,formatselect,fontselect,fontsizeselect"
});

function myFileBrowser (field_name, url, type, win) {
       var cmsURL = '/manager/media/browser/mcpuk/browser.php?Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/&editor=tinymce3&editorpath=/assets/plugins/tinymce3101';

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>
[+validationmessage+]
<form method="post" action="[~[*id*]~]"  id="fdmForm">

<input type="hidden" name="formid" value="fdmForm" />
<input type="hidden" name="fdmid" value="[+fdmid+]" eform="::0::" />
  <h1>New Event</h1>
    <br>
        Event Name:<input name="pagetitle" type="text" id="pagetitle" value="[+pagetitle+]" size="35" eform="Name cannot be empty:string:1" />
        <br>
  Event Start Date:
  <input name="tvEasyEvents_Start" id="tvEasyEvents_Start" value="[+tvEasyEvents_Start+]" type="text" readonly="readonly" eform="Start Date cannot be empty:string:1" />
<a href="#" onClick="javascript: displayCalendar('tvEasyEvents_Start');" title="Click to display calendar">
        <img align="absmiddle" src="manager/media/calendar/img/cal.gif" width="16" height="16" border="0" alt="Click to display calendar" /></a>
        <a href="#" onClick="document.forms['fdmForm'].elements['tvEasyEvents_Start'].value=''; return true;" >
        <img align="absmiddle" src="manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" border="0" alt="Click to erase date"></a>
        <br>
 Event End Date:
  <input name="tvEasyEvents_End" id="tvEasyEvents_End" value="[+tvEasyEvents_End+]" type="text" readonly="readonly" />
        <a href="#" onClick="javascript: displayCalendar('tvEasyEvents_End');" title="Click to display calendar">
        <img align="absmiddle" src="manager/media/calendar/img/cal.gif" width="16" height="16" border="0" alt="Click to display calendar" /></a>
        <a href="#" onClick="document.forms['fdmForm'].elements['tvEasyEvents_End'].value=''; return true;" >
      <img align="absmiddle" src="manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" border="0" alt="Click to erase date"></a>
        <br>
        <br>
  Hide time:
  <select name="tvEasyEvents_HideTime" id="tvEasyEvents_HideTime">
      <option value="">NO</option>
      <option value="Hide">YES</option>
  </select>
  <br>
  CONTENT:
  <textarea name="content" cols="55" rows="15" id="content" eform="Content cannot be empty:html:1">[+content+]</textarea>
  <br>

    <input name="fdmsubmit" value="Publish Event" type="submit" />
    <a href="[~[*parent*]~]" tile="Cancel">Cancel</a> 

</form>



<script language="JavaScript" src="manager/media/script/datefunctions.js"></script>
<script type="text/javascript">
function displayCalendar(fieldName)
{
var elm_txt = {}; // dummy
var pub = document.forms["fdmForm"].elements["" + fieldName + ""];
var nwpub_cal1 = new calendar1(pub,elm_txt);
nwpub_cal1.path="[(base_url)]manager/media/";
nwpub_cal1.year_scroll = true;
nwpub_cal1.time_comp = true;
nwpub_cal1.popup();
}

</script>
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #446 on: Sep 09, 2008, 08:47 AM »

And??
I wrote
Quote
I'm using Tiny + FDM by inserting my Tiny JS code into fdmEform chunk.

Sorry, I didn't read your first post properly.   Thanks for your suggestion, it works! Cheesy

Mc
Logged
mcclausky
Full Member
***
Posts: 147



« Reply #447 on: Sep 09, 2008, 09:28 PM »

I got another question Smiley

Is it possible to create a document that has Jot comments?    I mean a document with the following output:

The output: Generated Content
[!Jot!]

so the created page will work like a blog.   For instance, I remember the NewsPublisher snippet had a parameter &footertpl where we could specify any chunk that would be part of the final output.   Is there anything similar in FDM?   

Thanks in advance!

Mc
« Last Edit: Sep 10, 2008, 09:03 AM by mcclausky » Logged
Lizard
Support Subscriber
*
Posts: 251


« Reply #448 on: Sep 10, 2008, 08:41 AM »

OK got this working great now, One peoblem .. I am seeing @CODE nest to the button, I have the latest version of Chunkie .. can anyone help please?  many thanks Smiley

Martyn
Logged
tkfm
Committed to MODx
*****
Posts: 624


WWW
« Reply #449 on: Sep 10, 2008, 09:32 PM »

OK got this working great now, One peoblem .. I am seeing @CODE nest to the button, I have the latest version of Chunkie .. can anyone help please?  many thanks Smiley
I'm not sure what you mean by "I have the latest version of Chunkie", but there's a conflict of Chunkie class when used with Jot.
As described here, you have to modify the chunkie class name of FDM.
Quote
Change all instances to the word "CChunkie" in /snippets/FDM/includes/fdm.class.inc.php and /snippets/FDM/includes/fdmchunkie.class.inc.php to "fdmCChunkie".
Logged
Pages: 1 ... 28 29 [30] 31 32 ... 34   Go Up
  Print  
 
Jump to: