Jump to content

Christophe

Members
  • Posts

    688
  • Joined

  • Last visited

Everything posted by Christophe

  1. Hi Bernhard, So, I've copied the code in ready.php (or _ready.php): <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event){ $process = $event->object; $page = $process->getPage(); $user = wire('user'); // limit code to one template and to user role if($page->template != 'planning-child' && !$user->hasRole("membres")) return; $config = wire('config'); $config->styles->append($config->urls->templates . 'styles/membres.css'); }); It doesn't seem to work as it is. I've also tested it with only if(!$user->hasRole("membres")) return; I've tested it in case with $config->styles->append($config->urls->templates-admin . 'styles/membres.css'); as some Back-end/Admin styles are there. Edit: I've just tried with ready.php in /site/templates-admin *** (The insertion of "-" caused problems when I tested the path to /site/templates-admin/styles/membres.css some days ago, so I tried to add some curly braces, etc. at that moment.) I can't see membres.css loaded with the developer tool(s). *** Edit 2: I've just realized after writing the "Edit" that ready.php has to be in /site I think I've put it in /site/templates because I have an _init.php file there...
  2. Can Admin Custom Files be a solution for my problem? Please see https://processwire.com/talk/topic/2074-module-page-edit-field-permission/?p=110990 Users with a restricted role now only can edit 2 fields of a repeater item. But they can remove or add repeater items. I need to hide both "functionalities" with css (or another solution), only for this page with a specific template and when a user with this role is logged-in. Thank you in advance Edit: in this particular case, as this role can only edit pages with this template (that is only for these pages) now, the condition could be only when this role is logged-in.
  3. What would be the simplest way(s) to add the following css rule in order to hide the trash icon and the add an item link (repeater) (for a page with a specific template and) only when a specific role is logged-in?: .fa.fa-trash.InputfieldRepeaterTrash, .InputfieldRepeaterAddLink {display: none !important;} Lastly, I've, for example, created a templates-admin folder and a styles sub-folder, and have done some tests, but it hasn't worked yet. Could I put a condition more or less like this one? (and where/how?): <?php if($this->user->hasRole("membres")) { echo "<link rel='stylesheet' href='/site/templates-admin/styles/membres.css' />"; } ?> Thanks in advance. It's an issue because the users with the role can only edit 2 fields inside the repeater item, but can add or remove a repeater item without any problem.
  4. Hello Adrian, I've done it with Templates recently, I should have been curious enough/(rested and) taken the time to check (again?) if it was also possible with Fields. Thank you for your post. Now only osteopaths' fields can be edited by them. And I've hidden the Settings tab from them thanks to Restrict Tab View. The only (relatively important) thing left now is that they can remove existing (repeater) items, or add some new ones (it doesn't bother if the 3 non-editable fields are required...). I've tried doing something at the repeater(s) level but I've only been able to make it completely hidden (just seeing a list of ids apparently). Edit: perhaps Admin Custom Files is the solution...
  5. _disclaimer.php is now: <!-- This is an anchor toggling the modal --> <a id='dc' href="#disclaimer" data-uk-modal="{bgclose:false,center:true}"></a> <!-- This is the modal --> <div id="disclaimer" class="uk-modal"><div class="uk-modal-dialog"> <div class="uk-modal-header uk-text-center"><h1> <?=$pages->get('/information/disclaimer/')->title?> </h1></div> <?=$pages->get('/information/disclaimer/')->body?> <div class="uk-modal-footer uk-text-center"><a class="uk-modal-close">OK</a></div></div></div> And <script> (function($) { if (localStorage.getItem('isdisclaimerloaded') === null) { $.UIkit.modal('#disclaimer').show(); } localStorage.setItem('isdisclaimerloaded', 1); }(jQuery)); </script> is now in scripts/disclaimer.js I don't know why the modal doesn't want to center vertically as it should.
  6. Hello, For an association website, for a member(s) role I have restricted its users: they can only edit the months pages of the Members section of the page tree. But they could see the other pages (sections). So I've used the Admin Restrict Branch module, so they only see the Members section in the page tree. In the months pages I'm using a repeater to add several "events" to each month. But now, the website "contact" wants only the last two fields in the repeater to be editable by the users with the member(s) role. Is the only way/solution still to use PageTable instead of Repeaters? It's the first time I'm using Repeaters, and I haven't used PageTable yet.
  7. For the moment, I've always used it. I'll have to try it in inline mode also. If needed, I center images in a paragraph with "Styles". I have already aligned images to the left (or the right) of some text, but have found (again) that it can be a problem when displayed on very small screens, perhaps more when the text is justified. Like others, I also use directly the images field to automatically generate a slideshow, an image gallery... with the field inserted in the template file. Concerning the Files field, I've just noticed that it's possible, for example, to drag and drop a pdf file to the ckeditor field. It automatically adds the link, the text being the name_of_the_pdf_file.pdf. If we go to edit the link, we see that Target is already set to "_blank", which I think is good by default. I don't know if I should add this to the Whishlist Forum, but at least with the image management option, I think it would be perfect if it would let the Title field "empty" and just use the Description of the image (Images field) for the alt tag. Without the image management option, it could directly use the Description of the image for the "Title" field. Currently it adds the name_of_the_pdf_file.pdf to the "Title" field, which isn't really necessary. Edit: I've just noticed/realized that it apparently works when there is only one pdf file in the Files field. Because then, even if I click on the pdf link, the "row" is moved instead of the link. It would be nice if, with Shift, Ctrl or something else, we could do it even with multiple files. But I guess it wouldn't be very practical if there were too many files (rows).
  8. Forget (almost) everything I've said :/. It was because I had forgotten that I still had <?php if(!$session->noPop) include("./_disclaimer.php"); $session->noPop = 1; ?>a#dc {display: none; color: transparent;} at the top of home.php. I don't know if it's "good" to mix this with the "script". I was not fixing the correct "version" of the code. I've added the #dc id in _disclaimer.php and have removed the same code in home.php. I'll use a#dc instead of a[href='#disclaimer']: a#dc {display: none; color: transparent;} I've removed "Open". NB: not enough sleep apparently these last days...
  9. I've tried with this code: <script> (function($) { if (localStorage.getItem("isdisclaimerloaded") === null) { $.UIkit.modal('#disclaimer').show(); } localStorage.setItem('isdisclaimerloaded', 1); }(jQuery)); </script> It seems to work. But after clearing the cache and reloading the page what happens is that the "Open" link that is normally hidden (#dc {display: none;) appears at the top left corner of the browser window. In fact, id='dc' is not longer in the anchor tag at that moment. It is removed apparently. The page has to be reloaded a second time for it to disappear. It works also when going on another page and coming back of course. It seems "logical" because of the #disclaimer id. Any "trick" to not have the link visible on the first page load? NB: cookies would perhaps be better for "old" browsers Edit: I have "Uncaught SyntaxError: Unexpected identifier". At least with webkit browsers. I'm adding a[href='#disclaimer'] {display: none; color: transparent;} I also want to simply remove the "Open" text between the anchor tags but it doesn't seem to want to disappear in the developer tools (for the moment).
  10. I've just copied it from https://yootheme.com/support/question/79225 after having done a quick search . This time I haven't really tried to understand (for the moment) what I've copied. It's all new to me. Perhaps it's easy to add some thousand seconds before it "reloads" again? "I was really surprised why you are asking this when you are developing awesome modules with ajax field reloading at the same time" Are you talking about the last "script" I added? Or are you talking about another Christophe? NB: I've changed the script to (function($) { $.UIkit.modal('#disclaimer').show(); }(jQuery)); as it is at the very bottom of the page.
  11. Ok, so now I have this at the bottom of home.php: <?php // This is an anchor toggling the modal echo "<a id='dc' href=\"#disclaimer\" data-uk-modal=\"{bgclose:false,center:true}\">Open</a>"; // This is the modal echo "<div id=\"disclaimer\" class=\"uk-modal\"><div class=\"uk-modal-dialog\">"; echo "<div class=\"uk-modal-header uk-text-center\"><h1>{$pages->get('/informations/disclaimer/')->title}</h1></div>"; echo $pages->get('/informations/disclaimer/')->body; echo "<div class=\"uk-modal-footer uk-text-center\"><a class=\"uk-modal-close\">OK</a></div></div></div>"; ?> <?php include('./_foot.php'); // include footer markup ?> <script> jQuery(document).ready(function($) { $.UIkit.modal('#disclaimer').show(); }); </script> It works well apparently. I still need it not to bother the visitor if he/she comes back on the homepage: cookie, session... Does somebody know how to do this?
  12. Hello, I have the code: <?php // This is an anchor toggling the modal echo "<a href=\"#disclaimer\" data-uk-modal=\"{bgclose:false,center:true}\">Open</a>"; // This is the modal echo "<div id=\"disclaimer\" class=\"uk-modal\"><div class=\"uk-modal-dialog\">"; echo "<div class=\"uk-modal-header uk-text-center\"><h1>{$pages->get('/informations/disclaimer/')->title}</h1></div>"; echo $pages->get('/informations/disclaimer/')->body; echo "<div class=\"uk-modal-footer uk-text-center\"><a class=\"uk-modal-close\">OK</a></div></div></div>"; ?> It works as in modal.html if inserted in home.php. But of course, I need the modal dialog to appear when the homepage loads, and the "Open" link to be hidden, for example. And, if the visitor comes back on the homepage, I guess it's better if he doesn't see it again (cookie, session...?). How could I do this (where to put the code(s), etc.)? I've never done such a thing myself.
  13. Ok. Thanks. I was wondering if it could be anything else. I have added some code in a _disclaimer.php file and in home.php. But, I'm now trying to make the modal dialog work (like on the modal.html page) in the homepage itself first. For the moment, I'm not sure how to make the modal dialog appear on top of the homepage at page load. And if I'll need to hide the "open" button, or won't need it at all.
  14. Hello, For a ProcessWire 2.7.2 website, I need to add a Disclaimer pop-up when the homepage is loaded. I'm using UIkit, and so I want to use the modal componant: http://getuikit.com/docs/modal.html I'll try to create a pop-up with several options from this modal.html web page. Do you think <?php if(!$session->noPop) include("./popup.inc"); $session->noPop = 1; ?> would still work? What is noPop, is it in the core? I guess I could also use something like _popup.php or _disclaimer.php. Where is the best place to insert it? At the top of the homepage template file? And what if I have a hidden Disclaimer page in the back-end? Has someone already done it with UIkit? When a visitor clicks on the "validation" button, the modal has to disappear of course. Thanks in advance for your help!
  15. Could something similar to foreach($pages->find('parent.template=templatename, sort=sort') as $writer) { be of some use? I had to use it recently.
  16. Can you paste the content of your mystyles.js here? No comma is missing, and you don't have a comma at the end? It already happened to me while adding or changing (the order of) some lines. I had the same problem as yours at least once, if I remember well, or perhaps it was a variant, but I don't remember what was the problem.
  17. Hello, Do the related css rules already exist? And, in Admin > Setup > Fields > Edit Field: body (or another field), and then in the "Input" tab, have you allowed new classes, etc. in "Extra Allowed Content", so that CKEditor doesn't remove them?
  18. Hello, Could you paste here the source code, before and after pasting it in CKEditor (you can save the page, or you can normally just "validate" the source code window and then come back to the same window to copy the code)? Does you code contain divs? By default div tags are converted to paragraph tags normally. For each field like this one, you have to authorize in its settings the use of particular classes, etc. And, you can customize a Style drop-down list in CKEditor. Example Admin > Setup > Fields > Edit Field: body, and then in the "Input" tab: Extra Allowed Content Custom Editor JS Styles Set I've had to customize all this in order to use UIkit specific markup in at least the (CKEditor) Body field. NB: is it what you are really seeing in your Summary and Body fields, or is the image altered (for privacy purposes...)?
  19. Thanks. I'll try this (and the module) one day.
  20. I've decided not to recreate the English language, to not take the "risk". I don't really need it. And I'm not sure if I want to test changing the language to "Català" (perhaps with another user). I only need it (perhaps) later for the front-end.
  21. I had the English language's status "Hidden" and have unchecked it to see if it could be the cause, in case, and this is appearing at the top of the page: Session: Modification : status Session: Page enregistrée : /prcsswr/setup/languages/en/ (1 changement) LanguageSupport: Refreshing other language page IDs Languages: language en is missing column pages.name1051 Pages: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1051' in 'where clause' Languages: language en is missing column field_title.data1051 Pages: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1051' in 'field list' I think I'm going to delete this language and recreate it to see if it changes anything. Edit: after hitting the Delete button (in French) I now have: Notice: Undefined property: User::$language in /home/xyz/www/wire/modules/LanguageSupport/LanguageSupportFields.module on line 289 Notice: Undefined property: User::$language in /home/xyz/www/wire/core/PageFinder.php on line 1006 Notice: Undefined property: User::$language in /home/xyz/www/wire/modules/LanguageSupport/LanguageSupportFields.module on line 289 Notice: Undefined property: User::$language in /home/xyz/www/wire/core/PageFinder.php on line 1006 Notice: Undefined property: User::$language in /home/xyz/www/wire/modules/LanguageSupport/LanguageSupportFields.module on line 289 Notice: Undefined property: User::$language in /home/xyz/www/wire/core/PageFinder.php on line 1006 Notice: Trying to get property of non-object in /home/xyz/www/wire/modules/LanguageSupport/Languages.php on line 390 Notice: Trying to get property of non-object in /home/xyz/www/wire/modules/LanguageSupport/Languages.php on line 390 Notice: Trying to get property of non-object in /home/xyz/www/wire/modules/LanguageSupport/Languages.php on line 390 Notice: Trying to get property of non-object in /home/xyz/www/wire/modules/LanguageSupport/Languages.php on line 390 Catchable fatal error: Argument 1 passed to Pages::cache() must be an instance of Page, boolean given, called in /home/xyz/www/wire/core/Pages.php on line 448 and defined in /home/xyz/www/wire/core/Pages.php on line 1891 Recoverable Fatal Error: Argument 1 passed to Pages::cache() must be an instance of Page, boolean given, called in /home/xyz/www/wire/core/Pages.php on line 448 and defined (line 1891 of /home/xyz/www/wire/core/Pages.php) This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged. I'm not sure what I'm going to do/decide now... After refreshing the page it's now: Session: Page supprimée : /xxx/setup/languages/en/ Session: Updated language en (deleted) Session: deletePageField, Page:1051, Field:language_files_site Session: deletePageField, Page:1051, Field:language_files Session: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'name1051_parent_id'; check that column/key exists Other refresh: no more top message(s)... (but do I have to drop 'name1051_parent_id' manually(?)...) Edit: 'name1051_parent_id' doesn't exist, so...
  22. Strange, yes... I have 4 users currently : superuser, "moderate" permissions user, "very limited" permissions user, and guest. superuser and "moderate" permissions user already existed (their name and password were changed). As I've mentioned above, the only one appearing seems to be the superuser (1134) for which I've just changed the language. The website is hosted at OVH, so I can view a backup from 1 day or 7 days before (snapshots) via PHPMyAdmin. I'm about to look. Edit: yesterday, only the language code was different. Seven days before, there was no database... I'm going to import another backup made yesterday before the upgrade to 2.7.2 via the Upgrades module, but chances are that it will show the same information.
  23. I have a "41" only in Table: field_language_files. In Table: field_language, in fact, I only have: pages_id data sort Textes complets 1134 1051 0 Effacer Effacer Copier Copier Modifier Modifier 1051 being English. I'm clueless... (for the moment) Edit: so 1134 would be the superuser's new id (as I changed its username and password)... As it wasn't 41, I wasn't sure before if it was there that I had to make the modification. I've just changed it to 1048 and now it's working again. Perhaps I should recreate the English language to see if it changes something...
  24. I'm going to try but I'm not sure how to do this. There are perhaps several places where the changes have to be made. Edit: I don't find where/how the "relations" between the users ("name" or id?) and the languages ("name" or id?) are stored for the moment.
×
×
  • Create New...