Jump to content

Multisite


apeisa

Recommended Posts

Thanks for your reply, Soma. And also thank you for developing the fantastic Multisite module!

To further test this, I set up a clean installation of ProcessWire 3.0.30, activated link abstraction and put some internal links into the body-fields. Then I dragged and dropped the page branches around the page tree. PW’s link abstraction always correctly modified the links in the body-field.

Then I installed Multisite, and link abstraction unfortunately stopped working. When trying to save a page with any link in the body-field, PW displayed an error message like »Session: Unable to resolve link on page "pagename" in field "body": /link-to-another-page/«.

PW’s link abstraction internally saves page-ids as link-attributes in the database, like this:

<p>This is an <a	data-pwid=1023	href="/child-page-1/grandchild-page-2/">internal link</a>.</p>

When Multisite converts links like »/www.example.com/child-page-1/« to »/child-page-1/«, PW isn't able to recognize them anymore and therefore cannot save the corresponding page-ids to the database. So I assume, link abstraction won't work together with Multisite.

A powerful feature of Multisite is, that editor users see the »real« links in the backend. Modifying the links on page render, as you suggested in a previous post, would confuse those users, because they would see links like »/www.example.com/child-page-1/« in the WYSIWYG-Editors.

The only solution I can think of right now, would be to convert all modified links back to the original links on page save, let link abstraction do it’s work, and modify them again, when displayed in the backend or frontend.

Do you think that would be possible?

Link to comment
Share on other sites

Sorry, there's so many iterations and experiments with this module I can't always recall what the current state is. I'm working on and off on this.

I forgot the current dev still does alter the urls to strip out the domain segment. So as you seen, PW isn't able to resolve the url anymore. This also created various problems not only with link abstraction, but page path history view links etc etc.

Current version I have, works fine here due to NOT rewriting anything in the backend (ready() hooks all commented out + some parsing of the urls on page render). So the only headache free and correct solution is to let them as is. A "/domain1/about/" vs a "/about/" also has some advantage in that it's the physical url and can be recognized and handled in some way if needed while the latter you can't. Domain1 and Domain2 could have both a "/about/" and you don't know which one is which. I guess it's not something we have many options unfortunately.

I'm still testing and working on the new version, but have no ETA.

So this modules is still in "alpha" and each version may not compatible with one or another previous version (also PW versions) and I still do not recommend using it in a important or critical project and only if you're aware of the consequences it may bring (broken links you can hardly recover).

  • Like 1
Link to comment
Share on other sites

Thanks for the detailed explanation of the new module version!

Some time ago, I wrote a simple module for a client website that converted every href-value on page render. It stripped out a certain folder name, i.e. it converted »/container-1/page-1/« to »/page-1/«.

That worked fine, but for my client it caused a really big usability issue in the backend, because they saw the original links in the WYSIWYG-Editor, and not the resulting links.

As much as I understand, the new Multisite version will also leave the original links in the WYSIWYG-Editors, like »/www.example.com/about/« instead of »/about/«.

Do you see any way to just display the »right« links to backend users, while not really altering them?

Link to comment
Share on other sites

1 minute ago, nurkka said:

Thanks for the detailed explanation of the new module version!

Some time ago, I wrote a simple module for a client website that converted every href-value on page render. It stripped out a certain folder name, i.e. it converted »/container-1/page-1/« to »/page-1/«.

That worked fine, but for my client it caused a really big usability issue in the backend, because they saw the original links in the WYSIWYG-Editor, and not the resulting links.

As much as I understand, the new Multisite version will also leave the original links in the WYSIWYG-Editors, like »/www.example.com/about/« instead of »/about/«.

Do you see any way to just display the »right« links to backend users, while not really altering them?

Maybe someone enlighten me here. But unfortunately it's not an easy one. Not one I can think of I would be happy with. Not one that doesn't create all the problems I'm trying to solve or stay away.

The problem with your idea is that it's not the saving and loading of the urls in the RTE but you're talking about the url field you see when selecting a page. That's the page linke editor that works together with a each PW specific RTE plugin editor on top of that. 

