Updated : Now collection created also get insert_id

Updated : create_collection function now return insert_id
Removed : get_image_file function. Now this function calls getFileSmarty function with parameters
Fixed : Photo embed. Only available types get in array
Fixed : get_photo function
Fixed : rss.php
Fixed : group_header Video tab
Fixed : Group Topic delete issue of 'Group does not exist'
Updated : upload_head.html, Now user can create new collection right from photo_upload page and upload inside it
Updated : admin_bar included in body.html
Updated : global_header.html, remove admin_bar from it and now by default videos in selected in search bar
This commit is contained in:
Fawaz 2011-01-13 13:58:58 +00:00
parent 9c66b1236d
commit 6545292287
11 changed files with 62 additions and 113 deletions

View file

@ -899,7 +899,7 @@ if(!empty($mode))
$type = "photos";
$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);
$insert_id = $cbcollection->create_collection($CollectParams);
if(msg())
{
@ -915,6 +915,7 @@ if(!empty($mode))
$ajax['msg'] = $msg;
$ajax['err'] = $err;
$ajax['id'] = $insert_id;
echo json_encode($ajax);
}
@ -923,6 +924,7 @@ if(!empty($mode))
case "ajaxPhotos":
{
$cbphoto->insert_photo();
if(msg())
{
$msg = msg_list();

View file

@ -789,8 +789,9 @@ class Collections extends CBCategory
$query_field[] = "active";
$query_val[] = "yes";
$db->insert(tbl($this->section_tbl),$query_field,$query_val);
$insert_id = $db->insert(tbl($this->section_tbl),$query_field,$query_val);
e(lang("collect_added_msg"),"m");
return $insert_id;
}
}
@ -902,7 +903,7 @@ class Collections extends CBCategory
*/
function delete_collection($cid)
{
global $db;
global $db,$eh;
$collection = $this->get_collection($cid);
if(empty($collection))
e(lang("collection_not_exists"));
@ -923,6 +924,7 @@ class Collections extends CBCategory
$db->delete(tbl($this->items),array("collection_id"),array($cid));
$this->delete_thumbs($cid);
$db->delete(tbl($this->section_tbl),array("collection_id"),array($cid));
$eh->flush();
e(lang("collection_deleted"),"m");
}
}

View file

