Jump to content

hellomoto

Members
  • Posts

    333
  • Joined

Posts posted by hellomoto

  1. RewriteEngine on
    RewriteBase /
    
    RewriteRule ^index.php$ / [NC,R,L]
    
    RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
    RewriteRule . %1/%2 [R=301,L]
    
    # mask primary domain subdir. location
    RewriteCond %{HTTP_HOST} ^(www\.)?audino\.us$ [NC]
    RewriteRule ^(.*)$ /audino\.us%{REQUEST_URI} [L,NC,QSA]

    The above seems effective overall, except that (www.)?example.com/example.com(.*) need hide that tricky subdirectory from the URI.

    Also I need to know how to either force or omit the www. prefix while also pointing to & hiding the subdirectory serving the site.

  2. Now I have 

    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^index.php$ / [NC,R,L]
    
    # remove double/more slashes in url
    RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
    RewriteRule . %1/%2 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^(www\.)?audino\.us$ [NC]
    #RewriteBase /audino.us
    RewriteRule !^audino\.us/ /audino\.us%{REQUEST_URI} [L,NC]
    # above 2 lines same effect

    and in site/ready.php $config->urls->root = '/'; thus:

    • ^(www.)?example.com => example.com/example.com/
    • ^(www.)?example.com/pw, ^(www.)?example.com/pw/ => example.com/pw/

    How to remedy this?
    Also I am still unable to login; I've tried resetting the password via API in case I had it wrong.

  3. 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

  4. 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.

  5. 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:

    Quote

    2 Doralice Children [Blackstar x Getz_Gilberto].mp3

    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.

  6. 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: 

    Quote

     InputfieldFile: Missing required value (bla_upload)

    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:

    Quote

    Missing required value

    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.

  7. 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 

    Quote

     ProcessWire: ProcessModule: This page may not be deleted

    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.

  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);
      }

     

    • Like 4
  10. 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.

  11. 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.

  12. 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. 

    • Like 1
  13. 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.

  14. Attempting to download AdoptDefaultsFromParents (or any module) in PW3 admin produces the following slew of errors:

    Quote

    ProcessWire: ProcessModule: No download URL specified
    DEBUG MODE BACKTRACE ($config->debug == true):
    #0 [internal function]: ProcessWire\ProcessModule->___executeDownload()
    #1 /Applications/AMPPS/www/hcf/wire/core/Wire.php(348): call_user_func_array(Array, Array)
    #2 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___executeDownl...', Array)
    #3 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessModule), 'executeDownload', Array)
    #4 /Applications/AMPPS/www/hcf/wire/core/ProcessController.php(242): ProcessWire\Wire->__call('executeDownload', Array)
    #5 /Applications/AMPPS/www/hcf/wire/core/ProcessController.php(242): ProcessWire\ProcessModule->executeDownload()
    #6 [internal function]: ProcessWire\ProcessController->___execute()
    #7 /Applications/AMPPS/www/hcf/wire/core/Wire.php(348): call_user_func_array(Array, Array)
    #8 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___execute', Array)
    #9 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessController), 'execute', Array)
    #10 /Applications/AMPPS/www/hcf/wire/core/admin.php(113): ProcessWire\Wire->__call('execute', Array)
    #11 /Applications/AMPPS/www/hcf/wire/core/admin.php(113): ProcessWire\ProcessController->execute()
    #12 /Applications/AMPPS/www/hcf/wire/modules/AdminTheme/AdminThemeReno/controller.php(13): require('/Applications/A...')
    #13 /Applications/AMPPS/www/hcf/site/templates/admin.php(15): require('/Applications/A...')
    #14 /Applications/AMPPS/www/hcf/wire/core/TemplateFile.php(219): require('/Applications/A...')
    #15 [internal function]: ProcessWire\TemplateFile->___render()
    #16 /Applications/AMPPS/www/hcf/wire/core/Wire.php(348): call_user_func_array(Array, Array)
    #17 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___render', Array)
    #18 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
    #19 /Applications/AMPPS/www/hcf/wire/modules/PageRender.module(503): ProcessWire\Wire->__call('render', Array)
    #20 /Applications/AMPPS/www/hcf/wire/modules/PageRender.module(503): ProcessWire\TemplateFile->render()
    #21 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
    #22 /Applications/AMPPS/www/hcf/wire/core/Wire.php(348): call_user_func_array(Array, Array)
    #23 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___renderPage', Array)
    #24 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array)
    #25 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(619): ProcessWire\Wire->__call('renderPage', Array)
    #26 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(619): ProcessWire\PageRender->renderPage(Object(ProcessWire\HookEvent))
    #27 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array)
    #28 /Applications/AMPPS/www/hcf/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Wire->__call('render', Array)
    #29 /Applications/AMPPS/www/hcf/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Page->render()
    #30 [internal function]: ProcessWire\ProcessPageView->___execute(true)
    #31 /Applications/AMPPS/www/hcf/wire/core/Wire.php(348): call_user_func_array(Array, Array)
    #32 /Applications/AMPPS/www/hcf/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___execute', Array)
    #33 /Applications/AMPPS/www/hcf/wire/core/Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array)
    #34 /Applications/AMPPS/www/hcf/index.php(55): ProcessWire\Wire->__call('execute', Array)
    #35 /Applications/AMPPS/www/hcf/index.php(55): ProcessWire\ProcessPageView->execute(true)
    #36 {main}

    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.

×
×
  • Create New...