1. So, one and easy way would be to alter the $page->url via a hook (as it is now or was), but that's where it will be systemwide changed and many things may and will stop working. Maybe some options there to only alter if-then... but believe me it creates a whole tale of issues that arise in one place or another. Mixing it up with "here you do it but there you don't" etc. 

2. The other would to explore the PageEditLink module and probably only JS side to see if it can be somehow hidden, but by not altering the -in and -output. That would be more a cosmetic fix. I'm sure there would e some way or another, although not that easy. While I understand what you're saying that it creates usability issues, I think it can also create problems if you hide something that's relevant information too. Imagine you only see "/about"/ and "/about/" but which is which? We have lot of editors that edit multiple sites and cross linking should be easy. Maybe best way would be to "grey it out" and make them aware that it's "secondary" info due to multisite.

The other "problem" here is that it would have to be done for all RTE's etc and upcoming link editor plugins. And as it looks one would have to completely replace some of the complex PW RTE plugins and or the link editor js to make it work, and always try to incorporate changes and new features in the core that will occur in no time for sure (and then there's front-end editing).

So it's also a question of how deep this modules should go or stay out of the way and don't create too much dependencies.

Link to comment
Share on other sites

  • 1 month later...

Hi,

I am to decide which CMS to choose for a future project. I have read and tried the MultiSite module, but I think PW won't be the choice, which I regret greatly! I cannot afford too much uncertainty. I love so much PW though! It won't be Drupal. 

I just want to point here a module made for Concrete 5, which I haven't tried yet (I will wait to see if we obtain the contract). That guy seems to have solved all obstacles. Maybe some of you would be inspired by it:  https://www.concrete5.org/marketplace/addons/multiple-domains1. Concrete 5 works differently than PW, but they do share the "tree" approach.

Another solution would be MODX and it's context feature.

Anyway, just my two cents.

Link to comment
Share on other sites

I've used first apeisa's and later on soma's multisite in several installs. Latest versions rocks. Easy by code configurable module. You won't need to be uncertain about the multi site set-up. Not sure about 5.4 php requirement ^_^

Link to comment
Share on other sites

I don't mind paying $80 on a $60000 project, specially if I can get a swift support. I was just pointing some direction. As of sharing same issues, I can't talk about it right now. The main concern is not just the URL redirection, but the permissions associated with a subdomain.

My client asks that a role associated to a subdomain must be able to just edit the pages of that subdomain. There will be 10 subdomains (this is an international site with 10 region subdomains, sharing a lot of information in each site, but having also regional particularities. The only differences as for the templates will be the colour identifying the region). So far, in my understanding of PW, roles permission are template based (or user based with one of Ryan's module). I have seen a Page per role permission module, but it seems not ready for PW3. It's certainly doable to make some coding here to prevent edit pages (from the admin interface, since everybody will see the tree of the organisation).

In Concrete5 you can set permissions to a specific page in a tree and tells that the children share those permissions.

Anyway, Concrete5 and MODx are fine CMS, but I would like to stick to PW if I can, :-) , because the easiness of rendering and searching things, etc.

 

Just a final note. I'm not a program, but I'm part of a team with programmers. Programming things is not the problem. I am responsible to find the right solution for the project.

Link to comment
Share on other sites

33 minutes ago, Guy Verville said:

I don't mind paying $80 on a $60000 project, specially if I can get a swift support. I was just pointing some direction. As of sharing same issues, I can't talk about it right now. The main concern is not just the URL redirection, but the permissions associated with a subdomain.

My client asks that a role associated to a subdomain must be able to just edit the pages of that subdomain. There will be 10 subdomains (this is an international site with 10 region subdomains, sharing a lot of information in each site, but having also regional particularities. The only differences as for the templates will be the colour identifying the region). So far, in my understanding of PW, roles permission are template based (or user based with one of Ryan's module). I have seen a Page per role permission module, but it seems not ready for PW3. It's certainly doable to make some coding here to prevent edit pages (from the admin interface, since everybody will see the tree of the organisation).

In Concrete5 you can set permissions to a specific page in a tree and tells that the children share those permissions.

Anyway, Concrete5 and MODx are fine CMS, but I would like to stick to PW if I can, :-) , because the easiness of rendering and searching things, etc.

 

