WSN Knowledge Base https://scripts.webmastersite.net/wsnkb/manual en-us 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.]]>
Loading Presupplied Data Sets When installing any WSN script, the 'Pre-Load Data' section in the installer gives you the option to give your site the head start of using one of the https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/importing/loading-presupplied-data-sets-651.html Sun, 04 Dec 2016 16:54:59 GMT https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/importing/loading-presupplied-data-sets-651.html When installing any WSN script, the "Pre-Load Data" section in the installer gives you the option to give your site the head start of using one of the provided data sets. These data sets provide commonly-desired category structures, or in some cases even article data. The datasets currently available as of this writing (note some of these options may not show for some of the scripts where they're not really relevent):

Business categories: categories and subcategories for types of businesses, ideal for starting a business directory
Business categories by state/province: same as above but with the top level categories being USA states and Canadian provinces, with the business categories nested below that
USA cities by county by state: all USA cities and towns with more than a few thousand people, organized into county subcategories and state top level categories
USA counties by state: all USA counties as subcategories organized by state top level categories
USA states: the 50 USA states as top level categories
Counties of single state: you'll be prompted to select a USA state, and the counties of that state will be the top level categories
Cities by county of single state: you'll be prompted to select a USA state, and the state's counties will be top level categories while the state's towns will be subcategories.
PAD categories: the official software categories from the PAD shareware format
PAD articles (60K): tens of thousands of software articles organized by category
PAD articles (16K): a more carefully cultivated set of software articles organized by category
Web scripts categories: categories appropriate for a directory of web scripts

It's best if you make the correct selection during installation, but sometimes you may want to change your data set after you've already installed. This is possible. First, you must delete your current site data (categories, articles and associated info) and be sure that you really want to do that. Go to Admin Panel -> Miscellaneous -> Advanced Options and place the following in the "Run SQL" box:

TRUNCATE TABLE {PREFIX}categories;
TRUNCATE TABLE {PREFIX}links;
TRUNCATE TABLE {PREFIX}comments;
TRUNCATE TABLE {PREFIX}ratings;

Run that. Now your next step is to load one of the pre-loadable data sets. You'll do this by visiting a special URL in your web browser while logged in as an administrator. The URL varies slightly depending on which data you want to load:

Business categories: youradminpanelurl/loaddata.php?filled=1&datasource[0]=businesscategories&dataindex=0
Business categories by state/province: youradminpanelurl/loaddata.php?filled=1&datasource[0]=businesscategoriesbystate&dataindex=0
USA cities by county by state: youradminpanelurl/loaddata.php?filled=1&datasource[0]=cities&dataindex=0
USA counties by state: youradminpanelurl/loaddata.php?filled=1&datasource[0]=counties&dataindex=0
USA states: youradminpanelurl/loaddata.php?filled=1&datasource[0]=states&dataindex=0
Counties of single state:
youradminpanelurl/loaddata.php?filled=1&datasource[0]=statecounties&dataindex=0&state=California
Cities by county of single state:
youradminpanelurl/loaddata.php?filled=1&datasource[0]=statecities&dataindex=0&state=California
PAD categories: youradminpanelurl/loaddata.php?filled=1&datasource[0]=pad&dataindex=0
PAD articles (60K): youradminpanelurl/loaddata.php?filled=1&datasource[0]=padarticles&dataindex=0
PAD articles (16K): youradminpanelurl/loaddata.php?filled=1&datasource[0]=padarticlesalt&dataindex=0
Web scripts categories: youradminpanelurl/loaddata.php?filled=1&datasource[0]=scriptdirectory&dataindex=0

For the single state ones, be sure to change California to your desired state at the end of the URL.

]]>