Jump to content
wumbo

Module: FieldtypeAssistedURL

Recommended Posts

Thank you for testing it, Adrian!

I will try to find out why it isn't working for me. It's just a local page to play and to get deeper into PW.

Share this post


Link to post
Share on other sites
2 minutes ago, sms said:

Thank you for testing it, Adrian!

I will try to find out why it isn't working for me. It's just a local page to play and to get deeper into PW.

Perhaps you have checked one of these two options in the settings for this module:

Prepend site's root path to local/relative URLs?
Allow relative/local URLs without "http://" at the beginning?

Either of those will break the lookup of the page for getting the title.

But again, Page Reference is much better for local links - one of the key reasons is that is stores the page ID which never changes, rather than the URL which may possibly break down the road.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you very much again. I have checked and unchecked these options but it doesn't work for me. But the Page Reference works perfectly:

<a href="<?php echo $page->link->url; ?>"><?php echo $page->link->title; ?></a>

:-)

  • Like 1

Share this post


Link to post
Share on other sites
On 8.3.2017 at 0:34 PM, pmichaelis said:

Hey,

thanks for that module. 

Maybe I missed something, but how to get the propoerties, like target, title, or rel in a page template?
Are these values stored anywhere?

Thanks for help.

Sorry, that I need to post my question again. Is there a chance for storing these values to the db?

Share this post


Link to post
Share on other sites
9 hours ago, pmichaelis said:

Is there a chance for storing these values to the db?

Not in this fieldtype as it stands because it only has a single inputfield. But you can create other fields for the purpose and add them to your template, maybe grouped inside a fieldset together with the Assisted URL field. Text fields for title and rel, and maybe a Select Options field would be good for target.

Share this post


Link to post
Share on other sites
11 hours ago, Robin S said:

Not in this fieldtype as it stands because it only has a single inputfield. But you can create other fields for the purpose and add them to your template, maybe grouped inside a fieldset together with the Assisted URL field. Text fields for title and rel, and maybe a Select Options field would be good for target.

Ok, thanks for the reply. I was just wondering, because the modal dialog keeps all these options. An altnernative would be to store the data (url, title, rel, target) as json in order to have them.

Share this post


Link to post
Share on other sites

Hello,

When I install this module I get this error:

 

Parse error: syntax error, unexpected '[' in ....../html/site/assets/cache/FileCompiler/site/modules/FieldtypeAssistedURL/FieldtypeAssistedURL.module on line 26

What could be the reason for this. Please help!

Share this post


Link to post
Share on other sites

@MaryMatlow what version of PHP are you using? You do need to be on 5.4+

  • Like 1

Share this post


Link to post
Share on other sites

Someone has already asked but... no way for multi-language?
I think that multi-language support should be the first thing to take care when developing a new module :)

Share this post


Link to post
Share on other sites

Hi,

I'm using the module "AssistedURL Field" inside a repeater. It works fine when I'm logged in as superuser. When I'm logged in with restricted rights (user account), I get this error when I click the button to select a URL:

Modules: Error initializing module: ProcessPageEditLink - You don't have access to this page

The error appears within the appearing modal window of "AssistedURL Field" in which the URL or page can be selected.

What am I missing?

Edited by kongondo
Moderator Note: Moved question to the module's support forum.

Share this post


Link to post
Share on other sites

Strange thing: If I give the user the same rights as the superuser, the error will still persist!

There is also a second error:

ProcessWire: The requested process does not exist

 

Bildschirmfoto 2018-01-16 um 10.10.27.png

Share this post


Link to post
Share on other sites

I have completely uninstalled and reinstalled the module, now. I also emptied the module cache. The error still exists. I'm greatly appreciated for any hint.

Share this post


Link to post
Share on other sites

@nabo For multilingual url fields maybe you could try this module with https://github.com/ryancramerdesign/FieldtypeURLLanguage?

Sorry @anyway, I'm not sure.  Maybe you can list the permission of the user's roles?  Does the user's role have the page-edit permission?  Did you enable access control for the field?  Edit the field and click on the "Access" tab to check.

