Jump to content

benbyf

Members
  • Content Count

    645
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by benbyf

  1. benbyf

    DropboxAPI

    Hi everyone. I've made a tiny module for adding a folder select input in the admin, this allows you to select a folder path from the dropbox account associated with the DropboxAPI module. This module requires the above DropboxAPI module to work. I made this with a lot of great advice from @abdus though much simpler than I think they would have done it. TBH I got totally confused about how to implement fieldtypes and inputfield modules and I hope that there could be an effort for tutorials or docs on this - e.g. requirements to register a inputfield, setting and using config options, interacting with the input on a page, creating a fieldtype and requirements, schema best practise.. etc. https://github.com/benbyford/InputfieldDropbox install / setup: DropboxAPI module download and install DropboxAPI module, adding to your site/modules folder install in modules section of admin goto: https://www.dropbox.com/developers/apps add new app choose dropbox api, folder access, then name the folder which will appear in your dropbox /apps/ copy api codes and add to DropboxAPI settings. InputfieldDropbox module download and install InputfieldDropbox module, adding to your site/modules folder install in modules section of admin add new textarea field in processwire admin, save within Details tab, select Dropbox on Input type select box. This gif shows me selecting from options found within my dropbox account within folder /apps/theNameOfTheRegisteredFolder.
  2. Pithy comment alert: If its not broke. Give it ago a report back (this harps back to simply making your own admin using the API). and Age over beauty (there's probably more where those come from
  3. Vanilllllllllla js for the win. Although for me its the right tool for the job. Jquery is mostly a sugar to make browsers play nice, and a toolkit of repeatable actions (fade, move, etc). Vue and React are MV* for two way data binding... so basically doing mostly a different job (altough like angular your find front end animation helpers too). Soooo, frameworks go out of fashion (remember when everyone was using Backbone?!), but vanilla won't and right tool for the job.
  4. benbyf

    DropboxAPI

    Still doesnt make sense to me, anyone else got a tutorial or good examples of how inputfields and field types can be implemented? Or maybe can even pay someone for an hours english tutorial over hangout or skype, as would like to get to gribs with this for future modules. Thanks
  5. Hi @cleanboy I think i'm right in saying that the payment modules are wrappers for the Stripe and Paypal libraries, therefore you can access the Stripe methods in Processwire. That said, I think you were asking how to use it, the example shows how you can pass amounts and basic customer information to Stripe, if a successful request is made Stripe pass you back a payment button which enables the customer to click and add their card details. The module does not store any information on the purchase, what was purchased, who by or anything infact, its just a way of interacting with Stripe or Paypal. If you need to track payments or are selling physical items you will need someway of keeping track of transactions and items like a store e.g. padloper or create your own tracking (which I've done several times mainly because I've been selling digital goods like subscriptions so have little need for item tracking or postage variables). Hope that helps.
  6. benbyf

    DropboxAPI

    Cool thanks @abdus but again how the hell was I supposed to know that??? seems an old choice to have somethings just turn up in the admin (Process modules for example), and other types to be hookable without much reference. Think maybe a config, or function call would do the job... ?
  7. benbyf

    DropboxAPI

    like poking a bear, how we supposed to know any of this?! I don't get any inputfields for text, but i do for textarea. How would i add one for text, or any other fieldtype , and is there any docs on this would be the actually question i guess... super infuriating.
  8. benbyf

    DropboxAPI

    Sorry, im super dumb obviously, but dont know need the fieldtype module to implement the new inputfield? how do you choose the inputfield otherwise?
  9. benbyf

    DropboxAPI

    Thanks @abdus (also nice website!), I'm justing working on the module now and finding i need both inputfield and fieldtypes modules to get things going. Think I'm having trouble still on what both of their relationship is together and what functions are required. I now have them both shoing up (i.e. as a fieldtype to select and showing something on page edit), but can't currently save the info not ideal - I was went back to the MApMaker module for reference which helped abit but couldnt instruct me on how these two modules working toegther.
  10. benbyf

    DropboxAPI

    try really quickly to start writing a folder select fieldtype module to be used with the DropboxAPI module. However, I didnt get very far as the fieldtype inputfield module structure is super confusing to me, is there any documentation about creting a simple field type - and yes I've looked at the mapmaker module, i bascially want a list saying you need XYZ functions to make it appear (as I tried implementing from info in Fieldtype.php and wouldnt show up as an option when creating a new field). Any help would be grateful.
  11. seem to be getting a number "1" added to the first custom field for some reason.
  12. Sorry this has been on hiatus as i've had lots of work on and had to build a shop from the ground up in order to sell it :/
  13. HI! I think I saw a little while ago a image field module that added loads of features including adding more fields to a specific image in a image field, I can't find it googling anyone point me in the right direction?
  14. benbyf

    DropboxAPI

    Just in case its useful for anyone, this is my function for creating a folder list with public links to files: <?php namespace ProcessWire; use Kunnu\Dropbox\Dropbox; use Kunnu\Dropbox\DropboxApp; use Kunnu\Dropbox\DropboxFile; $drop = $modules->get('DropboxAPI'); //Configure Dropbox Application $app = new DropboxApp($drop->app_key, $drop->app_secret, $drop->authorization_code); //Configure Dropbox service $dropbox = new Dropbox($app); // get folder from user $folder_path = ""; $folder_path = $user->folder; // get items from dropbox folder $listFolderContents = $dropbox->listFolder($folder_path); //root folder is the folder you nominated in the Dropbox App config. Refer doco $items = $listFolderContents->getItems(); function listItems($items, $dropbox, $depth = 0){ $out = "<ul class='depth-{$depth}'>"; foreach ($items as $item){ // get file name $name = $item->getName(); // getPathLower $path = $item->getpathLower(); $thumbPath = "no thumb"; $thumbHasExt = strpos($path, '.'); // file if($thumbHasExt && $path){ $file = $dropbox->getTemporaryLink($path); $link = $file->getLink(); $ext = substr($path, $thumbHasExt+1); // fontawesome file name icons $icon = "fa-file-o"; switch ($ext) { case 'png': case 'jpg': case 'gif': case 'psd': case 'tiff': $icon = 'fa-file-image-o'; break; case 'pdf': $icon = 'fa-file-pdf-o'; break; case 'mp3': case 'wav': $icon = 'fa-file-audio-o'; break; case 'mov': case 'mp4': case 'm4a': $icon = 'fa-file-video-o'; break; case 'doc': case 'docx': $icon = 'fa-file-word-o'; break; case 'xls': case 'xlsx': $icon = 'fa-file-excel-o'; break; case 'ppt': case 'pptx': $icon = 'fa-file-powerpoint-o'; break; case 'zip': case 'rar': $icon = 'fa-file-archive-o'; break; } $out .= "<li><span class='{$icon} fa'></span><a title='click to download' href='{$link}'>{$name} {$ext}</a></li>"; // folder }else{ ++$depth; $out .= "<li><span class='fa-folder-open-o fa'></span>{$name}"; $listSubFolderContents = $dropbox->listFolder($path); $items = $listSubFolderContents->getItems(); // get list of files in subfolder $out .= listItems($items, $dropbox, $depth); $out .= "</li>"; } } $out .= "</ul>"; return $out; } // get depth 0 folder items $out = listItems($items, $dropbox, $depth);
  15. benbyf

    DropboxAPI

    WORKED!!!!! WHHHHOOOOPPPP. Thank you! Obvioulsy a bit of a n00b still for "proper" dev stuff. any good articles about composer best practises? Thanks
  16. benbyf

    DropboxAPI

    Good point, not needed to use composer with Processwire yet, so didnt reach for it this time. I'm guess thats the problem then? Also no mention in teh installation notes either but might because i dont know what to look for maybe? Am i right in saying using composer also makes a module incompatible with the PW admin module installer?
  17. benbyf

    DropboxAPI

    yep, updated. But like i mentioned there is simply no file called autoload in the repo... let allow a folder called vendor
  18. benbyf

    DropboxAPI

    soooo confused about this module, how did you get it to work?! e.g. /vendor/ and autoload.php folder/files don't exist in the repo.
  19. benbyf

    DropboxAPI

    Hi sorry not big PHP dev (mainly front end) and none of the module makes sense to me (lots of namespaces). getting errors like this: Class 'Kunnu\Dropbox\DropboxApp' not found in /srv/users/serverpilot/apps/fabricacapital/public/site/templates/dropbox.php:8 on the public pages implementing either of teh code demos above. Any help would be ace! Also I mamanged to get a app code directly in the dropbox developer portal, so no need for the token generating step above.
  20. maybe im looking at an old version then as i dont have the tree link.
  21. love both default and reno themes (as they get the job done without over engineering), however find it actually quite difficult to get to the Page Tree on the Reno theme, which is bascially the gate way to edit pages...
  22. PW Admin doesn't really function without javascript, and my question would be, should we care? I think, however, either way it might be nice to add a "<span>Javascript doesn't seem to be available, therefore you may not be able to access the full functionality of the admin</span>" somewhere maybe?
  23. OK soooooooo, may have fixed it. Doing everything over Ajax and somehow it was working originally using the basic implemtation in the docs. However I finally got to the bottom of it and it wasn't keeping take of the price after returning from Stripe to finalise. So I added a flip flop variable for the price so if it's not there it grabs it from the session. $amount = $itemPage->price; // save price for later if($amount == 0){ $amount = $session->get('price'); }else{ $session->set('price',$amount); } $payment->addProduct($title, $amount, 1);
×
×
  • Create New...