Added : Language Phrases

Fixed : Editors Pick
Added : Converted photo upload form to Smarty Function
This commit is contained in:
Fawaz 2010-12-28 13:56:44 +00:00
parent 4c1e63e46a
commit 0445c2886d
25 changed files with 413 additions and 215 deletions

View file

@ -152,4 +152,75 @@ body,td,th {
</tr>
</table>
</body>
</html>', '');
</html>', '');
/* LANG QURIES - COLLECTION AND PHOTOS */
INSERT INTO `cb_phrases` (`lang_iso`, `varname`, `text`) VALUES
('en', 'photo_not_exist', 'Photo does not exists.'),
('en', 'photo_not_exists', 'Photo does not exists.'),
('en', 'photo_success_deleted', 'Photo has been deleted successfully.'),
('en', 'cant_edit_photo', 'You can not edit this photo.'),
('en', 'you_hv_already_rated_photo', 'You have already rated this photo.'),
('en', 'photo_rate_disabled', 'Photo rating is disabled.'),
('en', 'need_photo_details', 'Need photo details.'),
('en', 'embedding_is_disabled', 'Embedding is disabled by user.'),
('en', 'photo_activated', 'Photo is activated.'),
('en', 'photo_deactivated', 'Photo is deactivated.'),
('en', 'photo_featured', 'Photo is marked featured.'),
('en', 'photo_unfeatured', 'Photo is marked unfeatured.'),
('en', 'photo_updated_successfully', 'Photo is updated successfully.'),
('en', 'success_delete_file', '%s files has been deleted successfully.'),
('en', 'no_watermark_found', 'Can not find watermark file.'),
('en', 'watermark_updated', 'Watermark is updated'),
('en', 'upload_png_watermark', 'Please upload 24-bit PNG file.'),
('en', 'photo_non_readable', 'Photo is not readable.'),
('en', 'wrong_mime_type', 'Wrong MIME type provided.'),
('en', 'you_dont_have_photos', 'You dont have any photos'),
('en', 'you_dont_have_fav_photos', 'You dont have any favorite photos'),
('en', 'manage_orphan_photos', 'Manage Orphan Photos'),
('en', 'manage_favorite_photos', 'Manage Favorite Photos'),
('en', 'manage_photos', 'Manage Photos'),
('en', 'you_dont_have_orphan_photos', 'You dont have any orphan photos'),
('en', 'item_not_exist', 'Item does not exist.'),
('en', 'collection_not_exist', 'Collection does not exist'),
('en', 'selected_collects_del', 'Selected collections have been deleted.'),
('en', 'manage_collections', 'Manage Collections'),
('en', 'create_collection', 'Create Collection'),
('en', 'selected_items_removed','Selected %s have been deleted.'),
('en', 'edit_collection','Edit Collection'),
('en','manage_collection_items','Manage Collection Items'),
('en','manage_favorite_collections','Manage Favorite Collections'),
('en','total_fav_collection_removed','%s collections have been removed from favorites.'),
('en','total_photos_deleted','%s photos have been deleted successfully.'),
('en','total_fav_photos_removed','%s photos have been removed from favorites.'),
('en','photos_upload','Photo Upload'),
('en','no_items_found_in_collect','No item found in this collection'),
('en','You dont have any favorite collection','You dont have any favorite collections'),
('en','manage_favorite_collections','Manage Favorite Collections'),
('en','manage_items','Manage Items'),
('en','add_new_collection','Add New Collection'),
('en','update_collection','Update Collection'),
('en','update_photo','Update Photo'),
('en','update_photo','Update Photo'),
('en','manage_collections','Manage Collections'),
('en','no_collection_found','You dont have any collection'),
('en','photo_title','Photo Title'),
('en','photo_caption','Photo Caption'),
('en','photo_tags','Photo Tags'),
('en','collection','Collection'),
('en','photo','Photo'),
('en','pic_allow_embed','Enable photo embedding'),
('en','pic_dallow_embed','Disable photo embedding'),
('en','pic_allow_rating','Enable photo rating'),
('en','pic_dallow_rating','Disable photo rating'),
('en','add_more','Add More'),
('en','download_photo','Download Photo'),
('en','collect_name_er','Collection name is empty'),
('en','collect_descp_er','Collection description is empty'),
('en','collect_tag_er','Collection tags are empty'),
('en','collect_cat_er','Select collection category'),
('en','collect_borad_pub','Make collection public (Recommended)'),
('en','collect_borad_pub','Make collection private'),
('en','collect_allow_public_up','Public Upload'),
('en','collect_pub_up_dallow','Disallow other users to add items.'),
('en','collect_pub_up_allow','Allow other users to add items.');

View file

@ -29,6 +29,11 @@ CREATE TABLE IF NOT EXISTS `cb_collections` (
PRIMARY KEY (`collection_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `cb_collections` CHANGE `broadcast` `broadcast` VARCHAR( 10 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'public',
CHANGE `allow_comments` `allow_comments` VARCHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'yes',
CHANGE `active` `active` VARCHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'yes',
CHANGE `public_upload` `public_upload` VARCHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'yes'
CREATE TABLE IF NOT EXISTS `cb_collection_items` (
`ci_id` bigint(20) NOT NULL AUTO_INCREMENT,

View file

@ -79,8 +79,9 @@ RewriteRule ^collections collections.php [L]
RewriteRule ^collection/(.*)/(.*)/(.*) view_collection.php?cid=$1&type=$2&%{QUERY_STRING} [L]
#Photo Section
RewriteRule ^item/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
RewriteRule ^item/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L]
RewriteRule ^photo_upload photo_upload.php [L]
#
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup signup.php

View file

@ -27,7 +27,7 @@ if($_GET['mode']!='')
}
$p = $cbphoto->get_photo($id);
$p['without_user'] = TRUE;
$p['user'] = $p['userid'];
assign('data',$p);

View file

@ -96,6 +96,10 @@
<tr>
<td width="200"><strong>Total Comments:</strong></td>
<td><input name="total_comments" id="total_comments" value="{$data.total_comments}" /></td>
</tr>
<tr>
<td width="200"><strong>Total Downloads:</strong></td>
<td><input name="downloaded" id="downloaded" value="{$data.downloaded}" /></td>
</tr>
<tr>
<td width="200"><strong>Rating:</strong></td>

View file

@ -8,12 +8,6 @@
<input type="submit" name="make_featured_selected" value="Make Featured" class="button"/>
<input type="submit" name="make_unfeatured_selected" value="Make Unfeatured" class="button"/>
<input type="submit" name="delete_selected" value="Delete" class="button" onclick="return confirm_it('Are you sure you want to delete selected photos(s)')"/>
<input type="submit" name="move_selected" value="Move To" class="button"/>
<select name="collection_id" id="collection_id">
{foreach from=$c item=item}
<option value="{$item.collection_id}">{$item.collection_name}</option>
{/foreach}
</select>
</td>
</tr>

View file

@ -74,7 +74,8 @@
{if $mode == 'mass' || $mode == ''}
<h2>Mass Re-creation of Photos</h2>
<div style="height:10px; clear:both;"></div>
<span class="AdminBoldText">This will re-create all the photos uploaded on your website, according to the settings shown below
<span class="AdminBoldText">This will re-create all the photos uploaded on your website, according to the settings shown below</span>
<div class="AdminBoldText" style="color:#ed0000; font:normal 10px Tahoma, Geneva, sans-serif; margin-top:5px;">Take caution while using Mass Recreation. Use MAX of 5 photos per GO.</div>
<div style="height:5px; clear:both;"></div>
<fieldset class="fieldset" style="padding:10px;">
<legend style="font:bold 11px Tahoma; text-transform:uppercase; background:#FFF; padding:0 20px;">Settings on which photos will be re-created</legend>

View file

@ -890,7 +890,8 @@ if(!empty($mode))
$tags = mysql_clean(genTags($_POST['collection_tags']));
$cat = ($_POST['category']);
$type = "photos";
$CollectParams = array("collection_name"=>$name,"collection_description"=>$desc,"collection_tags"=>$tags,"category"=>$cat,"type"=>$type);
$CollectParams =
array("collection_name"=>$name,"collection_description"=>$desc,"collection_tags"=>$tags,"category"=>$cat,"type"=>$type,"allow_comments"=>"yes","broadcast"=>"public","public_upload"=>"yes");
$cbcollection->create_collection($CollectParams);
if(msg())

View file

@ -84,13 +84,12 @@ class Collections extends CBCategory
lang('Flagged Collections')=>'flagged_collections.php');
// Adding Collection links in Cbucket Class
$Cbucket->links['collections'] = array('collections.php','collections');
$Cbucket->links['manage_collections'] = array('manage_collections.php','manage_collections');
$Cbucket->links['edit_collection'] = array('manage_collections.php?mode=edit_collection&amp;cid=',
'manage_collections.php?mode=edit_collection&amp;cid=');
$Cbucket->links['manage_items'] = array('manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s',
'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s');
'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s');
}
/**

View file

@ -10,7 +10,7 @@
* - Photo Sharing Email Template
*/
define('MAX_PHOTO_UPLOAD',5);
//define('MAX_PHOTO_UPLOAD',5);
class CBPhotos
{
@ -31,7 +31,7 @@ class CBPhotos
var $max_watermark_width = 120;
var $embed_types;
var $share_email_vars;
var $max_uploads = MAX_PHOTO_UPLOAD; // Max number of uploads at once
//var $max_uploads = MAX_PHOTO_UPLOAD; Max number of uploads at once
var $search;
/**
* __Constructor of CBPhotos
@ -138,7 +138,18 @@ class CBPhotos
lang('Favorite Photos') => "manage_photos.php?mode=favorite",
lang('Orphan Photos') => "manage_photos.php?mode=orphan",
);
$userquery->user_account[lang('Photos')] = $accountLinks;
$userquery->user_account[lang('Photos')] = $accountLinks;
//Setting Cbucket links
$Cbucket->links['photos'] = array('photos.php','photos');
$Cbucket->links['manage_photos'] = array('manage_photos.php','manage_photos.php');
$Cbucket->links['edit_photo'] = array('edit_photo.php?photo=','edit_photo.php?photo=');
$Cbucket->links['manage_favorite_photos'] = array('manage_photos.php?mode=favorite','manage_photos.php?mode=favorite');
$Cbucket->links['manage_orphan_photos'] = array('manage_photos.php?mode=orphan','manage_photos.php?mode=orphan');
$Cbucket->links['user_photos'] = array('user_photos.php?mode=uploaded&amp;user=','user_photos.php?mode=uploaded&amp;user=');
$Cbucket->links['user_fav_photos'] = array('user_photos.php?mode=favorite&amp;user=','user_photos.php?mode=favorite&amp;user=');
// Setting Home Tab
}
@ -761,7 +772,7 @@ class CBPhotos
if(!empty($should_watermark) && $should_watermark == 1)
{
$this->watermark_image($path.$filename."_l.".$extension,$path.$filename."_l.".$extension);
$this->watermark_image($path.$filename.".".$extension,$path.$filename."_o.".$extension);
$this->watermark_image($path.$filename."_o.".$extension,$path.$filename."_o.".$extension);
}
}
@ -945,7 +956,7 @@ class CBPhotos
case 3: //PNG
{
$sImage = imagecreatefrompng($input);
imagecopy($sImage,$wImage,$paddings[0],$paddings[1],0,0,$ww,$wh,75);
imagecopy($sImage,$wImage,$paddings[0],$paddings[1],0,0,$ww,$wh);
imagepng($sImage,$output,9);
}
break;
@ -953,6 +964,47 @@ class CBPhotos
}
}
/**
* Load Upload Form
*/
function loadUploadForm($params)
{
$p = $params;
$should_include = $p['include_header'] ? $p['include_header'] : TRUE;
$output = '<form action="" method="post"';
if($p['formName'])
$output .= " name = '".$p['formName']."'";
else
$output .= " name = 'photo_form'";
if($p['formID'])
$output .= " id = '".$p['formID']."'";
else
$output .= " id = 'photo_form'";
if($p['formClass'])
$output .= " class = '".$p['formClass']."'";
$output .= ">";
if($p['class'])
$class = $p['class'];
if($should_include === TRUE)
$output .= Fetch("/blocks/upload_head.html");
$output .= "<div class='upload_form_div clearfix ".$class."'>";
$output .= '<input type="hidden" id="photoIDS" name="photoIDS" />';
$output .= '<div id="divStatus" class="divStatus moveL">Click "Upload" to select files</div>';
$output .= '<div class="moveR">';
$output .= '<span id="spanButtonPlaceHolder"></span>';
$output .= '<input id="btnCancel" type="button" value="Cancel"
onClick="swfu.cancelQueue();" disabled="disabled" style="margin:0px 0px 1px 3px" />';
$output .= '</div>';
$output .= "<div class='clear'></div>";
$output .= '<div id="progress_status" class="divStatus clearfix"></div>';
$output .= '<div class="fieldset flash clearfix" id="fsUploadProgress"></div>';
$output .= "</div>";
$output .= '<button name="EnterInfo" class="'.$p['buttonClass'].'" id="EnterInfo" disabled="disabled">'.lang('continue').'</button>';
$output .= "</form>";
return $output;
}
/**
* Load Required Form
*/
@ -966,8 +1018,8 @@ class CBPhotos
$description = $array['photo_description'];
$tags = $array['photo_tags'];
if($array['without_user'])
$p['user'] = "";
if($array['user'])
$p['user'] = $array['user'];
else
$p['user'] = userid();
@ -1018,7 +1070,7 @@ class CBPhotos
'type' => 'dropdown',
'value' => $cl_array,
'db_field' => 'collection_id',
'required' => 'yes',
'required' => 'no',
'checked' => $collection,
'invalid_err' => lang('photo_collection_err')
)
@ -1098,7 +1150,7 @@ class CBPhotos
function update_watermark($file)
{
if(empty($file))
e("Watermark file not found");
e(lang("no_watermark_found"));
else
{
$oldW = BASEDIR."/images/photo_watermark.png";
@ -1119,9 +1171,9 @@ class CBPhotos
if($width > $this->max_watermark_width)
$this->createThumb($wFile,$wFile,'png',$this->max_watermark_width);
}
e("Watermark Image Updated.","m");
e(lang("watermark_updated"),"m");
} else {
e("Please upload 24-bit PNG");
e(lang("upload_png_watermark"));
}
@ -1170,7 +1222,7 @@ class CBPhotos
'display_function' => 'display_sharing_opt',
'default_value'=>'public'
),*/
'tagging' => array(
/*'tagging' => array(
'title' => lang('tagging'),
'type' => 'radiobutton',
'id' => 'allow_tagging',
@ -1182,7 +1234,7 @@ class CBPhotos
'validate_function'=>'yes_or_no',
'display_function' => 'display_sharing_opt',
'default_value'=>'yes'
),
),*/
'embedding' => array(
'title' => lang('vdo_embedding'),
'type' => 'radiobutton',
@ -1415,6 +1467,12 @@ class CBPhotos
$query_val[] = $array['total_favorites'];
}
if(isset($array['downloaded']))
{
$query_field[] = "downloaded";
$query_val[] = $array['downloaded'];
}
if(isset($array['voters']))
{
$query_field[] = "voters";
@ -1438,7 +1496,7 @@ class CBPhotos
}
$db->update(tbl('photos'),$query_field,$query_val," photo_id='$pid'");
e("photo_updated_successfully","m");
e(lang("photo_updated_successfully"),"m");
}
}
}
@ -1746,8 +1804,8 @@ class CBPhotos
{
$cid = $arr['details'];
//pr($arr,TRUE);
$text = lang("Add more");
$text = lang("add_more");
$result = '';
if(!is_array($cid))
$details = $this->collection->get_collection($cid);
else
@ -1755,44 +1813,83 @@ class CBPhotos
if($details['type'] == 'photos' && $details['userid'] == user_id())
{
$div = "<div ";
if($arr['id'])
$div .= "id = '".$arr['id']."' ";
if($arr['class'])
$div .= "class = '".$arr['class']."' ";
if($arr['align'])
$div .= "align = '".$arr['align']."' ";
if($arr['style'])
$div .= "style = '".$arr['style']."' ";
if($arr['extra'])
$div .= $arr['extra'];
if($arr['on_div'])
$output = $arr['output'];
if(empty($output) || $output == "button")
{
$result .= '<button type="button"';
$link = "'".$this->photo_links($details,'upload_more')."'";
$div .= 'onClick = "openURL('.$link.')"';
$div .= ">";
$div .= $text;
$div .= "</div>";
} else {
$div .= ">";
$div .= "<a href='".$this->photo_links($details,'upload_more')."' ";
if($arr['link_class'])
$div .= "class = '".$arr['link_class']."' ";
if($arr['target'])
$div .= "target = '".$arr['target']."'";
if($arr['link_style'])
$div .= "style = ".$arr['link_style']." ";
$div .= ">";
$div .= $text;
$div .= "</a></div>";
if($arr['new_window'] || $arr['target'] == "_blank")
$new_window = "'new'";
else
$new_window = "'same'";
$result .= 'onClick = "openURL('.$link.','.$new_window.')"';
if($arr['id'])
$result .= ' id = "'.$arr['id'].'"';
if($arr['class'])
$result .= ' class = "'.$arr['class'].'"';
if($arr['title'])
$result .= ' title = "'.$arr['title'].'"';
if($arr['style'])
$result .= ' style = "'.$arr['style'].'"';
if($arr['extra'])
$result .= mysql_clean($arr['extra']);
$result .= ">".$text."</button>";
}
echo $div;
if($output == "div")
{
$result .= '<div ';
$link = "'".$this->photo_links($details,'upload_more')."'";
if($arr['new_window'] || $arr['target'] == "_blank")
$new_window = "'new'";
else
$new_window = "'same'";
$result .= 'onClick = "openURL('.$link.','.$new_window.')"';
if($arr['id'])
$result .= ' id = "'.$arr['id'].'"';
if($arr['align'])
$result .= ' align = "'.$arr['align'].'"';
if($arr['class'])
$result .= ' class = "'.$arr['class'].'"';
if($arr['title'])
$result .= ' title = "'.$arr['title'].'"';
if($arr['style'])
$result .= ' style = "'.$arr['style'].'"';
if($arr['extra'])
$result .= mysql_clean($arr['extra']);
$result .= ">".$text."</div>";
}
if($output == "link")
{
$result .= '<a href="'.$this->photo_links($details,'upload_more').'"';
if($arr['new_window'])
$result .= ' target = "_blank"';
elseif($arr['target'])
$result .= ' target = "'.$arr['target'].'"';
if($arr['id'])
$result .= ' id = "'.$arr['id'].'"';
if($arr['align'])
$result .= ' align = "'.$arr['align'].'"';
if($arr['class'])
$result .= ' class = "'.$arr['class'].'"';
if($arr['title'])
$result .= ' title = "'.$arr['title'].'"';
if($arr['style'])
$result .= ' style = "'.$arr['style'].'"';
if($arr['extra'])
$result .= mysql_clean($arr['extra']);
$result .= ">".$text."</a>";
}
echo $result;
} else {
return FALSE;
}
@ -1821,9 +1918,9 @@ class CBPhotos
case "upload_more":
{
if(SEO == "yes")
$link = BASEURL."/photo_upload/".$details['collection_id'];
$link = BASEURL."/photo_upload/".$this->encode_key($details['collection_id']);
else
$link = BASEURL."/photo_upload.php?collection=".$details['collection_id'];
$link = BASEURL."/photo_upload.php?collection=".$this->encode_key($details['collection_id']);
}
break;
@ -1898,7 +1995,11 @@ class CBPhotos
*/
function is_addable($cid)
{
$details = $this->collection->get_collection($cid);
if(!is_array($cid))
$details = $this->collection->get_collection($cid);
else
$details = $cid;
if(empty($details))
{
return false;
@ -1998,9 +2099,9 @@ class CBPhotos
if(!userid())
e(lang("please_login_to_rate"));
elseif(!empty($already_voted))
e(str_replace("video","photo",lang("you_hv_already_rated_vdo")));
e(lang("you_hv_already_rated_photo"));
elseif($c_rating['allow_rating'] == 'no' || config('photo_rating') != 1)
e(str_replace('Video','Photo',lang("vid_rate_disabled")));
e(lang("photo_rate_disabled"));
else
{
$voters[userid()] = array('rate'=>$rating,'time'=>NOW());
@ -2081,25 +2182,36 @@ class CBPhotos
*/
function photo_embed_codes($newArr)
{
$t = $newArr['type'];
if(is_array($t))
$types = $t;
elseif($t == 'all')
$types = $this->embed_types;
else
$types = explode(',',$t);
foreach($types as $type)
if(empty($newArr['details']))
{
$type = str_replace(' ','',$type);
$newArr['type'] = $type;
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr));
echo "<div class='error'>".e(lang("need_photo_details"))."</div>";
}
elseif($newArr['details']['allow_embedding'] == 'no')
{
echo "<div class='error'>".e(lang("embedding_is_disabled"))."</div>";
}
if($newArr['assign'])
assign(mysql_clean($newArr['assign']),$codes);
else
return $codes;
{
$t = $newArr['type'];
if(is_array($t))
$types = $t;
elseif($t == 'all')
$types = $this->embed_types;
else
$types = explode(',',$t);
foreach($types as $type)
{
$type = str_replace(' ','',$type);
$newArr['type'] = $type;
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr));
}
if($newArr['assign'])
assign(mysql_clean($newArr['assign']),$codes);
else
return $codes;
}
}
/**
@ -2107,7 +2219,7 @@ class CBPhotos
*/
function encode_key($key)
{
return base64_encode($key);
return base64_encode(serialize($key));
}
/**
@ -2115,11 +2227,22 @@ class CBPhotos
*/
function decode_key($key)
{
return base64_decode($key);
return unserialize(base64_decode($key));
}
function incrementDownload($Array)
{
global $db;
if(!isset($_COOKIE[$Array['photo_id']."_downloaded"]))
{
$db->update(tbl('photos'),array('downloaded'),array('|f|downloaded+1'),' photo_id = "'.$Array['photo_id'].'"');
setcookie($Array['photo_id']."_downloaded",NOW(),time()+1800);
}
}
function download_photo($key)
{
$file = $this->ready_photo_file($key);
if($file)
{
@ -2139,6 +2262,7 @@ class CBPhotos
{
$size = filesize($file['file_dir']);
if($fp=@fopen($file['file_url'],'r')) {
$this->incrementDownload($p);
// sending the headers
header("Content-type: $mime");
header("Content-Length: $size");
@ -2151,13 +2275,13 @@ class CBPhotos
exit;
}
} else {
e("Photo is not readable.");
e(lang("photo_not_readable"));
}
} else {
e("Photo does not exist.");
e(lang("photo_not_exist"));
}
} else {
e("Wrong MIME type provided.");
e(lang("wrong_mime_type"));
}
} else
return false;

View file

@ -485,6 +485,7 @@ $Smarty->register_function('get_photo','get_photo');
$Smarty->register_function('uploadButton','upload_photo_button');
$Smarty->register_function('embedCodes','photo_embed_codes');
$Smarty->register_function('DownloadButtonP','photo_download_button');
$Smarty->register_function('loadPhotoUploadForm','loadPhotoUploadForm');
$Smarty->register_modifier('SetTime','SetTime');
$Smarty->register_modifier('getname','getname');

View file

@ -416,6 +416,12 @@
return $sizes[1];
}
//Load Photo Upload Form
function loadPhotoUploadForm($params)
{
global $cbphoto;
return $cbphoto->loadUploadForm($params);
}
//Photo File Fetcher
function get_photo($params)
{

View file

@ -1,7 +1,7 @@
// JavaScript Document
var page = baseurl+'/ajax.php';
var loading_img = "<img src='"+imageurl+"/ajax-loader.gif'>";
var loading_img = "<img style='vertical-align:middle' src='"+imageurl+"/ajax-loader.gif'>";
var loading = loading_img+" Loading...";
@ -1019,8 +1019,8 @@ function openURL(url) {
function get_item(obj,ci_id,cid,type,direction)
{
var btn_text = $(obj).text();
$(obj).text('Working');
var btn_text = $(obj).html();
$(obj).html(loading);
$.post(page,
{
@ -1084,7 +1084,8 @@ function onReload_item()
function pagination(object,cid,type,pageNumber)
{
obj = $(object); objID = obj.id; parent = obj.parent();
var obj = $(object), objID = obj.id,
parent = obj.parent(), parentID, innerHTML = obj.html();
if(parent.attr('id'))
parentID = parent.attr('id')
@ -1103,11 +1104,11 @@ function pagination(object,cid,type,pageNumber)
{
if(object.tagName == "BUTTON")
obj.attr('disabled','disabled');
obj.removeAttr('onClick'); obj.text('No more '+type);
obj.removeAttr('onClick'); obj.html('No more '+type);
} else {
$('#collectionItemsList').append(data['content']);
$('#NewPagination').html(data['pagination']);
obj.text('Load More');
obj.html(innerHTML);
}
}
});
@ -1141,71 +1142,71 @@ function ajax_add_collection(obj)
});
}
/*function updatePhotos(obj)
{
var ID = obj.form.id,
Child = $("#"+ID).children().filter('div'),
total = Child.length, eachObj, AjaxCall;
}*/
var AjaxIteration = 0;
var InputIteration = 0;
function callAjax(obj)
{
var getArray = updatePhotos(obj),
TotalItems = getArray.length;
alert(TotalItems);
$.each(getArray,function(i,v) { alert(i+" "+v) })
var getArray = getDetails(obj),
object = $(obj),
TotalItems = getArray.length, AjaxCall,
inputs = getInputs(obj,true),
element = inputs[InputIteration++];
if(AjaxIteration == getArray.length)
{
$(obj).html(TotalItems+" Photos Saved.").removeAttr('onclick').hide();
$("<input />").attr({
'type' : 'submit',
'name' : 'updatePhotos',
'id' : 'updatePhotos',
'value' : 'Done'
}).addClass(object.attr('class')).fadeIn(350).insertAfter(object).wrap("<form method='post' action='' name='finishForm' id='finishForm' />");
return true;
}
else
{
AjaxCall =
$.ajax
({
url: page,
type: "post",
dataType: "json",
data: getArray[AjaxIteration++],
cache: false,
beforeSend: function() { $(obj).html(loading_img+" Saving "+AjaxIteration+" out of "+TotalItems); $(obj).attr('disabled','disabled'); $("#"+element.id+" > div").css('opacity','0.5'); },
success: function(data) {
$('#'+element.id+" > div").empty().css({'padding':'10px','opacity':'1'}).html("<div style='font:bold 11px Tahoma;'>"+data.photo_title+" is now saved.</div>").fadeIn('normal',function() { callAjax(obj); });
}
});
}
}
function updatePhotos(obj)
function getInputs(obj,return_array)
{
var ID = obj.form.id,
Child = $("#"+ID).children().filter('div'),
eachObj, AjaxCall, i = 0, ParamArray = new Array(Child.length);
var err_count = 0;
$.each(Child,function(index,elem){
eachObj = $(elem);
var inputs = $("#"+elem.id+" :input"),
query = '';
inputs.each(function(ind, input)
{
if(input.type == "text" || input.type == "textarea" || input.type == "hidden")
{
if(input.value == null || input.value == '')
{
err_count++;
input.style.border = '2px solid #ed0000';
//ShouldContinue = false;
} else {
query += input.id+"="+input.value+"&";
err_count = 0;
//ShouldContinue = true;
}
}
if(input.type == "select-one" && input.selected)
query += input.id+"="+input.value+"&";
if(input.type == "radio" && input.checked)
query += input.id+"="+input.value+"&";
var Child = $(obj).parent().children().filter('form'), InputArray = [];
if(return_array == true)
{
$.each(Child,function(index,element){
InputArray[index] = element;
})
query += "mode=ajaxPhotos";
ParamArray[index] = query;
/* AjaxCall =
$.ajax
({
url: page,
type: "post",
dataType: "text",
data: query,
cache: false,
beforeSend: function() { $(obj).html(loading_img+" Saving"); $(obj).attr('disabled','disabled') },
complete : function() { $(obj).html(Child.length+" photos saved") },
success: function(data) { $("#"+eachObj.attr('id')).hide() }
});
saving++;
*/
return InputArray;
} else
return Child;
}
function getDetails(obj)
{
var forms = getInputs(obj), ParamArray = new Array(forms.length);
$.each(forms,function(index,form) {
query = $("#"+form.id+" *").serialize();
query += "&mode=ajaxPhotos";
ParamArray[index] = query;
})
return ParamArray;
}

View file

@ -52,7 +52,7 @@ switch($mode)
//Pagination
$pages->paginate($total_pages,$page);
subtitle(lang("Manage Collections"));
subtitle(lang("manage_collections"));
}
break;
@ -69,7 +69,7 @@ switch($mode)
$cbcollection->create_collection($_POST);
}
subtitle(lang("Create Collection"));
subtitle(lang("create_collection"));
}
break;
@ -91,7 +91,7 @@ switch($mode)
assign("other_fields",$otherFields);
assign('c',$collection);
subtitle(lang("Edit Collection"));
subtitle(lang("edit_collection"));
}
break;
@ -141,7 +141,7 @@ switch($mode)
assign('c',$collection);
assign('objs',$objs);
subtitle(lang("Manage Collection Items"));
subtitle(lang("manage_collection_items"));
}
break;
@ -162,7 +162,7 @@ switch($mode)
$cbcollection->action->remove_favorite($_POST['check_col'][$i]);
}
$eh->flush();
e($total." collection(s) have been removed from favorites","m");
e(sprintf(lang("total_fav_collection_removed"),$total),"m");
}
if(get('query')!='')
@ -180,7 +180,7 @@ switch($mode)
//Pagination
$pages->paginate($total_pages,$page);
subtitle(lang("Manage Favorite Collections"));
subtitle(lang("manage_favorite_collections"));
}
}

View file

@ -41,7 +41,7 @@ switch($mode)
$cbphoto->delete_photo($_POST['check_photo'][$i]);
}
$eh->flush();
e($total." photos has been deleted successfully","m");
e(sprintf(lang("total_photos_deleted"),$total),"m");
}
$photo_arr = array("user"=>userid(),"limit"=>$get_limit, 'order'=>' date_added DESC');
@ -61,7 +61,7 @@ switch($mode)
//Pagination
$pages->paginate($total_pages,$page);
subtitle(lang("Manage Photos"));
subtitle(lang("manage_photos"));
}
break;
@ -84,7 +84,7 @@ switch($mode)
updateObjectStats('fav','photo',$_POST['check_photo'][$i],'-');
}
$eh->flush();
e($total." photo(s) been removed from favorites","m");
e(sprintf(lang("total_fav_photos_removed"),$total),"m");
}
if(get('query')!='')
@ -102,7 +102,7 @@ switch($mode)
//Pagination
$pages->paginate($total_pages,$page);
subtitle(lang("Manage Favorite Photos"));
subtitle(lang("manage_favorite_photos"));
}
break;
@ -123,7 +123,7 @@ switch($mode)
$cbphoto->delete_photo($_POST['check_photo'][$i],TRUE);
}
$eh->flush();
e($total." photos has been deleted successfully.","m");
e(sprintf(lang("total_photos_deleted"),$total),"m");
}
$photo_arr = array("user"=>userid(),"limit"=>$get_limit, 'order'=>' date_added DESC', "get_orphans"=>TRUE);
$collection = $cbphoto->collection->get_collections(array("user"=>userid(),"type"=>"photos"));
@ -144,7 +144,7 @@ switch($mode)
//Pagination
$pages->paginate($total_pages,$page);
subtitle(lang("Manage Orphan Photos"));
subtitle(lang("manage_orphan_photos"));
}
break;
}

View file

@ -15,7 +15,11 @@ require 'includes/config.inc.php';
$userquery->logincheck();
subtitle(lang('photos_upload'));
assign('max_upload',MAX_PHOTO_UPLOAD);
if(isset($_GET['collection']))
{
$c = $cbphoto->decode_key($_GET['collection']);
assign('c',$cbphoto->collection->get_collection($c));
}
if(isset($_POST['EnterInfo']))
{
@ -34,15 +38,12 @@ if(isset($_POST['EnterInfo']))
assign('photos',$details);
}
if(isset($_POST['update_photos']))
{
//$newArray = $cbphoto->return_formatted_post($POST);
//$cbphoto->update_multiple_photos($newArray);
assign('step',2);
if(isset($_POST['updatePhotos']))
{
assign('step',3);
}
$collections = $cbphoto->collection->get_collections(array("type"=>"photos","user"=>userid()));
assign('c',$collections);
$collections = $cbphoto->collection->get_collections(array("type"=>"photos","limit"=>1,"user"=>userid()));
assign('has_collection',$collections);
subtitle(lang('photos_upload'));
//Displaying The Template

View file

@ -120,7 +120,7 @@ if(!function_exists('editors_pick'))
function get_ep_videos()
{
global $db;
$results = $db->select(tbl('editors_picks').','.tbl('video'),"*"," ".tbl('editors_picks').".videoid = ".tbl('video').".videoid ORDER BY ".tbl('editors_picks').".sort ASC");
$results = $db->select(tbl('editors_picks').','.tbl('video'),"*"," ".tbl('editors_picks').".videoid = ".tbl('video').".videoid AND ".tbl('video.active')." = 'yes' AND ".tbl('video.broadcast')." = 'public' AND ".tbl('video.status')." = 'Successful' ORDER BY ".tbl('editors_picks').".sort ASC");
return $results;
}

View file

@ -1,6 +1,5 @@
{if $smarty.get.collection}
{assign var=c value=$cbphoto->collection->get_collection($smarty.get.collection)}
{if $cbphoto->is_addable($c.collection_id)}
{if $c}
{if $cbphoto->is_addable($c)}
<div class="clearfix photoBox">
<div style="background:#FFF; text-align:center; border-bottom:1px solid #ccc; color:#666; padding:8px; font:normal 11px Tahoma;">You are about to add new photos in <strong>{$c.collection_name}</strong></div>
<div class="clearfix" style="padding:8px">
@ -32,12 +31,12 @@
</div>
{/if}
{else}
{if !$c}
{if !$has_collection}
<div class="photoBox clearfix">
<div style="background:#FFF; text-align:center; border-bottom:1px solid #ccc; color:#666; padding:8px; font:bold 11px Tahoma;">Create Collection</div>
{assign var='reqFields' value=$cbcollection->load_required_fields()}
<div class="CollectionResult" id="CollectionResult" style="display:none;"></div>
<div class="clearfix" style="padding:8px;" id="CollectionDIV" >
<div class="CollectionResult clearfix" id="CollectionResult" style="display:none;"></div> <!-- Keep id. This will display error/success message -->
<div class="clearfix" style="padding:8px;" id="CollectionDIV" > <!-- Also keep this id. After addition this will slideUp -->
{foreach from=$reqFields item=field}
{if $field.id != 'type'}
<div class="field clearfix" style="margin-bottom:3px;">

View file

@ -25,6 +25,8 @@
{section loop=$usr_collects name=clist}
{include file="$style_dir/blocks/manage/account_collections.html" collection=$usr_collects[clist]}
{sectionelse}
<div align="center" style="font:bold 11px Tahoma; margin:5px 0px;">{lang code="no_collection_found"}</div>
{/section}
{include file="$style_dir/blocks/manage/user_account_pagination.html"}
@ -131,7 +133,7 @@
{/if}
{if $mode == "favorite"}
<h2>Manage Favorite Collections</h2>
<h2>{lang code="manage_favorite_collections"}</h2>
<div style="margin-bottom:10px;">
<img src="{$imageurl}/dot.gif" class="arrow_pointing" style="margin-right:10px;" /><input type="submit" name="remove_selected_favs" id="remove_selected_favs" value="{lang code='remove'}" class="small_button" />
</div>
@ -150,7 +152,7 @@
{section loop=$collections name=list}
{include file="$style_dir/blocks/manage/account_collections.html" display_type="favorite" collection=$collections[list]}
{sectionelse}
<div align="center" style="font:bold 11px Tahoma; margin-top:5px;">{lang code="You dont have any favorite collection"}</div>
<div align="center" style="font:bold 11px Tahoma; margin:5px 0px;">{lang code="you_dont_have_fav_collections"}</div>
{/section}
{include file="$style_dir/blocks/manage/user_account_pagination.html"}

View file

@ -41,7 +41,7 @@
{/if}
{if $mode == "favorite"}
<h2>{lang code="Manage Favorite Photos"}</h2>
<h2>{lang code="manage_favorite_photos"}</h2>
<div align="right" style="float:right; display:inline">
<form id="form1" name="form1" method="get" action="">
<input name="query" type="text" class="search_field" id="query" value="{$smarty.get.query|form_val}" />
@ -79,7 +79,7 @@
{/if}
{if $mode == 'orphan'}
<h2>{lang code="Manage Orphan Photos"}</h2>
<h2>{lang code="manage_orphan_photos"}</h2>
<div align="right" style="float:right; display:inline">
<form id="form1" name="form1" method="get" action="">
<input name="query" type="text" class="search_field" id="query" value="{$smarty.get.query|form_val}" />
@ -111,7 +111,7 @@
{section name=p_list loop=$photos}
{include file="$style_dir/blocks/manage/account_photo.html" photo=$photos[p_list] control='orphan'}
{sectionelse}
<div align="center" style="padding:5px"><strong><em>{lang code='You dont have any orphan photos'}</em></strong></div>
<div align="center" style="padding:5px"><strong><em>{lang code='you_dont_have_orphan_photos'}</em></strong></div>
{/section}
{/if}

View file

@ -1,25 +1,12 @@
<div class="content_con clearfix">
<div class="upload_info">
{if $step == 1 || $step == ""}
<form action="" method="post" name="photo_form" id="photo_form">
{include file="$style_dir/blocks/upload_head.html"}
<div class="upload_form_div clearfix">
<input type="hidden" id="photoIDS" name="photoIDS" />
<div id="progress_status" class="divStatus"></div>
<div id="divStatus" class="divStatus moveL">Click 'Upload' to select files</div>
<div class="moveR">
<span id="spanButtonPlaceHolder"></span>
<input id="btnCancel" type="button" value="Cancel"
onClick="swfu.cancelQueue();" disabled="disabled" style="margin:0px 0px 1px 3px" />
</div>
<div class="fieldset flash" id="fsUploadProgress"></div>
</div>
<button name="EnterInfo" class="LoadMoreButton moveR" id="EnterInfo" disabled="disabled">{lang code="Continue"}</button>
</form>
<h2>Select Photo Files</h2>
{loadPhotoUploadForm buttonClass='LoadMoreButton moveR'}
{/if}
{if $step == 2}
<h2>Enter Information</h2>
{section name=p_list loop=$photos}
<form action="" method="post" name="{$photos[p_list].photo_key}Form" id="{$photos[p_list].photo_key}Form">
{assign var='reqFields' value=$cbphoto->load_required_forms($photos[p_list])}
@ -60,12 +47,11 @@
</div>
</form>
{/section}
<button class="LoadMoreButton clearfix" onclick="callAjax(this);" type="button" name="update_photos" id="update_photos">Save All</button>
<button class="LoadMoreButton clearfix" onclick="callAjax(this);" type="button" name="insertPhotos" id="insertPhotos">Save All</button>
{/if}
{if $step == 3}
<h2>Photos have uploaded successfully.</h2>
{/if}
{/if}
</div>
</div>

View file

@ -1,7 +1,7 @@
<div style="width:880px; margin:0px auto">
{uploadButton details=$c output='div' target="_blank" class='moveR small_button non_button'}
<div class="video_title" style="padding-bottom:5px; margin-bottom:5px; border-bottom:1px solid #ccc;">{$c.collection_name} </div>
{uploadButton details=$c target='_blank'}
<div style="font:normal 10px Tahoma; color:#333; padding-bottom:5px; margin-bottom:5px; border-bottom:1px solid #ccc;">{lang code="by"|capitalize} <a href="{$userquery->profile_link($c)}">{$c.username|capitalize}</a> - <a href="{link name='user_videos'}{$c.username}">{lang code="view"|capitalize} {$c.username|capitalize} {lang code="videos"|capitalize}</a> {if $c.userid == $userquery->userid} - <a href="{link name='edit_collection'}{$c.collection_id}">{lang code="edit_collection"}</a> - {link name='manage_items' assign='miLink'} <a href="{$miLink|sprintf:$c.collection_id:$c.type}">{lang code="manage_items"}</a>{/if}</div>
<div style="clear:both;"></div>

View file

@ -164,12 +164,13 @@ window.onload = function() {
file_size_limit : "{$Cbucket->configs.max_photo_size} MB",
file_types : "{$cbphoto->extensions()}",
file_types_description : "Image Files",
file_upload_limit : {$max_upload},
file_upload_limit : {$Cbucket->configs.photo_multi_upload},
post_params :
{ldelim}
{if $smarty.get.collection}
{if $cbphoto->is_addable($smarty.get.collection)}
collection : {$smarty.get.collection},
{assign var=collectionID value=$cbphoto->decode_key($smarty.get.collection)}
{if $cbphoto->is_addable($collectionID)}
collection : {$collectionID},
{/if}
{/if}
userid : {$userquery->userid}

View file

@ -23,6 +23,7 @@ if($cbcollection->is_viewable($c))
{
$param = array("type"=>$type,"cid"=>$c);
$cdetails = $cbcollection->get_collections($param);
if($cdetails)
{
switch($type)

View file

@ -48,11 +48,11 @@ if($cbcollection->is_viewable($cid))
assign('user',$userquery->get_user_details($video['userid']));
assign('c',$collect);
} else {
e("Item does not exist");
e(lang("item_not_exist"));
$Cbucket->show_page = false;
}
} else {
e("Item does not exist");
e(lang("item_not_exist"));
$Cbucket->show_page = false;
}
}
@ -75,11 +75,11 @@ if($cbcollection->is_viewable($cid))
assign('user',$userquery->get_user_details($photo['userid']));
assign('c',$collect);
} else {
e("Item does not exist");
e(lang("item_not_exist"));
$Cbucket->show_page = false;
}
} else {
e("Item does not exist");
e(lang("item_not_exist"));
$Cbucket->show_page = false;
}
}