Jump to content

Neeks

Members
  • Posts

    93
  • Joined

  • Last visited

Posts posted by Neeks

  1. I will turn on debug mode and see if I can get any errors. (nothing is showing up in the log though).

    @Nico knolI: Thanks, I think the issue is I have one module that is doing 4-5 related things to drafting pages and publishing them, but those things should probably be split into separate modules. (I think) A process module that is not auto load (which I just learned from your post), and then several autoload modules need access to the runtime hooks (altering page listings, adding draft buttons, edit draft buttons, etc.) 

    • Like 1
  2. drafts is a custom process module.

    I did try that permission approach. if a user has access to that process that page still does not show up in the "pages" menu for the editor.  

            return array(
                'title'    => 'Project Drafts',
                'version'  => '0.2.0',
                'summary'  => 'Coordinate page drafts and new content content launched that are tied to code pushes',
                'permission' => 'draft-groups',
                'singular' => true,
                'autoload' => true
            );

    If I don't give the editor role, permissions access to "draft-groups" they can not access the page at all, which works how I imagine it would (indicating that the permission system is working)

    hmm I wonder what i'm missing?

  3. I'm trying to get a module to show up in the "pages" menu for editors, publishers, and other roles that are not part of the super user group. 

    The page lives under:
    /Admin/pages/drafts

    The templates is:

    And admin template, and it has a field for "process" which is required for the module to work. 

    All the solutions I have come up with to show this page are clunky, or plain wrong, so I figure there must be a simple way, maybe some one else has come across.  

    post-1913-0-52811800-1428166515_thumb.pn

    post-1913-0-07213700-1428166567_thumb.pn

  4. I'm not sure how exactly I managed to enable system fields in my templates but I did some how, then I accidentally added a system field to my non-system template,  and it doesn't seem so easy to remove.  Wondering if there is a way to handle this in the PW admin, or do I need to go to direct to the database?

    post-1913-0-52071400-1427208175_thumb.pn

  5. Thanks Kondogo,

    I found a good example in the forum on how to use it: https://processwire....-line-wiretabs/

        $form = $this->modules->get('InputfieldForm');
        $this->modules->get('JqueryWireTabs');
    
        foreach(array('One', 'Two', 'Three') as $number) {
    
            $tab = new InputfieldWrapper();
            $tab->attr('id', 'tab_' . $number);
            $tab->attr('title', $number);
            $tab->attr('class', 'WireTab');
    
            $markup = $this->modules->get('InputfieldMarkup');
            $markup->label = $this->_('Label ') . ' ' . $number;
            $markup->value  = "<h2>$number</h2>";
    
            $tab->append($markup);
            $form->append($tab);
        }
    
      echo $form->render();
    

    The only thing is it creates accordions instead of tabs, but when I work out the details of getting tabs ill post the solution. Thx.

    • Like 1
  6. I'm trying to figure out how to add tabs to an admin page for my module. 

    I tried copying the HTML from a page edit (where there are nice tabs that fit in with the existing UI)

    <ul class="WireTabs nav" id="PageEditTabs">
        <li><a href="#drafts" id="_drafts" class="on">Drafts</a></li>
        <li><a href="#history" id="_history">History</a></li>
    </ul>
    
    <ul class="Inputfields">
        <li class="Inputfield InputfieldWrapper InputfieldColumnWidthFirst" id="drafts" style="display: block;>
             my first tab (drafts)
        </li>
    
       <li class="Inputfield InputfieldWrapper InputfieldColumnWidthFirst" id="history" style="display: none;>
            my second tab (history)
        </li>
    </ul>
     
     
     
     

    ....

    But they didn't work. Wondering if there is a way to generate admin tabs in processwire for admin pages a module creates?

  7. It does work with just the ID. I also got an SQL error of 1066, but I tried a bunch of invalid stuff trying to make that query work how I wanted it ;-)

    The OR groups did exactly what I needed. Thanks!

    They are such an elegant and simple solution. I remember when they groupings where first introduced to the API and I don't think I really understood them and how helpful they where until now. 

    Thanks LostKobrakai!!!

  8. I'm looking  to use an OR selector with blank values. 

    project=1024|''  : RESULT:  SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'field_project'

    project=1024|    : RESULT:  same as above.

    I basically want all the results for "project=" and all the results for "project=1024" in one nice little result. 

    Any one know how I can accomplish the same result in another way?

    ProcessWire Version 2.5.3 

  9. Looking to hook into creating a new page after the new page has a $page->id. 

    Any one know what the correct hook might be?

    public function init(){
         $this->pages->addHookAfter('????', $this, 'myHookFunction');
    }
    

    Once I have the correct hook does any one know I can access the $newPage->id ?

    public function myHookFunction(HookEvent $event){
          $newPage = $event->arguments[0];  //would this be correct?
          $this->error('it worked here is the id of your new page:'.$newPage->id);
    }
    

    I might be able to jerry-rig it, if there is no hook, by hooking to save function, and comparing creation date with current date or something less elegant....I'm open to better and maybe less creative ways of solving this problem ;-)

  10. HI Nico, thanks for the response. I was running 0.60, I upgraded to 0.8.2 and it seems to have fixed the issue.

    Also in the google preview mode: if your URL is somewhat long will overlap on top of the Meta description. (it's a CSS issue, could always do a nowrap on the URL, or tuncate it, i'm not sure what google does.) just making you aware of the issue.

    Great plugin, really liking the the ability to set character limits. Great work!

    post-1913-0-09064000-1425315785_thumb.jp

  11. mindplay.dk: the idea of caching I mentioned earlier was more about storing and fetching whole pages out of the database faster, i'm curios to learn more about how you envision a $page->cache to work? sounds like  you want to see a cache for storing calculated values associated with a page.

    if($page->cache->averageRating){
        echo $page->cache->averageRatting
    }else{
         $page->setCache( 'averageRating',  caclulateAverageRating($page), '3 days' ); //no automatic clearing of cache...easy...
    }
    

    A possible way to store this kind of a cache and have it auto clear: (madeup code, to demo a possible way)

    $page->setCache( 'averageRating',  caclulateAverageRating($page), '1 year'
          /* clear on page changes of: */ '$page->siblings(),$page->parent', 
          /* clear on count change of: */ 'siblingCount=$page->singling->count()' ); //clears cache when new review is added

    only down side to having caches that automatically clear them selves is they are going to make your $pages->saves() more DB intensive & slower if you hook into that function to update the cache. Maybe even a whole lot slower if there are a lot of rules involved in when it should be cleared. Unless it is a cron job that runes ever hour or something, checking the DB: "did anything change, what changed? is it in my list of things to clear?" its hard to think of a one size fits all solution for clearing calculated caches automatically, since you are dealing with calculated values they could be coming from any combination of pages in the system. you would have to specify what what pages would need to be changed to clear your cache. it is going to be different for every kind of calculation. IE, what pages need to be cleared would be different for and "average rating"  then it would be for a cache of "top things voted by users."
     

    i'm just throwing out idea of how it could work, would be curios to know in more detail how you see it working and, if you see a one-size-fits-all solution out there for clearing the calculated caches. 

  12. Cool idea. The way I see many people storing objects in databases these days is JSON. There is some slight overhead in decoding big objects inside a database...if you are only grabbing a few fields from each $page object it's probably faster to use process wire's default approach to getting a field data. I'd image if you are getting lots of fields and need most of them to do a calculation then storing whole $pages as JSON inside a noSQL db like redis would give the largest speed boost. You will have fewer queries, you just spend your processor time decoding JSON objects (which should not be that bad). 

    I image a simple module that did this could JSON encode the $page object on $page->save ($page->save is used by all things that save pages including the PW control panel) and store it in the DB of choice, under #page id.

    if you wanted to pre-populate your current $page object with your cached version you could use.

    $page->getCached(); or something like that. 

    foreach( $veryComplexPages as $complexPage){
          $complexPage->getCached(); //would populate $complexPage->fields with the cached version if available.
          echo $complexPage->someField; //would use cached version gotten from the command above
    }

    As far as I know process wire by default will cache all fields that are set in memory, for example if $page->title is not NULL process wire will not try to search the database for it. This default behavior will make it easy to write a thrid party page cache module that gets the $page fields first.  Also process wire also only grabs the fields that you request, so If you don't request a lot of fields you will have minimum interaction with the database.

    ---

    Caching the $page->find() style functions. 
     

    The methods above do not seed up queries to the database that are string search related such as $pages->find(), which is probably the kind of queries that are taking up a the much of the overhead. if you wanted to store the results for those you would need another cache, maybe that stored page ID's returned from the $pages>find() method.
     

    EXAMPLE:

    $pages->find('body=*"somthing to search for"')->cache('2 days');

    One could use the API hook of the find() method, and use a hash of "body=*"somthing to search for" as a key to store the resulting page ID's in redis or MYSQL. That way you could save the results of huge and complex queries for a latter time as a list of page ID's.  This type of cache would also be harder to invalidate but it could still be done on save(). To do so you would have to search the results of all find queries that where ever cached looking for the a page ID that has changed. (that is going to be faster in MYSQL then redis), since you can't query redis. 

    ---

    would love to hear if any of these solution might be terrible and not work as I will be needing to implement some variations of them in the future. 

    • Like 1
  13. Right now when you lock a page it is hard to tell if i is locked until you try to save/open a page.

    • locked pages, could have a locked font-awesome icon next to them, or a different color.
    • On page open in the Admin panel you could get a warning message:
      "This page is locked John Smith on 2/3/2014 5:30pm. Page can not be saved without being unlocked."

    -----------

    Justing brining this up here incase some of these features would benefit from being in the core. right now i'm trying to build a module that does some of what I mentioned above. If these features already exist and I just have not seen them yet, let me know. 

  14. Jeez, so some reason I didn't see your notification. 

    I just upgraded to PW 2.4.9 and preview 2.5.0 and still get the ignore issue.

    CKEditor 1.1.8
     

    Seems to be just on the  $page->body field, so maybe its a CKeditor issue?

    post-1913-0-76863100-1406841492_thumb.pn

  15. Horst: Thanks for the very detailed explanation, It is just happening on the last image or two. It must be a PHP memory getting low (shared hosting account). I will use the PNG watermark method instead.  (thanks for the code example).

    Update: my shared hosting account on this site is giving me 64mb of RAM memory limit. I think that might be the issue right there. I tried the PNG method of watermarking, but my site still hangs my server or larger batches 20 images@1,000px.

×
×
  • Create New...