Share this post


Link to post
Share on other sites
On 15/01/2018 at 10:35 PM, anyway said:

I get this error when I click the button to select a URL:


Modules: Error initializing module: ProcessPageEditLink - You don't have access to this page

I can confirm the problem. When the inputfield is inside a repeater item the module tries to open the link modal for the repeater page, but non-superusers do not have direct access to repeater pages. The core link modal (opened from CKEditor) does not have this problem because in the case of being inside a repeater item it opens the link modal for the container page instead.

You can apply the same logic to this module by editing InputfieldAssistedURL.module, changing line 62...

$btn->attr('data-page-id', $this->page->id);

...to (edit: there could be multiple nested repeaters, so best to borrow the code from ProcessPageEditLink)...

$page = $this->page;
$n = 0;
while(wireInstanceOf($page, 'RepeaterPage') && ++$n < 10) {
    $page = $page->getForPage();
}
$btn->attr('data-page-id', $page->id);

 

  • Like 1

Share this post


Link to post
Share on other sites

@gmclelland Thanks for your reply! Yes, the user's role has the page-edit permission. In the meantime, I've been able to "solve" the problem by giving page-view access to the system template "admin" to the user role Page-View, which is probably not optimal.

@Robin S Unfortunately, your code doesn't work for me. The repeater elements can no longer be opened. There is only a short twitch when you click on the elements. Any idea?

ProcessWire 3.0.62

 

 

Share this post


Link to post
Share on other sites
9 minutes ago, anyway said:

Unfortunately, your code doesn't work for me. The repeater elements can no longer be opened. There is only a short twitch when you click on the elements. Any idea?

Not sure. It works for me in PW 3.0.88. Seems like it could be a Javascript error - check your browser console to see if that reveals any issues.

assisted.gif.e821c5c765ae2a34b87058ad7a176340.gif

Share this post


Link to post
Share on other sites

You're right, it looks like a javascript error, but the console does not show any errors. After the click, the elements appear to open (the three dots disappear), but the accordions doesn't drop down.

Share this post


Link to post
Share on other sites
On 7/29/2015 at 2:07 PM, adrian said:

When selecting a page from the site, I would rather the field stores the ID of the page, just in case the path (and therefore the URL) is changed down the road.

Well, I am using this field for the first time and really wanted this functionality, so decided to fork the module here: 
https://github.com/adrianbj/processwire-fieldtype-assisted-url

It doesn't look any different from the users perspective, but on save/sleep it stores the page ID instead of the url and then on wakeup it converts to ID back to the URL.

This means that you can now move a page to a different parent, rename it, etc and the link URL will be automatically updated. 

It doesn't look like @wumbo is still active around here, so not sure if this will make it into the main version of the module, but it's there if others want it.

  • Like 5

Share this post


Link to post
Share on other sites

A few more enhancements:

It now handles local links with query string parameters - the stored link is still converted to a page ID with the query string appended. 

You can now also paste full http(s) links and if these are local links, they will be converted to a page ID and a local link will be returned when the value is requested.

  • Like 5

Share this post


Link to post
Share on other sites

One more small, but pretty important tweak - it now properly removes the tabs at the top in the UiKit theme. Important so that users aren't confused by the useless "Attributes" tab option.

I think I am pretty happy with it now that it is storing page IDs for local links, but I am  curious if anyone else is still using this module? Is there something else out there that I might have missed that provides a nice interface for choose links to local pages and also has the option to paste in an external link?

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the feedback @gmclelland - I don't have the need (and therefore the time) to look into the multilanguage side of things right now, but if others want to contribute, I am happy to maintain this fork going forward. Perhaps if we could get @wumbo to chime in to confirm he's no longer to going to support this, I could point the entry in the modules directory to my fork?