@ -1560,77 +1560,8 @@ class CBPhotos
*/
function get_image_file($pid,$size='t',$multi=false,$assign=NULL,$with_path=true,$with_orig=false)
{
if(empty($pid))
return false;
else
{
if(($size != 't' && $size != 'm' && $size != 'l' && $size != 'o') || empty($size))
$size = 't';
if(!is_array($pid))
$photo = $this->get_photo($pid);
else
$photo = $pid;
if(!empty($photo))
{
if(empty($photo['photo_id']) && empty($photo['photo_key']))
return false; // Something is wrong, so return false;
else
{
if(!empty($photo['filename']) && !empty($photo['ext']))
{
$files = glob(PHOTOS_DIR."/".$photo['filename']."*.".$photo['ext']);
if(is_array($files))
{
foreach($files as $file)
{
$file_parts = explode('/',$file);
$thumb_name = $file_parts[count($file_parts)-1];
$type = $this->get_image_type($thumb_name);
if($with_orig)
{
if($with_path)
$thumbs[] = PHOTOS_URL."/".$thumb_name;
else
$thumbs[] = $thumb_name;
}
elseif(!empty($type))
{
if($with_path)
$thumbs[] = PHOTOS_URL."/".$thumb_name;
else
$thumbs[] = $thumb_name;
}
}
//pr($thumbs,TRUE);
if($assign && $multi)
{
assign($assign,$thumbs);
} elseif(!$assign && $multi) {
return $thumbs;
} else {
$size = "_".$size;
$return_thumb = array_find($photo['filename'].$size,$thumbs);
if($assign != NULL)
assign($assign,$return_thumb);
else
return $return_thumb;
}
} else {
return false;
}
} else {
return false;
}
}
} else
return false;
}
$params = array("details"=>$pid,"size"=>$size,"multi"=>$multi,"assign"=>$assign,"with_path"=>$with_path,"with_orig"=>$with_orig);
return $this->getFileSmarty($params);
}
/**
@ -1640,13 +1571,11 @@ class CBPhotos
*/
function getFileSmarty($p)
{
$details = $p['details'];
if(empty($details))
{
return $this->default_thumb($size);
} else {
//Calling Custom Functions
if(count($Cbucket->custom_get_photo_funcs) > 0)
{
@ -1665,7 +1594,9 @@ class CBPhotos
if(($p['size'] != 't' && $p['size'] != 'm' && $p['size'] != 'l' && $p['size'] != 'o') || empty($p['size']))
$p['size'] = 't';
$with_path = $p['with_path'] ? $p['with_path'] : TRUE;
if($p['with_path'] === FALSE) $p['with_path'] = FALSE; else $p['with_path'] = TRUE;
$with_path = $p['with_path'];
$with_orig = $p['with_orig'] ? $p['with_orig'] : FALSE;
if(!is_array($details))
$photo = $this->get_photo($details);
@ -1685,10 +1616,21 @@ class CBPhotos
{
$file_parts = explode("/",$file);
$thumb_name = $file_parts[count($file_parts)-1];
if($with_path)
$thumbs[] = PHOTOS_URL."/".$thumb_name;
else
$thumbs[] = $thumb_name;
$type = $this->get_image_type($thumb_name);
if($with_orig)
{
if($with_path)
$thumbs[] = PHOTOS_URL."/".$thumb_name;
else
$thumbs[] = $thumb_name;
}
elseif(!empty($type))
{
if($with_path)
$thumbs[] = PHOTOS_URL."/".$thumb_name;
else
$thumbs[] = $thumb_name;
}
}
if(empty($p['output']) || $p['output'] == 'non_html')
@ -1703,6 +1645,7 @@ class CBPhotos
$size = "_".$p['size'];
$return_thumb = array_find($photo['filename'].$size,$thumbs);
if(empty($return_thumb))
{
$this->default_thumb($size);
@ -1710,7 +1653,7 @@ class CBPhotos
if($p['assign'] != NULL)
assign($p['assign'],$return_thumb);
else
echo $return_thumb;
return $return_thumb;
}
}
}
@ -1725,6 +1668,7 @@ class CBPhotos
$src = $this->default_thumb($size);
else
$src = $src;
$dem = getimagesize($src);
$width = $dem[0];
$height = $dem[1];
@ -2265,9 +2209,12 @@ class CBPhotos
foreach($types as $type)
{
$type = str_replace(' ','',$type);
$newArr['type'] = $type;
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr));
$type = strtolower($type);
if(in_array($type,$this->embed_types)) {
$type = str_replace(' ','',$type);
$newArr['type'] = $type;
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr));
}
}
if($newArr['assign'])

View file

@ -426,7 +426,7 @@
function get_photo($params)
{
global $cbphoto;
$cbphoto->getFileSmarty($params);
return $cbphoto->getFileSmarty($params);
}
//Photo Upload BUtton

View file

