Jump to content

Orkun

Members
  • Posts

    295
  • Joined

  • Last visited

Everything posted by Orkun

  1. Thank you very much! Regarding to the today keyword. Ryan mentioned in this thread that it could also be used. For now I used your option with $today = time(); but I had also examples on my side where I used 'today' keyword and it worked. Something like that: ... $lastmonth_end = _data_last_month_day(); $dateString = "date_from>=today, date_from<=$lastmonth_end"; $limit = 10; // the "limit"-setting used on this page //get all dates from the current month $dates = $pages->find("template=date, $dateString, sort=date_from, sort=start_time, limit=$limit");
  2. Is there a way to filter a pagearray you get from the pagetable? As I know something like this wouldn't work because you can't filter pagetable i think? Is there probably an alternative how i coud get this to work: //get all dates of the current acitivty Page from the pagetable where date_from is bigger or equal to today. $filteredPagetable = $page->activity_create_date($selector[e.g "date_from>=today, sort=date_from"]); //check filtered pagetable array & get the latest date from the first item in array. $dateFrom = (count($filteredPagetable)) ? $filteredPagetable->first->date_from : "";
  3. How can I change the NumChildren Label in the Tree? I am logged in as a custom user. I have an SitehelperModule where I hook in the "ProcessPageList::execute" and execute and custom Function like this which excludes all pages which the current user can't edit: And It works well, the current user gets only the Pages which he can edit, but the problem is, that the NumChridren shows that they are 5 Pages under the ParentPage and this is confusing for the customer. Can I manipulate that also? I am asking because since the PageListNumChildren is rendered by the ProcessPageList.js I dont know how to tell Processwire that it should only num the Pages which the current user can edit? if(!$this->user->isSuperuser()) $this->addHookAfter('ProcessPageList::execute', $this, 'HidePages'); public function HidePages(HookEvent $event){ // create an array with all id's of the page to exclude $uneditable_pages = new PageArray(); $the_pages = wire('pages')->find("template=activity|location|organiser|address|source|tipp"); foreach ($the_pages as $the_page) { if(!$the_page->editable()) { $uneditable_pages->add($the_page); } } $hidden = explode('|', $uneditable_pages); // make sure it's an ajax request if($this->config->ajax){ // manipulate the json returned and remove any pages found from array $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } This Code-Snippet is an mini-altered Version from Somas Code on Github
  4. Is it normal that the InputfieldDatetime.min.js is used insted of InputfieldDatetime.js in the FormBuilder Iframe? It would be easier to edit the InputfieldDatetime.js. InputfieldDatetime.js: var options = { //It's easier to edit here(Don't work at the moment because the minified version is used) //controlType:'select', //oneLine:true, changeMonth: true, changeYear: true, showOn: showOn, buttonText: ">", showAnim: 'fadeIn', dateFormat: dateFormat, gotoCurrent: true, defaultDate: tsDate // buttonImage: config.urls.admin_images + 'icons/calendar.gif', // dateFormat: config.date_format }; InputfieldDatetime.min.js: //(Works) var k={/*controlType:'select', oneLine:true,*/ changeMonth:true,changeYear:true,showOn:j,buttonText:">",showAnim:"fadeIn",dateFormat:a,gotoCurrent:true,defaultDate:c}; Can I change it that the InputfieldDatetime.js is used?
  5. @LostKobrakai Yes I use the datepicker with formbuilder so i tried to make like you said: edited /site/modules/FormBuilder/themes/plain/inputfield.js : $(document).ready(function() { // make the ui-widget-header labels perform like normal labels that focus their field // rather than opening/closing the ui-widget-content/input // the only exception is those that are already closed (.InputfieldStateCollapsed) // we leave those alone to continue doing what they were $(".InputfieldStateToggle").removeClass("InputfieldStateToggle"); }); if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { controlType: 'select', oneLine: true, timeOnlyTitle: 'Zeit wählen', timeText: 'Uhrzeit', hourText: 'Stunden', minuteText: 'Minuten', secondText: 'Sekunden', currentText: 'Jetzt', closeText: 'Fertig' }; $.timepicker.setDefaults($.timepicker.custom); }); } But with no effect.
  6. Ok so far I have done this: 1. Copied the InputfieldDatetime Folder to /site/modules/ and replaced the old timepicker-addon js with the new one from the devns branch from Github (timepicker.js version 1.6.1). 2. Tell Processwire to use /site/modules/InputfieldDatetime insted of /wire/modules/InputfieldDatetime. 3. Install the Admin Custom Files Module 4. Create a file called ProcessPageEdit.js under /site/templates/AdminCustomFiles/ 5. The content of the /site/templates/AdminCustomFiles/ProcessPageEdit.js: if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, controlType: 'select', oneLine: true, }; $.timepicker.setDefaults($.timepicker.custom); }); } 6. Adjust the AdminCustomFiles Module Settings: Now It should work but i still get the normal Datetimepicker with the slides: What I am missing? PS: I also have to translate the Datetimepicker to german, how can I achieve this?.
  7. Ok I see that Processwire detects itself that a duplicate is existing and so I can change in the module settings of the InputfieldDatetime which one Processwire should use.
  8. Thanks for your advice @Macrura, But I have still couple of questions: Do you mean duplicate the current version from Github (https://github.com/ryancramerdesign/ProcessWire/tree/devns/wire/modules/Inputfield/InputfieldDatetime) to the modules directory in the site directory? And how can I tell then processwire he should use the InputfieldDatetime Folder instead of the original in wire? Could you possibly explain that further?
  9. Is it possible to turn the sliders for the timepicker addon to selects without updating to the devns branch? I downloaded the newest timepicker addon version from here: Timepicker Addon 1.6.1 and replaced it with the current timepicker addon which is version 0.9.9 under /wire/modules/Inputfield/InputfieldDatetime/jquery-ui-timepicker-addon.js. It worked more or less, I could change the sliders to selects but then as expected other problems occured like false timeFormats and so on. The Thing is that the customer wants a user-friendliy datepicker for desktop and mobile and sliders aren't so user-friendly. Is there a way to make 3rd party datetimepicker plugins to work with formbuilder? Have you any suggestions?
  10. I have set the right Datepicker translation file "/wire/modules/Jquery/JqueryUI/i18n/jquery.ui.datepicker-de.js". And change the code from: /* German initialisation for the jQuery UI date picker plugin. */ /* Written by Milian Wolff (mail@milianw.de). */ jQuery(function($){ $.datepicker.regional['de'] = { closeText: 'schließen', prevText: '<zurück', nextText: 'Vor>', currentText: 'heute', monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'], dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], weekHeader: 'KW', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['de']); }); to: /* German initialisation for the jQuery UI date picker plugin. */ /* Written by Milian Wolff (mail@milianw.de). */ jQuery(function($){ $.datepicker.regional['de'] = { closeText: 'schließen', prevText: '<zurück', nextText: 'Vor>', currentText: 'heute', monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'], dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], weekHeader: 'KW', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['de']); $.timepicker.regional['de'] = { timeText: 'Uhrzeit', hourText: 'Stunde', minuteText: 'Minute', secondText: 'Sekunde', millisecText: 'Millisekunde', timezoneText: 'Zeitzone', currentText: 'jetzt', closeText: 'schliessen', }; $.timepicker.setDefaults($.timepicker.regional['de']); }); But it only affects the date and not the time. What I'm missing?
  11. Let's say I have 500 Eventpages or more with differen content fields(date, title, textarea etc..). I would display all events in a list like this: $events = $pages->find("template=event, limit=10"); echo "<div class='event-container'>"; foreach($events as $event){ echo "<div class='event-detail'> <h1>$event->title</h1> <p>$event->short_description</p> </div>"; } echo "<a class='load-more'>LOAD MORE</a>"; echo "</div>"; Now I want to make the load-more link to display 10 or 20 more events without reloading the page and showing a loading gif/text while its rendering the other events, when clicking on it . How can i achieve this? I know that i could use pagination for displaying this heavy amount of results but the customer doesn't want that because it don't fit in the design of the website. Can I probably achieve a combination with Pagination and Ajax, or are there other ways to do it?
  12. I have a page field calles select_multi_dates. I set a php specific selector like this $currentActivity = $page->parent; return $currentActivity->activity_create_date; It shoud give me all pages from the activity_create_date pagetable, what it does well but the problem is that the label is shown as timestamp. And here is the configuration of the page field: What I'm missing?
  13. Processwire is great!

  14. Sorry for the slurred declaration of my problem. It has worked for me this way: foreach ($Import->xpath('Activities/Activity') as $Activity) { $thisActivity = $Activity->ActivityDetail; $lpTitle = strip_tags($thisActivity->Location['name']); $lp = $this->pages->get("template=location, title='$lpTitle'"); if(!$lp->id){ // if not found create new page $lp = new Page(); ... } } $lpTitle is a name attribute from the Location node which comes from the xml-feed. And the Problem was that the name attribute had commas inside his value and this had break the selector string. I solve this Problem by wrapping $lpTitle inside apostrophes .
  15. My Code: $lpTitle = strip_tags($thisActivity->Location['name']); $lp = $this->sanitizer->selectorValue($this->pages->get("template=location, title=$lpTitle")); I get this notice: Notice: Trying to get property of non-object in /blabla/blabla/blablabla/site/modules/ProcessXMLImport/ProcessXMLImport.module.php on line 247 Notice: What I am Doing wrong?
  16. I forgot all the depencie plugins which the fontawesome-plugin needs to work. So i also installed these plugins: Widget Line Utilities Color Dialog but with no effect. Then i realised that i dont edited the config-body.js. So i write this lines of code in the config-body.js: config.extraPlugins = 'fontawesome'; config.contentsCss = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'; config.allowedContent = true; And i also write "FontAwesome" in the toolbar section. but i still get this error: I don't know what I'm missing...
  17. Yeah you are right, i get this js error: uncaught exception: [CKEDITOR.resourceManager.load] Resource name "widget" was not found at "http://blabla.ch/wire/modules/Inputfield/InputfieldCKEditor/ckeditor-4.4.6/plugins/widget/plugin.js?t=2015030801.143".
  18. I tried to implement the fontawesome plugin with the help of this mini-tutorial. The problem is when go to the "Plugins" section and check the box for the "fontawesome" plugin, then I still get an white body field. What I am doing wrong?
  19. @horst Thank for your answer. I tried your idea but unfortunately it hasn't worked. @Soma I saw that option for the PageTable before, I also set it but i also need this option for the parent template. The users can create dates with the pagetable while they are creating a activity but they can also create dates with the date Lister. Is it really not possible? also not with hooks like mentioned in this thread here: https://processwire.com/talk/topic/10701-automatic-page-name-using-processpageaddexecute-and-pagetable/
  20. Hi I have a question about the "Name format for children" option for Templates. This option only shows up when i allow 1 single template under the "allowed templates" option. The Scenario: I have a template called "activity", the activity template can have or it is allowed only to have 4 template types as children: date, cast, image and video. My Problem is that i want that only the page name of the date pages are genereated automatically with the "Name format for children". But this option is only working when i allow only 1 template as children. How can I achieve, that the "Name format for children" works also when its allowed more than 1 children. Here is the Tree structure for visualization:
  21. What is the $event variable/parameter in the Helloworld.module? What does the $event? How does it work? Are there php classes which describes $event? What are all these things doing? $event $event->arguments[0] $event->object Im sorry if this is a nooby question
  22. I want to set the pagestatus of a admin-page to hidden when a user is logged in which has the role "company". I did this in the admin.php but it doesn't work. What I am missing? if(wire('user')->isSuperuser()){ $pages->get(1265)->removeStatus(Page::statusHidden); } else{ $pages->get(1265)->addStatus(Page::statusHidden); }
  23. Your approach gives me an "TemplateFile: Unrecognized path" error. I changed the link part to $addNew->attr('href',$config->urls->admin.'page/add/?parent_id=1'); so that it work. But what i want is something like this:
  24. Is it possible to make a "Add New" Shortcut-Button on a Custom Admin Page e.g in the ProcessDashboard Module instead on the Sitetree Page?
  25. Thank you for your input Thomas. But it does not matter more because I have changed the concept. I'm working now with Custom Admin Pages in the Backend, creating Dashboards, Listers with ListerPro for the different Pages: Event, Dates, Images, Videos etc.... The Goal is to achieve a Culturedatabase with the Processwire-Backend where you can create/edit events, dates or also import/export the data for individual use in other websites/services. Before I have done this with a Frontend for the Backendsystem where you can create/read/update/delete events, dates with the Fredi-Module from apeisa. But still thank you for your commitment. PS: Processwire is great
×
×
  • Create New...