Jump to content

hellomoto

Members
  • Posts

    333
  • Joined

Everything posted by hellomoto

  1. Apparently it's due to some customizing I did to ProcessChangelog, somehow... I only tried to add views to the records...
  2. If attempted on pages admin view, simply loads forever; if on page edit, reloads the page editor URL as blank. On dev branch
  3. I was able to add pageviews before and now on a fresh install of PW3 without the previous successful attempt to draw from, here's what I have for ProcessChangelogHooks.module: Somehow with this I'm unable to publish or unpublish pages; if attempted on the pages admin view it just loads forever, on the page editor it reloads the editor blank and doesn't work.
  4. I have these fields: availability, date_sold, price_sold. availability is a page field. The parent page of the selectable pages is also called availability. date_sold and price_sold are both set to Visibility: Open, with Show This Field Only If set to availability.title=sold, charter=0 (charter is a checkbox). The charter inputfield dependency works, but not the availability. I've tried availability=sold and availability.name=sold as well. Am I missing something? Please help, thanks much.
  5. Damn, not sure how I feel about these results... Okay so of course, the specs: PW 2.6.1. Uploads do work on desktop no problem. I have not tried on an iPhone, don't have access to one, but on my phone I get the following error: song title • song title is a invalid extension, please use one of: mp3, zip That's in Chrome, on Android 5.0 (Samsung Galaxy S5 Active). On my friend's phone (who this is for) the Choose File button doesn't even do anything. He's using the Internet app on Android 4.4.2 (Alcatel OneTouch Fierce). I don't know what else I can do to troubleshoot this... I tried unchecking the decompress zip files option, not thinking it would do anything and it was indeed no help. Any ideas are very much welcome and appreciated! We're traveling and he's got unlimited data on his phone, so mobile upload capability would greatly help given our situation. The screen where I select songs from when clicking Choose File doesn't show their extensions, but when I go to browse my files on my phone and go to the audio ones, all the same files are there listed with the mp3 extension.
  6. I'm surprised there've been no replies... but more surprised that I can't find anything else on this topic, I would think this would concern people. Bumpin
  7. I can't find anything about this in the forums or anything, but I have a file field that accepts mp3 files. Trying to upload from an Android phone (I've tried from two) the files aren't accepted, it says they must be mp3 files, but they are, so it's not reading the file extensions I guess... The error names the file name without the extension saying it's missing the extension. Has anyone come across this? Thanks.
  8. My Small Module: class CalendarEventsCustom extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Calendar Events Custom', 'version' => 1, 'summary' => 'Renames subevents', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => '', ); } public function init() { $this->pages->addHookBefore('save', $this, 'nameEvents'); } protected function nameEvents($event) { $page = $event->arguments[0]; $sanitizer = wire('sanitizer'); if($page->template == 'calendar-event') $page->name = wireDate('Y-m-d',$page->calendar_event_start) . '/' . $sanitizer->pageName($page->title, true); elseif($page->template == 'calendar-event_instance') $page->name = wireDate('Y-m-d',$page->calendar_event_start); // if calendar_start_date != rrule don't publish } } It'll probably be of no help to you, and anyway as it turns out, of course I was just confused and checking the wrong parent template's settings. Name format for children was not set where it was supposed to be. If you want to disable a certain notification then it sounds to me like you're on the right track... What message are you trying to get rid of?
  9. For my event template I have tried setting the Name format for children as title and date, respectively, as those are the only two I've ever gotten to work with that. So I do have a small module that renames them before save, to Y-m-d-title, but I can't manage to get adding an event from the admin the standard way to skip the Page Add step with the Title and Name generation. Not only that but it always displays the warnings for Name Already taken, which I don't want, as they're organized by date... Admin users don't need to see "The name entered is already in use. If you do not modify it, the name will be made unique automatically after you save.". How can I bypass this? Thanks.
  10. Well yes... The page was created by the superuser account, but it needs to be editable by all with the uploader role. According to what you're saying it sounds like they should be able to, but like I said, they cannot... They haven't permission...
  11. I am trying to build on lindquist's Calendar module just to get a working demo of some additional features I would eventually like to somehow implement in a more solid way, such as overriding the default info for a recurring event for some instances. Here is my events template: <?php $scriptsHead[] = $config->urls->templates."js/moment.min.js"; $scriptsHead[] = $config->urls->templates."js/fullcalendar.min.js"; $styles[] = $config->urls->templates."css/fullcalendar.min.css"; $content .= '<div id="calendar" style="width:100%"></div>'; $calendar = wire('modules')->getModule('Calendar'); // get current/upcoming events -1:+6 months $start = new DateTime(); $until = new DateTime(); $start->sub(new DateInterval('P1M')); $until->add(new DateInterval('P6M')); $events = $calendar->expandEvents($start, $until); //$start = strtotime($start); $start = $start->format('Y-m-d H:i'); $until = $until->format('Y-m-d H:i'); function eventsToJSON($events, $start, $until) { $items = array(); $ids = array(); $idx = 0; foreach($events as $event) { $pages = wire('pages'); $eid = $pages->get($event->event->id); $allday = (bool)$eid->calendar_event_allday; $recurs = (bool)$eid->calendar_event_recurs; if($eid->children("calendar_event_start={$start}")) { $start = wireDate($event->start->format('Y-m-d H:i')); if($eid->children("calendar_event_start={$start}")) { $subevent = $eid->children("calendar_event_start={$start}"); //echo "same same {$subevent->id} {$subevent->title} {$eid->title}"; } } // translate events from some source to a format recognizable by fullCalendar $addItem = array( 'id' => $event->event->id, 'title' => $event->event->title, 'allDay' => $allday, 'start' => wireDate($event->start->format('Y-m-d H:i')),//calendar_event_start), 'end' => wireDate($event->end->format('Y-m-d H:i')), //'url' => "./$event[id]", // event ID is the url segment 'url' => $event->event->url, ); $items[] = $addItem; //$n = 0; $c = 0; if($eid->hasChildren() && !in_array($eid->id, $ids)) { foreach($eid->children() as $i) { $items[] = array( 'id' => $i->id, 'title' => "{$i->parent->title}: {$i->title}", 'start' => wireDate('Y-m-d', $i->calendar_event_start), 'url' => $i->url, ); $items[$idx]['title'] = "{$i->parent->title}: {$i->title}"; } //echo $n . ' ' . $c; } $ids[] = $eid->id; //$n++; $c++; /* if($event->calendar_event_recurs == true) { echo $event->calendar_event_rrule; }*/ } //print_r($items); //$idx++; return json_encode($items); } $eventsJson = eventsToJSON($events, $start, $until); //echo '<br><br>'.$eventsJson; $content .= <<<EOT <script> $(document).ready(function() { /* date store today date. d store today date. m store current month. y store current year. */ var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); /* Initialize fullCalendar and store into variable. Why in variable? Because doing so we can use it inside other function. In order to modify its option later. */ var calendar = $('#calendar').fullCalendar( { /* header option will define our calendar header. left define what will be at left position in calendar center define what will be at center position in calendar right define what will be at right position in calendar */ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, /* defaultView option used to define which view to show by default, for example we have used agendaWeek. */ defaultView: 'month', /* selectable:true will enable user to select datetime slot selectHelper will add helpers for selectable. */ selectable: true, selectHelper: true, /* when user select timeslot this option code will execute. It has three arguments. Start,end and allDay. Start means starting time of event. End means ending time of event. allDay means if events is for entire day or not. */ select: function(start, end, allDay) { /* after selection user will be promted for enter title for event. */ var title = prompt('Event Title:'); /* if title is enterd calendar will add title and event into fullCalendar. */ if (title) { calendar.fullCalendar('renderEvent', { title: title, start: start, end: end, allDay: allDay }, false // make the event "stick" ); } calendar.fullCalendar('unselect'); }, /* editable: true allow user to edit events. */ editable: false, /* events is the main option for calendar. for demo we have added predefined events in json object. */ events: {$eventsJson} }); }); </script> EOT; The calendar-event template is generated by the module; I added a child template, calendar-event_instance. So the above outputs the calendar and its events, but any recurring event instance with info input appears twice: regular, e.g., 6p Game Night, and preceded with an all-day event, Game Night: Monopoly. What I want is to replace the event recurrence's title and URL with the one for that instance when one exists.
  12. I have a rich textarea field and in Page Edit Links config I added "shadowbox" (without quotes) on a new line under the rel attribute. But every time I add it to a link, save, check on it, rel is gone from the tag. It won't stick. Given option nofollow will. What gives?
  13. Both of those work, but I'd still like to be able to put it in as part of the page edit template itself more so that they appear above and below the fields in any tab. Also, AdminSaveActions doesn't have an option to edit previous page, and for whatever action you choose to carry out, you need to save the page. Maybe you want to browse through in either direction without saving your changes in 1 click instead of 2+.
  14. I have a template that is used for one page, "tracks" (tpl & pg name). Under the Access tab the "uploader" role is checked for View Pages, Edit Pages, and Add Children. I even added a page-edit-tracks_upload permission via Page Edit Field Permission module which is enabled for "uploader" and yet when I try to edit the tracks page as a regular uploader, I get "ProcessWire: You don't have access to edit", "The process returned no content." The uploader in question did not create the page but I want any uploader to be able to edit this one field of the page (none others exist besides the title and settings fields). How can I achieve that?
  15. This worked protected function addNewTracks($event) { $page = $event->arguments[0]; $pages = wire('pages'); if($page->template == 'tracks' && count($page->tracks_upload) > 0) { foreach($page->tracks_upload as $t) { $basename = str_replace(".{$t->ext}",'',$t->name); $p = new Page; $p->parent = $pages->get('/tracks/'); $p->template = 'track'; $p->title = $basename; $p->addStatus(Page::statusUnpublished)->save(); $p->audio->add($t->filename); $p->save(); $p->name = $p->id; $p->save(); $this->message("Added new track {$p->title} by {$p->createdUser->name}"); } $page->tracks_upload->removeAll(); $page->save(); } }
  16. <?php class ProcessTracksterMultiUpload extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Process Trackster Multi-Upload', 'version' => 1, 'summary' => 'Creates a new page for each individual track', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => '', ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { $this->pages->addHookAfter('save', $this, 'addNewTracks'); } /** * Adds tracks * */ protected function addNewTracks($event) { $page = $event->arguments[0]; $pages = wire('pages'); if($page->template != 'tracks') return; foreach($page->tracks_upload as $t) { $basename = str_replace(".{$t->ext}",'',$t->name); $p = new Page; $p->parent = $pages->get('/tracks/'); $p->template = 'track'; $p->title = $basename; $p->name = $p->id; $p->addStatus(Page::statusUnpublished)->save(); $p->audio->add($t->filename); $p->save(); $this->message("Added new track {$p->name} by {$p->createdUser}"); //wire('pages')->get(1014)->tracks_upload->delete($t->filename); //$deleted = $t->name; //$files->delete($t); $this->message("Deleted temporary file $$t->filename"); //$this->message("new $newname"); } $pages->get($page->id)->tracks_upload->deleteAll(); $pages->get($page->id)->save(); //$page->tracks_upload->removeAll()->save(); //$thisPage = $pages->get($page->id); //$thisPage->save(); //$page->tracks_upload->deleteAll(); //$page->save(); } } I've tried $page->tracks_upload->deleteAll(), removeAll(), $page->delete($t), $page->delete($t->name) ($page ones in the foreach loop), all kinds of things. Nothing seems to work. Pages are created fine and all, I just need these files deleted too.
  17. <?php class ProcessTracksterMultiUpload extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( // The module's title, typically a little more descriptive than the class name 'title' => 'Process Trackster Multi-Upload', // version number 'version' => 1, // summary is brief description of what this module is 'summary' => 'Creates a new page for each individual track', // Optional URL to more information about the module 'href' => '', // singular=true: indicates that only one instance of the module is allowed. // This is usually what you want for modules that attach hooks. 'singular' => true, // autoload=true: indicates the module should be started with ProcessWire. // This is necessary for any modules that attach runtime hooks, otherwise those // hooks won't get attached unless some other code calls the module on it's own. // Note that autoload modules are almost always also 'singular' (seen above). 'autoload' => true, // Optional font-awesome icon name, minus the 'fa-' part 'icon' => '', ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { // add a hook after each page is saved $this->pages->addHookAfter('save', $this, 'addNewTracks'); } /** * Adds tracks * */ protected function addNewTracks($event) { $page = $event->arguments[0]; $pages = wire('pages'); if($page->template != 'tracks') return; foreach($page->tracks_upload as $t) { $basename = str_replace(".{$t->ext}",'',$t->name); $p = new Page; $p->parent = $pages->get('/tracks/'); $p->template = 'track'; $p->title = $basename; $p->name = $p->id; $p->addStatus(Page::statusUnpublished)->save(); $p->audio->add($t->filename); $p->save(); $this->message("Added new track {$p->name} by {$p->createdUser}"); //wire('pages')->get(1014)->tracks_upload->delete($t->filename); //$deleted = $t->name; //$files->delete($t); $this->message("Deleted temporary file $$t->filename"); //$this->message("new $newname"); } $pages->get($page->id)->tracks_upload->deleteAll(); $pages->get($page->id)->save(); //$page->tracks_upload->removeAll()->save(); //$thisPage = $pages->get($page->id); //$thisPage->save(); //$page->tracks_upload->deleteAll(); //$page->save(); } } I've tried $page->tracks_upload->deleteAll(), removeAll(), $page->delete($t), $page->delete($t->name) ($page ones in the foreach loop), all kinds of things. Nothing seems to work. Pages are created fine and all, I just need these files deleted too.
  18. I know how to create pages with the API. I need help with the form itself. Here's what I'm working with so far, hacked together from examples found in this forum: <?php $upload_path = $config->uploadTmpDir; $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'upload-form'); // create file field $field = $modules->get("InputfieldFile"); $field->label = "Audio File"; $field->attr('id+name','audio'); $field->description = "Upload your track(s)"; $field->destinationPath = $upload_path; $field->extensions = "mp3"; $field->maxFiles = 10; $field->maxFilesize = 2*1024*1024; // 5mb $field->required = 1; $form->append($field); // append the field // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Upload"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>You submission was completed! Thanks for your time."; } } else { // render out form without processing $out .= $form->render(); } $content .= $out; That outputs the form but I can't drag & drop or input more than one file, and when I submit it says "Missing required value". I need to at least create one or more pages from the form submission, i.e., one per file uploaded. If possible I'd like to be able to set the title and description for each file/page as well.
  19. How to write a module that adds links to edit previous or next sibling in page editor?
  20. hellomoto

    Jump-Inc

    Very nice. This is probably the last little tweak needed to achieve pure perfection, but at least in Chrome for me on 404 page the gradient background for "404 not found" ends before the D, and the 404 is pale against the white.
  21. I installed this to a new site I'm working on and love it, just have a few ideas to make it even better: Add calendar_event_recurs checkbox field and display recurrence fields only if =1 Headline field for recurring event instances (show if parent.template=calendar-event) In admin calendar, "Modify this event recurrence only" should create/edit a child page of the recurring event (calendar-event children to be named in date format) Display hidden events in admin calendar Open event editor from admin calendar in modal Simple front-end FullCalendar rendering (hidden events hidden) Actually maybe the Admin Calendar and Calendar itself should be separate, then the Calendar can allow for different templates (e.g., blog posts or something) to also be included...
  22. Working as it should now, don't know why it wouldn't before... Oh well. Thank you though Olsa; if I come across that again I'll give your suggestion a try for sure.
  23. $block is a single item in the repeater field "home_blox". $block->pg is the Page field within the repeater. Image field is named "images". This worked: foreach($page->home_blox as $block) { $bgimg = ''; $pg = $block->pg; if($pg->images->getTag('blockbg')) { $bgimg = "<img src='{$pg->images->getTag('blockbg')->url}'/>"; }
  24. I have CKEditor set as the input type for my summary textarea field, and in its settings, Use ACF is enabled, and in Extra Allowed Content I have "*(left,right)". Yet when I add either of those classes to a ul or p element in the field, they're still stripped on save. Can anyone tell me why or point me in the direction of solving this..? Thanks much.
  25. $blocks = ''; foreach($page->home_blox as $block) { $bgimg = ''; if($block->pg->images->getTag('blockbg')) $bgimg = "<img src='{$block->pg->images->getTag('blockbg')->url}'/>"; $filters = ''; foreach($block->home_filters as $filter) { $filters .= " --{$filter->value}"; } $body = $block->pg->get('summary|body'); $output = <<<EOT <div class="unit-{$block->home_blockwidth}0 element-item{$filters}"> <div class="background">{$bgimg}</div> <div class="overlay"> <header><h2 class="title"><i class="fa fa-clock-o"></i> {$block->pg->title}</h2></header> <div class="inner"> {$body} </div> </div> </div> EOT; $blocks .= $output; } echo $blocks; I have tags enabled on the image field, so why am I getting this error?
×
×
  • Create New...