Telerik RadDatePicker/RadTimePicker getting and setting value in client side

RadDatePicker
To Get

var RadDatePicker = $find("<%= RadDatePicker.ClientID %>");
RadDatePicker.get_selectedDate();//getting selected date
RadDatePicker.get_minDate();//getting minium date
RadDatePicker.get_maxDate();//getting maximum date

To Set

var RadDatePicker = $find("<%= RadDatePicker.ClientID %>");
RadDatePicker.set_selectedDate();// setting date
RadDatePicker.set_minDate();// setting minimum date
RadDatePicker.set_maxDate();// setting maximum date

RadTimePicker
To Get

var RadTimePicker = $find("<%= RadTimePicker.ClientID %>");
RadTimePicker.get_dateInput().get_value();

To Set

var RadTimePicker = $find("<%= RadTimePicker.ClientID %>");
RadTimePicker.get_dateInput().set_value();

Adding options to select tag using jquery

By using jquery we can easily add options to select tag.

jQuery


 $("#select").append($("<option></option>").val(1).html("One"));
 $("#select").append($("<option></option>").val(2).html("Two"));
 $("#select").append($("<option></option>").val(3).html("Three"));

=========================================================

HTML


<select id="select">
</select>

Demo

Frames attribute,style adjustment by triggering button inside frames using jquery

To change the attribute,style of a frameset/iframe by triggering any event inside the source file try this below code

iframe

$(".button").click(function(){$('iframe', top.document).eq(0).attr('height', '100px');});

frameset

$(".button").click(function(){$('frameset', top.document).eq(0).attr('rows', '100,*');});

Wall photos album in phpFox

In phpFox  the shared photos in wall are just uploaded.It does not create any album like “Wall Photos” similar to facebook.You can make use of this function by simple code customization.

Goto phpfox/module/photo/include/service/process.class.php

and find the function

public function add

Need to customize this function

after this codes

$oParseInput = Phpfox::getLib('parse.input');
// Create the fields to insert.
$aFields = array();

insert this codes


$fzk_check_album=$this->database()->select('*')
->from(Phpfox::getT('photo_album'))
->where('name = "Wall Photos" AND user_id =' . $iUserId)
->execute('getRow');
if(!empty($fzk_check_album))
{
$aVals['album_id']=$fzk_check_album['album_id'];
$aVals['set_album_cover']=0;
}
else
{

$fzk_aVals['name']="Wall Photos";
$fzk_aVals['description']="Wall Photos";

$fzk_aFields = array(
'name',
'module_id',
'group_id' => 'int',
'privacy' => 'int',
'privacy_comment' => 'int'
);
$fzk_aFieldsInfo = array(
'description'
);
$fzk_aFields['user_id'] = 'int';
$fzk_aFields[] = 'time_stamp';
// Add the users ID to the fields array
$fzk_aVals['user_id'] = Phpfox::getUserId();
// Add a time_stamp
$fzk_aVals['time_stamp'] = PHPFOX_TIME;

$fzk_aVals['name'] = $oParseInput->clean($fzk_aVals['name'], 255);
$fzk_aVals['description'] = $oParseInput->clean($fzk_aVals['description'], 255);

$fzk_iId = $this->database()->process($fzk_aFields, $fzk_aVals)->insert(Phpfox::getT('photo_album'));
$fzk_aFieldsInfo['album_id'] = 'int';
$fzk_aVals['album_id'] = $fzk_iId;
$this->database()->process($fzk_aFieldsInfo, $fzk_aVals)->insert(Phpfox::getT('photo_album_info'));
$aVals['album_id']=$fzk_iId;
$aVals['set_album_cover']=1;
}

If you feel customizing core files is not good method you can make use of phpFox plugin hooks

Using Plugin is the best method .So you need to create a plugin in your custom module

Goto phpfox/module/yourmodule/include/plugin and create a file photo.service_process_add__end.php and insert the below code in that file

$oParseInput = Phpfox::getLib('parse.input');
$fzk_check_album=$this->database()->select('*')
->from(Phpfox::getT('photo_album'))
->where('name = "Wall Photos" AND user_id =' . $iUserId)
->execute('getRow');

if(!empty($fzk_check_album))
{
$fzk_iAlbumId=$fzk_check_album['album_id'];
$this->database()->update(Phpfox::getT('photo'), array('is_cover' => '1','type_id' => '0','album_id' => (int) $fzk_iAlbumId), 'photo_id = ' . (int) $iId);
}
else
{
$fzk_aVals['name']="Wall Photos";
$fzk_aVals['description']="Wall Photos";
$fzk_aVals['name'] = $oParseInput->clean($fzk_aVals['name'], 255);
$fzk_aVals['description'] = $oParseInput->clean($fzk_aVals['description'], 255);
$fzk_aFields = array(
'name',
'module_id',
'group_id' => 'int',
'privacy' => 'int',
'privacy_comment' => 'int'
);
$fzk_aFieldsInfo = array(
'description'
);
$fzk_aFields['user_id'] = 'int';
$fzk_aFields[] = 'time_stamp';
// Add the users ID to the fields array
$fzk_aVals['user_id'] = Phpfox::getUserId();
// Add a time_stamp
$fzk_aVals['time_stamp'] = PHPFOX_TIME;
$fzk_iId = $this->database()->process($fzk_aFields, $fzk_aVals)->insert(Phpfox::getT('photo_album'));
$fzk_aFieldsInfo['album_id'] = 'int';
$fzk_aVals['album_id'] = $fzk_iId;
$this->database()->process($fzk_aFieldsInfo, $fzk_aVals)->insert(Phpfox::getT('photo_album_info'));
$this->database()->update(Phpfox::getT('photo'), array('is_cover' => '0','type_id' => '0','album_id' => (int) $fzk_iId), 'photo_id = ' . (int) $iId);
}

Reading a CSV file using JQuery

HTML

 <input type="file" name="filename" id="filename">

JQuery

Reading CSV


$("#filename").change(function(e) {

if (e.target.files != undefined) {
 var reader = new FileReader();
 reader.onload = function(e) {
 var csvval=e.target.result.split("\n");
 var csvvalue=csvval[0].split(",");
 var inputrad="";
 for(var i=0;i<csvvalue.length;i++)
 {
 var temp=csvvalue[i];
 var inputrad=inputrad+" "+temp;
 }
 $("#csvimporthint").html(inputrad);
 $("#csvimporthinttitle").show();
 };
 reader.readAsText(e.target.files.item(0));

}

return false;

});

Checking Whether CSV


var ext = $("input#filename").val().split(".").pop().toLowerCase();

if($.inArray(ext, ["csv"]) == -1) {
 alert('Upload CSV');
 return false;
 }

Demo

Simple Slideshow

HTML

 <div id="slideshow">
 <div><img src="/file/pic/photo/image1" alt="" /></div>
 <div><img src="/file/pic/photo/image2" alt="" /></div>
 <div><img src="/file/pic/photo/image3" alt="" /></div>
 </div>

CSS

 #slideshow {
margin: 50px auto;
position: relative;
width: 240px;
height: 240px;
padding: 10px;
box-shadow: 0 0 20px rgba(0,0,0,0.4);
 }
#slideshow > div {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
}

JQuery

 jQuery(document).ready(function(){
 $("#slideshow > div:gt(0)").hide();setInterval(function() {
 $('#slideshow > div:first')
 .fadeOut(1500)
 .next()
 .fadeIn(1500)
 .end()
 .appendTo('#slideshow');
 }, 2000);
 });

Demo