We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    That is so cooool. Like I said before, I would not be surprised if MM could do this. Thanks I cant wait to test this out grin
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don't know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 19164
      • 1,215 Posts
      I spent some time with my example and found that it is not very good and it is the same as using preview tab. Because in this case we are need to create new document for editing of each gallery.

      So i decided to use preview tab of document where MG called. All that we need is hide all site design and show only Maxygallery. jQuery and MM helps us in this.

      1st. need to create new widget to run custom jQuery code ftom MM.

      In \assets\plugins\managermanager\widgets\ create folder jcustom and file jcustom.php inside it with this code:
      <?php
      
      //---------------------------------------------------------------------------------
      // mm_widget_jcustom
      //--------------------------------------------------------------------------------- 
      function mm_widget_jcustom($code='', $roles='', $templates='') {
      	
      	global $modx, $content;
      	$e = &$modx->Event;
      	
      	if (useThisRule($roles, $templates) && !empty($code)) {
      		$output = "//  -------------- jcustom widget include ------------- \n";
      		$output .= $code;
      	}
      	$e->output($output . "\n");
      }
      
      ?>
      


      Then in MM rules file add this:
      $text = '
      $("#previewIframe").load( function(){
      	cln = $("#previewIframe").contents().find(".managecontainer").clone(); 
      	$("#previewIframe").contents().find("body").replaceWith(cln); 
      });
      ';
      
      mm_widget_jcustom($text);
      


      Add roles and templates as parameters of mm_widget_jcustom() that you needed.

      Add "&manage_gallery=`[*id*]`" to your MG call in this document. This will show normal gallery on the frontend, and only manager form on the backend.

      That’s all.

      BUT it is absolutely not working on IE. May be someone can rewrite this jQuery code to work in IE.
        DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

        Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

        [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
        • 7923
        • 4,213 Posts
        Quote from: Metaller at Sep 20, 2008, 11:07 AM

        I spent some time with my example and found that it is not very good and it is the same as using preview tab. Because in this case we are need to create new document for editing of each gallery.
        To get rid of this, you could simply do one document that uses $_GET to take the gallery ID from query string and then use that to manage all documents..

        eg this in the content:

        [!MaxiGallery? &manage_gallery=`[[GetGalleryID]]` !]

        GetGalleryID:
        <?php
        return $_GET['gal_id'];
        ?>
        


        Then use MM to create a tab with an IFrame and pass the ID of the document that is edited to the iframe url, something like this maybe?

        <?php
        mm_createTab('Edit gallery', 'mygal', '', '', '<iframe src="http://modx/2?gal_id='.$id.'" width="100%" height="500"></iframe>');
        ?>
        


        I don’t know if that $id holds the id of the document that is being edited in MODx manager when that mm_createTab fires up, didn’t look up on what event the plugin runs in, but replace it with what ever is the correct one.. and replace the 2 with the ID of the document that has the MaxiGallery call to manage all galleries. Should work, right?


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 19164
          • 1,215 Posts
          I think about one document to edit all other galleries, but there is one thing. We can’t to edit document fields of our galleries from this doc, only images. So, we must open document with MG call to edit all document fields and then - open gallery editor document to edit images.

          t would be difficult for the customer.
            DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

            Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

            [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
            • 7923
            • 4,213 Posts
            Hmm.. I guess you understood my post wrong.. I’ll try to explain better.

            What I mean is that you would create a new tab to the MODx manager when you edit a document just like in your first example, but the IFrame source would always point to the same document, just pass the id of the gallery to edit in the url query string (see code examples above). Eg. you only need to do one document and that is used when editing all gallery documents in the tab through IFrame.

            So like your first example, but just one MODx document is needed to edit all galleries.


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 19164
              • 1,215 Posts
              I understood. It seems that it is realy simple way to make MM backend manager. I will try it tommorow.

              UPD:

              Here is absolutely working solution. All as in post by doze here http://modxcms.com/forums/index.php/topic,28708.msg176199.html#msg176199 but with small fix.

              1. Create document, hide it from frontend users. Template - blank, uncheck Cacheable. Content:
              [[MaxiGallery? &manage_gallery=`[[GetGalleryID]]` ]]


              2. Create snippet GetGalleryID with this code

              <?php
              if (isset($_GET['mmgal_id']))
              {
              	$id = $_GET['mmgal_id'];
              	session_start();
              	$_SESSION['mmgal_id'] = $id;
              }
              else
              {
              	$id = $_SESSION['mmgal_id'];
              }
              return $id;
              ?>


              As you see, gallery id variable saved in session, because it lost when our frame is reloading after uploading images or changing title/discription.

              3. MM call
              mm_createTab('Gallery', 'mycats', '', '', '<iframe src="http://modx/2/?mmgal_id='.$_GET['id'].'" width="100%" height="500"></iframe>');


              where http://modx/2/ is an URL of the document created in 1st step.

              4. Hide back_to_normal_view button in MG templates. It is not needed in the backend.

              Now i think this thread may be marked as SOLVED smiley
                DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

                Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

                [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
                • 7923
                • 4,213 Posts
                Nice one, thanks for taking the time and working it out! I’ll sticky this for now and put the info in Wiki when I have time..


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 25483
                  • 741 Posts
                  Thanks guys, I will try this code soon when I have some time laugh

                  With this solution people can extend the manager like how they want, just by creating a iframe. I see much posibilities with this, like editing a database table which is linked with the document smiley
                    with regards,

                    Ronald Lokers
                    'Front-end developer' @ h2o Media

                    • 7231
                    • 4,205 Posts
                    Fantastic! Great way to work this out grin
                    I will definitely use this very soon.
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 19509
                      • 1 Posts
                      A poor mans MaxiGallery Module in less than 2 Mins:

                      I found this solultion in this forum Item

                      http://modxcms.com/forums/index.php/topic,28181.msg171314.html#msg171314

                      Which gives you a great MySQL database manager as a module....

                      Since Maxigalley already have a front End Manager all thats needs to be done is
                      Create a new Module and paste this in:

                      $siteurl = $modx->config[’site_url’];
                      header ("Location: $siteurl/link_to_your_Galleries-OR-Gallery");

                      Refresh, then Manage your Galleries as a Module in the Manager

                      Your will probably need to create some admin pages to remove
                      your page chrome