WSN Knowledge Base https://scripts.webmastersite.net/wsnkb/manual en-us Open Hours At Admin Panel -> Settings -> Switches, you have an 'Open hours' option. https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/switches/open-hours-656.html Wed, 17 May 2017 23:10:48 GMT https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/switches/open-hours-656.html
Note that up to two sets of hours are supported for each day (this allows a place to have split hours with a break for lunch, like 8 AM - 12 PM and 1 PM - 5 PM). Using 3 or more sets for the same day may not sort correctly if entered non-chronologically, but very few businesses have 3 sets.

If you'd like to display the hours somewhere outside of the default location, you can use {LINKSHOWFIELD[hours]} or for a customized version you can copy and modify the custom display html from the Link Fields page into any other template where you're within the scope of a article.

In the open hours display, today's hours are automatically bolded. This styling is from the application of the css class todayhours to all sets of hours that are for today. You can re-style as desired by adding .todayhours { } to your stylesheet.

There are a few useful template variables related to the hours:
{LINKHASHOURS} - Tests if the article has any hours entered (for use in conditioanls).
{LINKISOPEN} - Tests if the business is currently open, for use in conditionals. Returns false if it's closed or has no hours entered.
{LINKCLOSINGSOON} - Tests if the business is currently open but is going to close within the next 60 minutes. For use in conditionals. Returns false if closed or if open for more than another hour. You can pass a parameter for a different number of minutes, like {LINKCLOSINGSOON[30]).
{LINKOPENSTATUS} - Displays "open", "closing soon" or "closed" (in English, so best used in conditionals)... or blank if there are no hours entered.

Note: these variables make the assumption that the viewer is in the same timezone as the business.

People can search by hours with either the simple or advanced search. For advanced searching, four radio options appear: "Any Time" (does not filter by hours), "Now" (filters to businesses currently open), "On __ at __" (filters to a particular time) and "On __ from __ until at least __" (filters to businesses open for the entirity of that length of time).

For any search form you may be using, whether it's simple or advanced search, you can include this simple checkbox to allow people to filter to businesses currently open: <input type="checkbox" name="openhoursquerytype" value="now">

Because the filtering by hours happens mostly on the php side rather than in the database query (which only filters by day open), you will notice that searches with large numbers of results have a different number of articles per page than normal. To account for the probability that the majority of the articles may be currently closed, WSN queries several times more articles than usual on the first page and then dynamically alters the number of articles per page for the subsequent pages to a value that seems appropriate to the results, in hopes of giving you something similar to the number of displayed results you want.]]>
Combination Simple and Advanced Search Sometimes you may wish to blend the simple search box and advanced field filter searches. As of version 10.1.6 Beta 4 and later, this is now possible. https://scripts.webmastersite.net/wsnkb/manual/configuration/searching/combination-simple-and-advanced-search-655.html Tue, 21 Mar 2017 20:51:09 GMT https://scripts.webmastersite.net/wsnkb/manual/configuration/searching/combination-simple-and-advanced-search-655.html
Start with your advanced search form. To construct a custom advanced search form, one easy approach is to use your browser's "view source" option when viewing the advanced search page on your site. Then use ctrl+f to locate "Find Articles". Copy that whole box and then remove whichever article fields you don't want searched in your custom form.

To incorporate the simple search box into the custom advanced search box you've made, let's make it the first row of the table just below <table> like this:
<tr><td>Any searchable field</td><td><select name="condition">{FUNC_SIMPLESEARCHCONDITIONOPS}</select></td><td><input type="text" name="search" class="standardinput" placeholder="type your simple search term here"></td></tr>


If you prefer not to allow a choice of condition for the simple search, replace the condition selector with <input type="hidden" name="condition" value="{DEFAULTSEARCHTYPE}"> to use the default simple search type automatically.]]>
Playing MP3 Audio Files For some websites, simply linking an MP3 file for download when it's uploaded to a article isn't good enough -- you may want a built-in audio player i https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/playing-mp-audio-files-654.html Thu, 16 Feb 2017 22:59:46 GMT https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/playing-mp-audio-files-654.html
To put the audio player in the attached files section of the details page, go to Admin Panel -> Articles -> Article Fields and edit the "Attach Files" field. Find the "Custom Display HTML" section near the bottom, and add this at the top of that box:
<!-- BEGIN TOPLIST -->
<CONFIG>attachments,sortorder;time,50,ascending;ascending,type='link' AND objectid={LINKEFFECTIVEID} AND (filetitle LIKE '%.mp3'),,,0,0,0,0,0,0,,0</CONFIG>
<div class="audio"><audio controls="controls" src="{DIRURL}/download.php?attachid={ATTACHID}&id={ATTACHID}&action=stream" preload="none"></audio></div>
<!-- END TOPLIST -->