PS - I just emailed him via the address listed on his Github profile and it bounced and it's the same address he has used in his PW modules directory account. I don't have access to check the email for his forum account, but I am guessing these notifications are probably bouncing too. I don't really feel right switching things out without his permission, but also not sure how to move forward - anyone have any thoughts on this? I think maybe PW needs a policy on this, because it's bound to happen again with other modules.

PPS - I found another email address for him, so hopefully I will hear something soon.

  • Like 2

Share this post


Link to post
Share on other sites
On 1/16/2018 at 12:54 PM, Robin S said:

You can apply the same logic to this module by editing InputfieldAssistedURL.module, changing line 62...

Thanks Robin - you saved me some time figuring this out - much appreciated. I have pushed this change to my fork here: https://github.com/adrianbj/processwire-fieldtype-assisted-url

 

  • Like 1

Share this post


Link to post
Share on other sites

I've been using this field and appreciated the string of page IDs for PW pages.

I'm wondering if instead of converting the ID to a URL before returning it, how about returning an object?

So, Instead of $page->AssistedURL returning just a string "/mypage/" (internal) or "http://www.anothersite.com/" (external), it returns the object:

// Internal PW page
{
    'id' => 1234,
    'name' => 'mypage',
    'url' => '/mypage/',
    'httpUrl' => 'http://my-processwire-root.com/mypage/'
}

// External link
{
    'id' => 0,                                 // 0 or null
    'name' => '',                              // blank or null
    'url' => 'http://www.anothersite.com/',
    'httpUrl' => 'http://www.anothersite.com/' // url and httpUrl are the same for external links
}

// Accessing the data
$page->AssistedURL->id
$page->AssistedURL->name
$page->AssistedURL->url
$page->AssistedURL->httpUrl

For backwards compatibility, could $page->AssistedURL by itself be a magic method to return the URL as it currently does?

By returning relative and absolute links, the same field could be used in multiple situations (eg, on an internal menu, and in an email template).

 

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MoritzLost
      This is a new module that provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions.
      The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu:
      Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides:
      An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README.
      Beta release
      Note that I consider this a Beta release. Since the module is relatively aggressive in deleting some caches, I would advise you to install in on a test environment before using it on a live site.
      Let me know if you're getting any errors, have trouble using the module or if you have suggestions for improvement!
      In particular, can someone let me know if this module causes any problems with the ProCache module? I don't own or use it, so I can't check. As far as I can tell, ProCache uses a folder inside the cache directory to cache static pages, so my module should be able to clear the ProCache site cache as well, I'd appreciate it if someone can test that for me.
      Future plans
      If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind:
      Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions!
      Links
      https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory

    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="optin" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="optin" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: https://github.com/blaueQuelle/privacywire/tree/master
      Download: https://github.com/blaueQuelle/privacywire/archive/master.zip
      I would love to hear your feedback 🙂
      Edit: Updated URLs to master tree of git repo
       
    • By David Karich
      Admin Page Tree Multiple Sorting
      ClassName: ProcessPageListMultipleSorting
      Extend the ordinary sort of children of a template in the admin page tree with multiple properties. For each template, you can define your own rule. Write each template (template-name) in a row, followed by a colon and then the additional field names for sorting.
      Example: All children of the template "blog" to be sorted in descending order according to the date of creation, then descending by modification date, and then by title. Type:
      blog: -created, -modified, title  Installation
      Copy the files for this module to /site/modules/ProcessPageListMultipleSorting/ In admin: Modules > Check for new modules. Install Module "Admin Page Tree Multible Sorting". Alternative in ProcessWire 2.4+
      Login to ProcessWire backend and go to Modules Click tab "New" and enter Module Class Name: "ProcessPageListMultipleSorting" Click "Download and Install"   Compatibility   I have currently tested the module only under PW 2.6+, but think that it works on older versions too. Maybe someone can give a feedback.     Download   PW-Repo: http://modules.processwire.com/modules/process-page-list-multiple-sorting/ GitHub: https://github.com/FlipZoomMedia/Processwire-ProcessPageListMultipleSorting     I hope someone can use the module. Have fun and best regards, David
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "https://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


×
×
  • Create New...