Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. I included the unframework Flourish once to validate forms and send emails. Since PW now has validation and required options for inputfields I don't need it anymore. I used codeigniter for some years long before PW but haven't since used it or any other framework as I'm very happy with PW.
  2. Ok think I got a way to change the axis on sortable. Problem was that PW only inits the sortable for list greater than 1. So I got an error with the script that it can't set the "option" prior to initialisation. I made it work with: $sortableLists = $(".InputfieldFileList"); $sortableLists.each(function(){ if($(this).children('li').size() > 1) { $(this).sortable( "option", "axis", "none"); } });
  3. If you installed PW, there's no /site-default/ it is only before the install and it will change to /site/.
  4. I just found why grid sorting doesn't work. It's because Ryan added a axis: 'y' to the sortable init to restrict it to vertical sorting.... If I remove that it works with the sorting. This is what I have added to the inputfields.css of the admin theme. ul.InputfieldFileList{ overflow: hidden; } ul.InputfieldFileList li{ width: 32%; margin-right: 1%!important; float: left;} And this added to the inputfields.js of the admin theme $( ".InputfieldFileList" ).sortable( "option", "axis", "" ); So it does work again. Edit: Ok it does not work to set the option afterwards. I had removed the option in the core so it worked and forgot. Looks like it would have to changed in the InputfieldFile.js in the core to remove the axis: 'y'; Just to note that this might look nice, but since the height of a box isn't fix, once you have a image that has a long title the box will get taller and the floating will get screwed. So you would have to give the li a fixed height. Edit: or to avoid long image names to break one could add this ul.InputfieldFileList li .InputfieldFileName{ width: 150px; display: block; overflow: hidden; white-space: nowrap; float: left; margin-right: 1em;}
  5. The width settings is for the field itself and not for things inside a field. Of course it's possible to overwrite the CSS for image field, you can try it using inspector in chrome for example on the fly. Depends how fit you are with CSS, but this would give an idea what to change (container, li's etc). I tried to float them and add a width, but also you'd need to clear float on the wrapper since PW doesn't have any. But the problem then is that the jquery sortable doesn't work nice with such a floated list. You could add a new css file directly to the admin theme (default.php) or inputfields.css, or through a module to autoload and add your css file.
  6. Name is a special property not a field same as other fields, so you need to tell it what language you want. echo $page->localName($user->language); or echo $page->get("name$user->language");
  7. Without further consideration on if what you do is really a good way to go building forms... Every inputfield has a render method to render the field specific markup then added to field wrappers and the form wrapper as used in the admin. It's possible to get the inputfield markup used my PW: $f = $fields->get("somefield")->getInputField($page, null); $f->attr("value",$page->somefield); echo $f->render();
  8. I already edited the title. But found the 1.9 funny so have kept it. Heh
  9. No you dont have to upgrade anything just deinstall and install the other. Remove what you dont need like the published page field if you used that. Then you configure lang segment on home root page settings. And of course you have to enter all page names for the alternative languages. So if your site is already live you might want to copy the titles to the name fields which could be done with a simple script sitewide. And of course you have to adapt your language switch. Youll find more infos in the module thread.
  10. Just to defend again ImageManager... you can select and insert images in wysiwyg as usual.. just browse the pages and select the image. It's mentioned in the description. Also I don't think it's hard or complicated to copy a tag into the body.. and after saving you'll see the image and can threat it as with all image s in tinymce.. for example change the image or resize it in the editor. But I think people are too scared to even try it so it's a little hard without people testing and giving feedback to further develop it.
  11. Images here is a WireArray and not an regular array.
  12. You misunderstood what I meant with max width. I meant the width of the larger viewport side. So maybe what you have in mind already. It was just a little confusion what the desired result is with all those screenhots . I'm just curious what you plan to do if ratio/orientation changes or if images have extreme ratios? Meaning to calculate the space of the area and resize the images according to that may result in having a image larger than viewport... Well I once I had such a calculation (can't remember exactly) It should be pretty easy to get a max width or height depending on orientation ratio. $vw = 600; $vh = 600; $spacing = 50; $images = array( array(3000,1800), array(2300,2300), array(1500,2000) ); $ratio = $vw/$vh; if($ratio < 1) { // portrait $max = $vw - $spacing; } elseif($ratio > 1){ // landscape $max = $vh - $spacing; } else { // square $max = $vh - $spacing; } foreach($images as $im) { if($im[0] > $im[1]) { // landscape image echo "w: ". $max . " h: " . round($max/$im[0] * $im[1]) . "<br/>"; } elseif($im[0] < $im[1]) {// portrait echo "w: ". round($max/$im[1] * $im[0]) . " h: " . $max . "<br/>"; } else { // square echo "w: ". $max . " h: " . $max . "<br/>"; } } And this would be a area square calculation and you'll quickly see what I mean. $vw = 800; $vh = 600; $images = array( array(3000,1500), array(2300,2300), array(1500,2000) ); $area = $vw*$vh; echo "area: " . $area . "<br/>"; foreach($images as $im) { $r = sqrt($area/($im[0] * $im[1])); $w = floor($im[0] * $r); $h = floor($im[1] * $r); echo "w: ". $w . " h: " . $h . " (area = " . ($w * $h) . ")<br/>"; }
  13. Well the class you hook on is a little special in that it's extending CommentForm, but since it works for all of us except for you. What PW version do you use and PHP version? Can you try hooking page render? $this->addHookAfter("Page::render", $this, 'copyAverageRating'); Works?
  14. Have you at some point added the autoload true when the module was already installed? There's no bug as far as I know as PW wouldn't work at all with all those hooks used in core.
  15. You loose the tinymce input when you change. Yiu need to select tinymce or fckeditor for the textarea under input tab.
  16. Yes the error doesn't occur with stable 2.3. What you mean with normal login practice? Is there also a non normal? The code Ryan posted is as good as it gets. A login is so simple and only one API call is needed to login. So it's not the script thats the problem but PW latest dev version.
  17. 1 + 2 = 3? I understand what you mean but can't really see what the problem is and why not just serve images with a maximal width or height depending on what ratio width and height you have. Hard to explain for reason, there's no bulletproof way, what if you resize the viewport from landscape to portrait?
  18. I just took your code and tested (removed the die() in the init) and it works the "foo" gets displayed after submitting. No idea what problem you got, but there's nothing special about it really. Does the comments and rating work at all for you? Caching?
  19. I get the same error when using custom login form no matter what. Even when using ProcessLogin execute to make the form.
  20. Float works in one installation and not in another, so I avoid it and use integer. (means on one server it saves 10.3 as 10.3 and on the other 10)
  21. No idea, but it works for me. I use same code as yours, can you post your complete module?
  22. This must work, only thing would be if your module isn't autoload.
  23. I havent used this with cache but it should work. You might want to consider using the LanguagePageNames core module that add the loaclized url support more integrated as this module will not be developed further.
  24. Funny thing is I can't even get LoginThrottle to work as there's a bug/logik that won't save the attempts to DB, well it does but they get deleted immediately afterwards I filed a issue on github. https://github.com/ryancramerdesign/ProcessWire/issues/198 Back to your issue. You don't need to do anything if you use custom login form. Regarding the code in SessionLoginThrottle. When there's 3 failed attempts within the defined seconds limit it does: ... if(wire('process') == 'ProcessLogin') parent::error($error); else throw new WireException($error); // ensures the error can't be missed in unknown API usage ... Which means if you don't use ProcessLogin to login, it will throw an Exception not an notice! You know you also can render a login form using echo $modules->get("ProcessLogin")->execute(); But this will also result in a Exception thrown, as it's not really the ProcessLogin process running.
×
×
  • Create New...