We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25899
    • 46 Posts
    Hi every1

    I am trying to change this website into modx, and have come across some problems where I hope that you could help me.

    At this website http://tangun.dk/?id=20 I have the members of our board shown with a picture, name and board function.

    My question is, how do I do this?

    Could I use ditto for this?

    I am very new to modx but making a serious effort to get as far as to finish this new site, using modx.

    Could you assist me in any way, and please be explicit when commenting *am newbie*

    //Carsten
      You don
      • 3749
      • 24,544 Posts
      You could do it with Ditto, but if you just need the grid of pictures and captions + descriptions, I think MaxiGallery might be a better choice.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Jot can also be successfully used for this; a very simple way to maintain a simple list like that. I’ve successfully added an image upload/insert field to a Jot form. This also has a Javascript drag-and-drop reordering feature.

          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 25899
          • 46 Posts
          Quote from: sottwell at Apr 12, 2010, 01:46 AM

          Jot can also be successfully used for this; a very simple way to maintain a simple list like that. I’ve successfully added an image upload/insert field to a Jot form. This also has a Javascript drag-and-drop reordering feature.



          Hi Sottwell

          Is this Jot extension or code available anywhere as it looks interesting?

          //Carsten
            You don
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            It’s not an extension at all; it’s all done in the form tpl. I just more-or-less copied the code from the manager/includes/tmplvars.format.inc.php for the RichText output widget, and for the drag-and-drop sorting I used a custom field "position" and http://www.wil-linssen.com/musings/entry/extending-the-jquery-sortable-with-ajax-mysql/

            The only problem with that is that the fields in the custom table are settings-type fields, so it’s always a character string. The sorting will go "0 1 10 2 3 4..." if you have more than 10 items. So in my AJAX backend that stores the values into the database, I just added 65 to the item’s position number and converted it to a character, so they are A, B, C ..., which will do until you have more than 23 items to sort.

            I suspect you could use the "parent" field, as Jot never did get around to using that, as far as I can tell. It was supposed to allow for threaded commenting, but that never actually was implemented. At any rate, I haven’t had the leisure to test that lately.

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              For the sorting, I added this to the comments tpl after uploading the arrows.png image that comes with the jQuery sortable script (I preferred the name "move.png" as it made it clearer what it was supposed to do)
              [+jot.moderation.enabled:is=`1`:then=`
              	       <img class="handle" src="[(base_url)]assets/snippets/jot/templates/move.png" width="16" height="16" alt="Move item" title="Move Item" border="0" />
                 `:strip+]


              then before my Jot call I added the javascript code
              <script type="text/javascript" src="assets/js/jquery-ui-1.7.1.custom.min.js"></script>
              <script type="text/javascript">
                $(document).ready(function() {
                  $("#commentsAnchor").sortable({
                    handle : '.handle',
                    update : function () {
              		  var order = $('#commentsAnchor').sortable('serialize');
                		$("#info").load("[~211~]?"+order);
                    }
                  });
              });
              </script>
              <span id="info"></span>

              The backend code, (in a snippet called on document #211 which is very plain, blank template, nothing but published, an alias and the snippet tags in the content)
              <?php
              $table = $modx->getFullTableName('jot_fields');
              foreach ($_GET['listItem'] as $position => $item) {
              	$sql = "UPDATE $table SET `content` = '" . chr($position + 65) . "' WHERE `id` = $item AND `label` = 'position'";
                      $modx->db->query($sql);
              }
              ?>
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                For an image field, I added this javascript at the beginning of the resource content
                <script type="text/javascript">
                function OpenServerBrowser(url, width, height ) {
                	var iLeft = (screen.width  - width) / 2 ;
                	var iTop  = (screen.height - height) / 2 ;
                
                	var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
                	sOptions += ',width=' + width ;
                	sOptions += ',height=' + height ;
                	sOptions += ',left=' + iLeft ;
                	sOptions += ',top=' + iTop ;
                
                	var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
                }			
                function BrowseServer(jotId) {
                                window.jotId = jotId;
                	var w = screen.width * 0.7;
                	var h = screen.height * 0.7;
                	OpenServerBrowser('/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/paath/to/webroot/assets/', w, h);
                }
                
                function SetUrl(url, width, height, alt){
                	document.getElementById('wtImage'+window.jotId).value = url;
                }
                </script>
                


                and this to the form
                		<label for="wtImage[+jot.id+]">Image:<br />
                			<input tabindex="[+jot.seed:math=`?+6`+]" name="image" type="text" size="20" value="[+form.field.custom.image:esc+]" id="wtImage[+jot.id+]" /><input type="button" value="Select Image" onclick="BrowseServer('[+jot.id+]')" />
                		</label><br />
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org