If you wish to forbid downloads and only allow listening via the player, find this section near the bottom:
<ul>
<!-- BEGIN LINK ATTACHMENTS -->
<IF not {ATTACHISIMAGE}>
<li><a href="{ATTACHDOWNLOADURL}" title="{ATTACHLABEL}">{ATTACHFILETITLE}</a> ({ATTACHKB} {LANG_GENERAL_KB}, {ATTACHDOWNLOADS} {LANG_DETAILS_DOWNLOADS})</li>
</IF>
<!-- END LINK ATTACHMENTS -->
</ul>
and replace it with
<ul>
<!-- BEGIN LINK ATTACHMENTS -->
<IF not {ATTACHISIMAGE}>
<IF {ATTACHEXTENSION} is not mp3>
<li><a href="{ATTACHDOWNLOADURL}" title="{ATTACHLABEL}">{ATTACHFILETITLE}</a> ({ATTACHKB} {LANG_GENERAL_KB}, {ATTACHDOWNLOADS} {LANG_DETAILS_DOWNLOADS})</li>
</IF>
</IF>
<!-- END LINK ATTACHMENTS -->
</ul>


That's it! You'll now automatically see an audio player on the details pages of articles that have mp3 files.]]>
System Cron to Ensure Timed Tasks and Helper Completion On a low traffic site, or a site where most traffic is guests and guest page caching is turned on, you may find that things aren't getting done. https://scripts.webmastersite.net/wsnkb/manual/other/system-cron-to-ensure-timed-tasks-and-helper-completion-653.html Thu, 12 Jan 2017 03:54:34 GMT https://scripts.webmastersite.net/wsnkb/manual/other/system-cron-to-ensure-timed-tasks-and-helper-completion-653.html
The solution to this problem is to set up a system cron to make sure all pending tasks get run reasonably often. You can do this through your web hosting control panel -- search it for "cron" and you'll find a cron jobs page in every popular hosting control panel. Using that interface, set up a cron to run every 30 minutes (that should be sufficient for most situations) which will run the following command:

curl --silent http://yoursitepath/helper.php?action=helpercron >/dev/null 2>&1

Be sure to replace yoursitepath with your installation URL. If your server doesn't have curl, you may need to use wget instead:

wget -O -q 'http://yoursitepath/helper.php?action=helpercron']]>
Dropzone for drag and drop uploads For some users, drag and drop is easier or more intuitive than using a file selector to upload files. https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/dropzone-for-drag-and-drop-uploads-652.html Tue, 10 Jan 2017 23:34:31 GMT https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/dropzone-for-drag-and-drop-uploads-652.html
There are three templates we'll need to change at Admin -> Themes -> Manage Templates. First, in the "File Uploader" template, replace the section
<div class="fileupload-buttonbar">
<div class="fileupload-buttons">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="fileinput-button">
<span>Add files...</span>
<input type="file" name="files[]" id="uploaderfiles" multiple>
</span>
<span class="fileupload-process"></span>
</div>
<div class="fileupload-progress fade" style="display:none">
<!-- The global progress bar -->
<div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-extended">&nbsp;</div>
</div>
</div>
with
<div class="dropzones" id="dropzone">
<br><br>Drag and drop files here, or click to choose files
<input type="file" name="files[]" id="uploaderfiles" multiple style="display: none;">
</div>
<div class="fileupload-buttonbar">
<div class="fileupload-progress fade" style="display:none">
<!-- The global progress bar -->
<div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-extended">&nbsp;</div>
</div>
</div>


Next, in the "Additional Document Ready Function Content" template, add this:


$("#dropzone").on("click",function(){// here when click on dropzone div
$("#dropzone input[type='file']").trigger('click');// then trigger input type=file change event
});
$("#dropzone input[type='file']").on("click",function(e){ e.stopPropagation(); });

$(document).bind('dragover', function (e) {
var dropZone = $('#dropzone'),
timeout = window.dropZoneTimeout;
if (!timeout) {
dropZone.addClass('in');
} else {
clearTimeout(timeout);
}
var found = false,
node = e.target;
do {
if (node === dropZone[0]) {
found = true;
break;
}
node = node.parentNode;
} while (node != null);
if (found) {
dropZone.addClass('hover');
} else {
dropZone.removeClass('hover');
}
window.dropZoneTimeout = setTimeout(function () {
window.dropZoneTimeout = null;
dropZone.removeClass('in hover');
}, 100);
});


Finally, in your stylesheet at the bottom, add

.dropzones
{
background: #FFFFFF;
background-position: center;
width: 100%;
height: 190px;
text-align: center;
font-weight: bold;
font-size: 150%;
border: 3px dashed #AACCFF;
cursor: pointer;
}

#dropzone.in
{
width: 100%;
height: 190px;
line-height: 200px;
font-size: larger;
}
#dropzone.hover
{
background: #EEEEEE;
background-position: center;
}
#dropzone.fade
{
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
opacity: 1;
}


Change the colors and other details on .dropzones above as you desire to fit your theme.

That's all. Check any page where you upload files and you'll now see a dropzone box which you can drag files to, or which you can click anywhere inside to get a file chooser.]]>