Just a final note. I'm not a program, but I'm part of a team with programmers. Programming things is not the problem. I am responsible to find the right solution for the project.

Hi, i haven't used ProcessWire in a multisite context but have already used the Admin Restrict Branch module to limit  to a given subpages set of theProcessWire page tree.

Edited by Nicolas
Corrected a typo
  • Like 1
Link to comment
Share on other sites

Thank you to pointing that. This plugin is doing exactly what I was hoping for :-)  After further essays, nope... while the page tree is truncated on login, users have still access to the entire site tree if they click on the page tree icon. I will make other tests.

Link to comment
Share on other sites

@Guy Verville - I would really like to know if Admin Restrict Branch works in multisite mode. I expect it should work just fine.

I use it in what sounds like a very similar situation to yours - I have the same set of pages and templates for regional/project specific branches of the page tree. With that module I simply give everyone access to everything on the home template and let inheritance provide access to all templates below and the module takes care of keeping users completely restricted to their regional branch - they can't even see the other branches (or any other pages outside their specific branch).

If you find any problems in multisite mode please let me know and I'll see what I can do about supporting it.

Link to comment
Share on other sites

18 minutes ago, Guy Verville said:

After further essays, nope... while the page tree is truncated on login, users have still access to the entire site tree if they click on the page tree icon. I will make other tests.

Sounds like something isn't quite right - if I click the page tree icon, they still get the same restricted branch. Are you talking about the icon to the left of "Pages"?

Screen Shot 2016-10-08 at 3.54.01 PM.png

When I click that, I still get the restricted branch in the panel, like so:

Screen Shot 2016-10-08 at 3.55.15 PM.png

Is this what you are talking about, or something else?

Link to comment
Share on other sites

Well, perhaps the first time, I didn't enter the site correctly. I can see the branch, but can't edit anything.

I have created a role "nord" (for north region), which has the page-edit permission. I then created a user with that role only set. When I enter the site with that user, I see only the "nord" branch.

OperaScreenSnapz002.pngOperaScreenSnapz001.png

Link to comment
Share on other sites

2 minutes ago, Guy Verville said:

Sorry, my bad. I forgot to apply correctly the page-edit permission to the template! It works.

OperaScreenSnapz003.png

Nice, although I assume that second screenshot is with superuser logged in since it shows all branches?

PS - don't forget what I mentioned earlier on about just applying access permissions to the home template and no others - if you are using this module it simplifies things a lot.

 

Link to comment
Share on other sites

1 minute ago, Guy Verville said:

it seems to bring cookies problem. I will have to investigate this.

Please let me know what you find out.

 

1 minute ago, Guy Verville said:

I tried to set the restriction by Role, and it does not seem to work. I can edit everything.

Are you talking about the "Role Name" matching option? I think some people haven't understood this option properly. It's what I use all the time for my sites, but to be clear, in your case you'd want the name of the role to be "page-nord" to match the name of the page that is the parent of the branch you are restricting them to. Does that help, or is that what you are already doing? Or maybe you found a bug?

Link to comment
Share on other sites

16 minutes ago, Guy Verville said:

ok, I understand. The role must match the page. The multisite module needs the branches to be set on the url name. For our example, it's nord.pw.local. The role should be then nord.pw.local? 

Addendum: it seems to not work.

I just tested that exact name for the name of the parent page and also the role name and it is working fine here, so it should work for you from what I can tell.

Perhaps a multilanguage issue - is the name of the page in all languages set to nord.pw.local ?

Link to comment
Share on other sites

1 minute ago, Guy Verville said:

Ok, i think I got it. When setting to "Role Name", the root of the site must be select.

Do you mean the "Parent to restrict Role Name and Custom PHP code matches to." setting? 