@ -29,7 +29,7 @@ switch($mode)
{
case 'recent':
default:
{echo $limit;
{
$videos = get_videos(array('limit'=>$limit));
$title = "Recently Added Videos";
}

View file

@ -53,7 +53,7 @@
<li onclick="get_group_info('#members',this)">{lang code='members'}</li>
{/if}
{if isSectionEnabled('videos')}
<li onclick="get_group_info('#videos',this)">{lang code='videos'}</li>
<li onclick="get_group_info('#gpvideos',this)">{lang code='videos'}</li>
{/if}
<li onclick="get_group_info('#flag_group',this); $('#flag_item').slideDown()">{lang code='report_this'}</li>
</ul>
@ -125,7 +125,7 @@
<!-- Group members-->
<!-- Group videos-->
<div id="videos" class="grp_info" style="display:none">
<div id="gpvideos" class="grp_info" style="display:none">
{assign var=gpvidlimit value=func->config(videos_items_grp_page)}
{assign var=gpvids value=$cbgroup->get_group_videos($group.group_id,'yes',$gpvidlimit)}
{if $gpvids}

View file

@ -30,7 +30,7 @@
{lang code='topic_by_user' assign='topic_by_user'}
<span class="topic_title">{$topic_by_user|sprintf:$cbgroup->topic_link($topic):$topic.topic_title:$userquery->profile_link($poster):$poster.username} {$title.date_added|niceTime}
{if has_access('admin_access') || $topic.userid == $userquery->userid}<small><a href="javascript:void(0)" id="delete_topic-{$topic.topic_id}" onmousedown="delete_item('delete_topic','{$topic.topic_id}','{lang code="tp_del_confirm"}','?mode=topic_del&amp;topic_id={$topic.topic_id}');">Delete</a></small>{/if}
{if has_access('admin_access') || $topic.userid == $userquery->userid}<small><a href="javascript:void(0)" id="delete_topic-{$topic.topic_id}" onmousedown="delete_item('delete_topic','{$topic.topic_id}','{lang code="tp_del_confirm"}','?mode=topic_del&amp;topic_id={$topic.topic_id}&amp;url={$group.group_url}');">Delete</a></small>{/if}
</td>
<td width="150" align="left">{$topic.total_views|number_format}</td>
<td width="100" align="left">{$topic.total_replies|number_format}</td>

View file

@ -25,23 +25,23 @@
<li style="list-style:none">Collection does not exist.</li>
<li style="list-style:none">It is unactive.</li>
<li style="list-style:none">It is private.</li>
<li style="list-style:none">Your are not own of collection.</li>
<li style="list-style:none">Your are not owner of collection.</li>
<li style="list-style:none; margin-top:5px; font-weight:bold;">You can select collection once your photos have been uploaded.</li>
</div>
</div>
{/if}
{else}
{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 clearfix" id="CollectionResult" style="display:none;"></div> <!-- Keep id. This will display error/success message -->
{assign var='reqFields' value=$cbcollection->load_required_fields()}
<div class="CollectionResult clearfix" id="CollectionResult" style="display:none; margin-bottom:5px;"></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;">
<label for="{$field.id}" style="font:bold 11px Tahoma; width:100px;" class="moveL">{$field.title}</label> &nbsp;
{$formObj->createField($field)}
<label for="{$field.id}" style="font:bold 11px Tahoma; padding-top:3px; width:100px;" class="moveL">{$field.title}</label>
<div class="moveL">{$formObj->createField($field)}</div>
</div>
{/if}
{/foreach}
@ -49,5 +49,4 @@
</div>
</div>
{/if}
{/if}

View file

@ -1,7 +1,7 @@
{* Including Global Header *}
{include file="$style_dir/global_header.html"}
<body>
{include_header file="admin_bar"}
<!-- Including Commong header -->
<div class="container_container">
{include file="$style_dir/header.html" }

View file

@ -53,7 +53,7 @@ var imageurl = '{$imageurl}';
<!-- Including JS Files-->
{include_header file='global_header'}
{include_header file="admin_bar"}
<!-- Including Plugin Headers -->
@ -84,9 +84,9 @@ var mid = {$smarty.get.mid};
{/literal}
{if $smarty.get.query == ""}
{literal}
$("#searchSelectWrapper ul li:first-child").addClass('selected');
$('#selectedText').text($("#searchSelectWrapper ul li:first-child a").text());
$('#searchType').val($("#searchSelectWrapper ul li:first-child a").attr('id'));
$("#searchSelectWrapper ul li a").filter('#videos').parent().addClass('selected');
$('#selectedText').text($("#searchSelectWrapper ul li a").filter('#videos').text());
$('#searchType').val($("#searchSelectWrapper ul li a").filter('#videos').attr('id'));
{/literal}
{else}
{literal}

View file

@ -38,12 +38,6 @@ if($details)
if($_GET['leave'])
$cbgroup->leave_group($details['group_id'],userid());
//Getting list of topics
$topics = $cbgroup->get_topics(array('group'=>$details['group_id']));
assign('topics',$topics);
subtitle($details['group_name']);
//Calling all functions when a topic is called
call_view_group_functions($details);
@ -58,6 +52,11 @@ if($details)
}
}
//Getting list of topics
$topics = $cbgroup->get_topics(array('group'=>$details['group_id']));
assign('topics',$topics);
subtitle($details['group_name']);
}else
{
e(lang("grp_exist_error"));