Jump to content

hellomoto

Members
  • Posts

    352
  • Joined

Everything posted by hellomoto

  1. I have RewriteBase / in the PW htaccess, so / but: / => example.com /pw => example.com/example.com/pw/ /pw/ => example.com/pw/ www. => www.example.com/example.com/ (root links also = "", as opposed to www.example.com How can I fix this? root .htaccess = RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(www\.)?example\.com/?(.*)$ http://example.com/$1 [R] RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /example.com/$1 [L,QSA] oh and so much for hiding the domain I did just because you said but you didn't but that's a ok
  2. I have web hosting with the following .htaccess en root, to point it to a subdirectory "audino.us", wherein I have PW installed: RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?something.com$ RewriteCond %{REQUEST_URI} !^/something.com/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /audino.us/$1 RewriteCond %{HTTP_HOST} ^(www.)?something.com$ RewriteRule ^(/)?$ something.com/index.php [L] RewriteCond %{HTTP_HOST} ^(www.)?something.com$ RewriteRule ^(/)?$ something.com [L] However when I go to audino.us/pw to access the admin, it becomes audino.us/audino.us/pw, and doesn't allow me to log in. How do I render the above to be recursive (?), i.e., to apply to all subordinate URLs? Is this to be done within the .htaccess in /audino.us, or in the root .htaccess above? Please help, I can't log in. Thanks much.
  3. Updated bulkup(): private function bulkup($form) { if($this->input->post->import) { $files = $this->input->post->bla_upload; if(!count($files)) { return "No files were found."; }else{ $list = ''; foreach($files as $f) { $list .= $f . PHP_EOL; } return count($files)."\n".$list; } } } Like this it returns: when I upload just 1 file... it counts 2... and there is (and was before) a directory for the process page's ID in site/assets/files, but it remains empty still. I'm blue, need a clue.
  4. I have a process module like so: public function execute() { $output = 'mad music archive/bulk uploadability management'; $form = $this->makeForm(); if($this->input->post->import) $output .= $this->bulkup($form); else $output .= $form->render(); return $output; } public function ___install() { $mkr = new ImportShorthand(); $p = [[ 'template' => 'admin', 'parent_id' => 2, 'name' => self::PGNAME, 'title' => '[Blaudio] Mgmt', ],[ 'process' => $this, ]]; $mkr->newPage($p); } public function ___uninstall() { $wp = wire('pages'); $pg = $wp->get('template.id=2, parent.id=2, name='.self::PGNAME); if($pg->id) $wp->delete($pg, true); } private function bulkup($form) { if($this->input->post->import) { $form->processInput($this->input->post); return; if(!$form->getErrors()) { $files = $form->get("bla_upload")->value; if(count($files)) { return count($files);/* $bulkload = $bulk_upload->first(); //$bulkload->rename("address-import.csv"); $bulkloadname = $bulkload->filename;*/ }else{ return "No files were found"; } //$this->session->redirect("../edit/?id=$list_id"); } } } private function makeForm() { So far, returning early in the bulkup() function, submitting the form with an acceptable file results in this error message: Upon reloading the page (afresh, without the submitted data; i.e., clicking its link in the nav) this error is displayed within the upload field: I'm assuming this is due to the fact that this is a process page. How do I ensure temporary storage? My goal ultimately is to insert a new page for each valid file. Thanks much in advance.
  5. The page is not deleteable, but I am logged in as superadmin.
  6. I cannot manage to delete this page upon uninstallation of a Process module I have that was working previously. I thought the only difference would be that I added `namespace ProcessWire;` to the start of the module PHP, however I've tried without it and still I get It is an admin page. Right now I have $get = 'template=admin, parent!=trash, name=importall, include=all'; $gp = wire('pages')->get($get); if($gp->id) { wire('log')->save($log, "$gp->id".get_class($gp).__NAMESPACE__); $gp->delete(); if(!wire('pages')->get($get)->id) wire('log')->save($log, "Deleted Imports page."); } previously $gp = $this->pages->get('template=admin, parent!=trash, name=importall'); if($gp->id) { $this->pages->delete($gp, true); $this->log->save($log, "Uninstalled ". get_class()); } Why will it no longer delete? I can't even do so by the GUI.
  7. Actually it's even doing this when I just save a published page without unpublishing it, I don't think I'd even tried that before
  8. For some reason when I unpublish an already-published page, even of a template other than the specified 'importer', all its fields are cleared on page render. How do I understand and remedy this? Peace & thanks public function init() { $this->addHookAfter('Page::render', $this, 'renderEditor'); } protected function renderEditor(HookEvent $event) { $here = $event->object; $page = $this->pages->get($this->input->get->id); //$this->log->message($page->template.$here->process); return; if ($here->process != 'ProcessPageEdit' && $page->template != 'importer') return; $css = $this->config->urls->ProcessImportAll . 'ass/ProcessPageEdit_importer.css'; $event->return = str_replace("</head>", "<link rel='stylesheet' type='text/css' href='{$css}'/>\n</head>", $event->return); $field = wire('fields')->get('name=pi_template'); if (count($field->templateTypes)>0) { $templates = $field->templateTypes; } else { $templates = []; foreach (wire('templates') as $tpl) $templates[] = $tpl->id; } sort($templates); //$tplTypes = json_encode($templates); $templatesFields = $this->getTemplatesFields($templates); $templatesFields = json_encode($templatesFields); $js = <<<EOT <script> $(document).ready(function(){ if (!document.getElementById('Inputfield_status_2048').checked) { $('#ProcessPageEditContent *').prop('disabled',true); } else { var all = $templatesFields; var sel = '#Inputfield_pi_template option[selected="selected"]'; var tpl = getTpl(); var arr = all[tpl]; var def = '<option value=""></option>'; $('#Inputfield_pi_match').prepend(def); filterFields(tpl); $('#wrap_Inputfield_pi_template .asmListItem .asmListItemRemove').click(clearFieldOptions); $('#Inputfield_pi_template').change(function() { var on = $(this).find('option[selected="selected"]')[0]; if (on !== undefined) { tpl = on.value; //console.log('clicked ' + tpl); filterFields(tpl); } else { tpl = null; clearFieldOptions(); } }); function filterFields(t) { if (t != null) { $('#Inputfield_pi_match').prop('disabled',false); arr = all[t]; //console.log(arr); $('#Inputfield_pi_match option').each(templateFieldOptions); $('#wrap_Inputfield_pi_fieldmap select option').each(templateFieldOptions); $('#_Inputfield_pi_maptab').click(function() { //$('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); }); } else { clearFieldOptions(); } } function getTpl() { if ($(sel).length>0 && $(sel)[0].value) { var tpl = $(sel)[0].value; } else { var tpl = null; } return tpl; } function templateFieldOptions() { var val = parseInt(this.value); if (!arr.includes(val) && val>0) { //console.log(val + ' ' + arr); $(this).prop('selected',false); $(this).prop('disabled',true); } else { if (arr.includes(val) && val>0) { //console.log(tpl); $(this).prop('disabled',false); } } } function clearFieldOptions() { $('#Inputfield_pi_match').find('option[value=""]').first().prop('selected',true); $('#Inputfield_pi_match').find('option[value!=""]').each(function() { $(this).prop('disabled',true); }); $('#Inputfield_pi_match').prop('disabled',true); $('#wrap_Inputfield_pi_fieldmap select').find('option[value=""]').first().prop('selected',true); $('#wrap_Inputfield_pi_fieldmap select').find('option[value!=""]').each(function() { $(this).prop('disabled',true); }); $('#wrap_Inputfield_pi_fieldmap select').prop('disabled',true); } } }); </script> EOT; $event->return = str_replace("</body>", "$js</body>", $event->return); //$this->filterFieldFields($event); }
  9. Done did it: public function init() { $this->addHookAfter('Page::render', $this, 'styling'); $this->addHookAfter('Page::render', $this, 'filterFieldFields'); } protected function styling(HookEvent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; $css = wire('config')->urls->ImportUpdateUltimate . 'ass/edit_importupdate.css'; $event->return = str_replace("</head>", "<link rel='stylesheet' type='text/css' href='{$css}'/>\n</head>", $event->return); } protected function filterFieldFields(Hookevent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; if($edid->iu_template) $tpl = wire('templates')->get((int) $edid->iu_template[0]); else $tpl = null; $fields = []; if($tpl != null) { foreach ($tpl->fields as $f) { $fields[] = $f->id; } $fstring = '[' . implode(',',$fields) . ']'; } else $fstring = '[]'; $js = <<<EOT <script> $(document).ready(function(){ var arr = $fstring; var def = '<option value=""></option>'; if (arr.length) { $('#Inputfield_iu_match option').each(templateFieldOptions); $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); $('#_Inputfield_iu_maptab').click(function() { $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); }); } else { clearFieldOptions(); } $('#wrap_Inputfield_iu_template .asmListItemRemove').click(clearFieldOptions); function templateFieldOptions() { var val = parseInt(this.value); //console.log(typeof(val)); if (!arr.includes(val) && val>0) { //console.log(val); $(this).prop('selected',false); $(this).prop('disabled',true).remove(); } } function clearFieldOptions() { $('#Inputfield_iu_match').html(def); $('#wrap_Inputfield_iu_fieldmap select').each(function() { $(this).html(def); }); } }); </script> EOT; $event->return = str_replace("</body>", "{$js}</body>", $event->return); }
  10. I also want to add a hook which filters a field of fields (FieldtypeSelectExtOption) on Page(template=importupdate)::changed(iu_template) to only display the fields in that specified template in the iu_template field. By default (new page of template=importupdate, if iu_template = null) the field should display no options.
  11. I want to create a fieldtype Fields which in the config can be set as single or multi-value, and optionally filter available options dynamically according to a specified template field (using something like FieldtypeTemplates or FieldtypeSelectExtOption or even FieldtypeText). FieldtypePage can do this by including another page field in the selector, it can be a child dependent on its value... Could anyone just provide me with a starter guide? I'm looking at other modules for insight but ultimately remain lost. Thanks so much.
  12. Never mind this works $manager = new SelectableOptionManager(); $options = "0=Import\n1=Update"; $manager->setOptionsString($f, $options, true);
  13. I have a module that creates a bunch of fields and none of the Options type are saving their values. The options I have set appear in the page editor, however when I go to edit any of these fields the textarea where the options are supposed to be specified is blank. $f = new Field(); $f->set("name", "iu_do")->set("label","Action(s)"); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set('inputfieldClass', 'InputfieldCheckboxes')->save(); $f->options = [0 => "Import", 1 => "Update"]; $f->set("required",1)->set("optionColumns",1); $f->set("tags","-impupd")->set("columnWidth",50)->save(); How do I do this right? Thank you.
  14. I have a module with 'autoload' => 'template=admin'. I need to hook into ProcessPageEdit for editing template=importupdate, and within my hook function add CSS and JS files. I have: public function init() { $this->addHookAfter('ProcessPageEdit::execute', $this, 'addlStyles'); } private function addlStyles(HookEvent $event) { //$page = $event->arguments(0); if($page->template != 'importupdate') return; $css = wire('config')->urls->modules . 'ImportUpdateUltimate/editImportUpdate.css'; $this->config->styles->add($css); } which does nothing.
  15. I've been trying and failing to get this going for quite some time now: Here's what I have so far (current issues to follow): So when I install the module, I go to its admin page to add a new Import/Updater, set a title (I want to set it automatically by title but setting the childNameFormat via API when creating the template doesn't work), and encounter the following issues: Field iu_parent selector is ineffective. The "Mapping" tab does not open, despite the field and template fields' order seeming to be intact. ^ I had the FieldsetClose field ending in _close instead of _END. Please help me get past this first phase. Thank you so much.
  16. Attempting to download AdoptDefaultsFromParents (or any module) in PW3 admin produces the following slew of errors: The site/modules permissions = 755, allow_url_fopen & curl = on. How could this be? Why doesn't the download URL come through properly? I sorely miss the splendid convenience of this capability.
  17. Pierre-Luc: so all else the same, just mailto that email address? cstevensjr I was sending to a gmail email, or just performing the check on save, from another one set up with seemingly correct configuration...
  18. I was afraid you would say that... Any idea offhand as to why it might not?
  19. Anyone have this working on PW3?
  20. I hid/set aside the old /wire/, index.php, and .htaccess, as well as /site/config.php. Debug=1. $config->urls->admin = /pw/, as it's set as. I'm finding that others are encountering a similar issue but haven't found any solution yet, at least none that works for me. Please help, thanks much
  21. I'd tried that, both, now the module won't even actually install. (It creates the page all right, sans process, but the module itself is deactivated immediately.) This has all been since it started saying my request appears to be forged so I can't activate modules as normal, need $config->protectCSRF = false; in the site config.php. For some reason now it works that I've put it in ready() instead... somehow... public function ready() { $pg = $this->pages->get('name=importupdate'); if($pg->process != $this) $pg->setOutputFormatting(false)->set('process', $this)->save(); } but it'll only install after 2 tries. 1st try it does create the page, but inevitably needs another attempt. It was working just fine earlier just as I posted it, that's from my last commit which activated ok and all, I can't believe I've been bothering with this all damn night.
  22. class ImportUpdateUltimate extends Process { public static function getModuleInfo() { return array( 'title' => 'Import &amp; Update', 'autoload' => 'template=admin', 'singular' => false, ); } public function execute() { $addnew = wire('config')->urls->admin . '/page/add/?parent_id=' . wire('page')->id . '&template_id=' . wire('templates')->get('name=importupdate')->id; $output = ' <style>th,td { padding: 2px; } tr { border: 1px solid; } th { font-weight: bold; }</style> <p>Nulla laoreet tristique tristique. Sed elementum justo a nisl elementum sit amet accumsan nisi tempor. Nulla quis eros et massa dignissim imperdiet a vitae purus.</p>'; $rows = ''; foreach(wire('page')->children('include=all') as $iu) { $runnable = '<i class="fa fa-exchange"></i>'; if($iu->is(Page::statusUnpublished)) $runnable = ''; $rows .= '<tr><td><a href="' . $iu->editUrl . '">' . $iu->title . '</a></td><td></td><td><a href="' . $iu->url . '" target="#ajaxiframe">' . $runnable . '</a></td></tr>'; } $output .= '<table><tr><th>Title</th><th>LazyCron</th><th>Run</th></tr>' . $rows . '</table>'; $output .= '<a href="' . $addnew . '">+ New Import/Updater</a>'; return $output; } public function install() { $pg = new Page(); $pg->template = "admin"; $pg->name = "importupdate"; $pg->title = "Import/Update"; $pg->save(); $pg->process = "ImportUpdateUltimate"; $admin = $this->pages->get(2); $pg->set("parent", $admin)->save(); } } That same code used to effectively assign the process module above itself as the page's process upon installing the module. Now it doesn't. How can I make it do so?
×
×
  • Create New...