That setting is completely optional, but the key thing is that obviously it must be above all the branches to be restricted. If your branches to be restricted are direct children of Home, then there isn't much point in this setting. It really only comes into play if they are several levels down as it reduces the page selector to that tree. You can see how it works here: https://github.com/adrianbj/AdminRestrictBranch/blob/15c70b90144fa68cafed0cdbb2d802e5dcfa1f2c/AdminRestrictBranch.module#L236 - see how $branchesParentSelector is defined using the "has_parent" selector.

Anyway, that setting isn't relevant to you and it sounds like you have everything working correctly?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for creating a new measurement object from the sum or difference between two other objects. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.
      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By tcnet
      This module implements the website live chat service from tawk.to. Actually the module doesn't have to do much. It just need to inserted a few lines of JavaScript just before the closing body tag </body> on each side. However, the module offers additional options to display the widget only on certain pages.
      Create an account
      Visit https://www.tawk.to and create an account. It's free! At some point you will reach a page where you can copy the required JavaScript-code.

      Open the module settings and paste the JavaScript-code into the field as shown below. Click "Submit" and that's all.

      Open the module settings
      The settings for this module are located int the menu Modules=>Configure=>LiveChatTawkTo.

       
    • By tcnet
      Session Viewer is a module for ProcessWire to list session files and display session data. This module is helpful to display the session data of a specific session or to kick out a logged in user by simply delete his session file. After installation the module is available in the Setup menu.

      The following conditions must be met for the module to work properly:
      Session files
      Session data must be stored in session files, which is the default way in ProcessWire. Sessions stored in the database are not supported by this module. The path to the directory where the session files are stored must be declared in the ProcessWire configuration which is by default: site/assets/sessions.
      Serialize handler
      In order to transform session data easier back to a PHP array, the session data is stored serialized. PHP offers a way to declare a custom serialize handler. This module supports only the default serialize handlers: php, php_binary and php_serialize. WDDX was dropped in PHP 7.4.0 and is therefore not supported by this module as well as any other custom serialize handler. Which serialize handler is actually used you can find out in the module configuration which is available under Modules=>Configure=>SessionViewer.

      Session data
      The session data can be displayed in two different ways. PHP's default output for arrays print_r() or by default for this module nice_r() offered on github: https://github.com/uuf6429/nice_r. There is a setting in the module configuration if someone prefers print_r(). Apart from the better handling and overview of the folded session data the output of nice_r() looks indeed nicer.

      Links
      ProcessWire module directory
      github.com
    • By Robin S
      Repeater Easy Sort
      Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.
      The module also enhances Repeater Matrix by allowing a colour to be set for each matrix type. This colour is used in the item headers and in the "add new" links, to help visually distinguish different matrix types in the inputfield.
      Screencasts
      A Repeater field

      A Repeater Matrix field with custom header colours

      Easy-sort mode
      Each Repeater/Matrix item gets an double-arrow icon in the item header. Click this icon to enter easy-sort mode.
      While in easy-sort mode:
      The items will reduce in width so that more items can be shown on the screen at once. The minimum width is configurable in the field settings. Any items that were in an open state are collapsed, but when you exit easy-sort mode the previously open items will be reopened. You can drag an item left/right/up/down to sort it within the items. The item that you clicked the icon for is shown with a black background. This makes it easier to find the item you want to move in easy-sort mode. You can click an item header to open the item. An "Exit easy-sort mode" button appears at the bottom of the inputfield. Configuration
      In the field settings for Repeater and Repeater Matrix fields you can define a minimum width in pixels for items in easy-sort mode. While in easy-sort mode the items will be sized to neatly fill the available width on any screen size but will never be narrower than the width you set here.
      In the field settings for Repeater Matrix you can define a custom header colour for each matrix type using an HTML "color" type input. The default colour for this type of input is black, so when black is selected in the input it means that no custom colour will be applied to the header.
      Exclusions
      The easy-sort mode is only possible on Repeater/Matrix fields that do not use the "item depth" option.
       
      https://github.com/Toutouwai/RepeaterEasySort
      https://processwire.com/modules/repeater-easy-sort/
×
×
  • Create New...