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"; $type = "photos";
$CollectParams = $CollectParams =
array("collection_name"=>$name,"collection_description"=>$desc,"collection_tags"=>$tags,"category"=>$cat,"type"=>$type,"allow_comments"=>"yes","broadcast"=>"public","public_upload"=>"yes"); 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()) if(msg())
{ {
@ -915,6 +915,7 @@ if(!empty($mode))
$ajax['msg'] = $msg; $ajax['msg'] = $msg;
$ajax['err'] = $err; $ajax['err'] = $err;
$ajax['id'] = $insert_id;
echo json_encode($ajax); echo json_encode($ajax);
} }
@ -923,6 +924,7 @@ if(!empty($mode))
case "ajaxPhotos": case "ajaxPhotos":
{ {
$cbphoto->insert_photo(); $cbphoto->insert_photo();
if(msg()) if(msg())
{ {
$msg = msg_list(); $msg = msg_list();

View file

@ -789,8 +789,9 @@ class Collections extends CBCategory
$query_field[] = "active"; $query_field[] = "active";
$query_val[] = "yes"; $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"); e(lang("collect_added_msg"),"m");
return $insert_id;
} }
} }
@ -902,7 +903,7 @@ class Collections extends CBCategory
*/ */
function delete_collection($cid) function delete_collection($cid)
{ {
global $db; global $db,$eh;
$collection = $this->get_collection($cid); $collection = $this->get_collection($cid);
if(empty($collection)) if(empty($collection))
e(lang("collection_not_exists")); e(lang("collection_not_exists"));
@ -923,6 +924,7 @@ class Collections extends CBCategory
$db->delete(tbl($this->items),array("collection_id"),array($cid)); $db->delete(tbl($this->items),array("collection_id"),array($cid));
$this->delete_thumbs($cid); $this->delete_thumbs($cid);
$db->delete(tbl($this->section_tbl),array("collection_id"),array($cid)); $db->delete(tbl($this->section_tbl),array("collection_id"),array($cid));
$eh->flush();
e(lang("collection_deleted"),"m"); 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) function get_image_file($pid,$size='t',$multi=false,$assign=NULL,$with_path=true,$with_orig=false)
{ {
$params = array("details"=>$pid,"size"=>$size,"multi"=>$multi,"assign"=>$assign,"with_path"=>$with_path,"with_orig"=>$with_orig);
if(empty($pid)) return $this->getFileSmarty($params);
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;
}
} }
/** /**
@ -1640,13 +1571,11 @@ class CBPhotos
*/ */
function getFileSmarty($p) function getFileSmarty($p)
{ {
$details = $p['details']; $details = $p['details'];
if(empty($details)) if(empty($details))
{ {
return $this->default_thumb($size); return $this->default_thumb($size);
} else { } else {
//Calling Custom Functions //Calling Custom Functions
if(count($Cbucket->custom_get_photo_funcs) > 0) if(count($Cbucket->custom_get_photo_funcs) > 0)
{ {
@ -1665,14 +1594,16 @@ class CBPhotos
if(($p['size'] != 't' && $p['size'] != 'm' && $p['size'] != 'l' && $p['size'] != 'o') || empty($p['size'])) if(($p['size'] != 't' && $p['size'] != 'm' && $p['size'] != 'l' && $p['size'] != 'o') || empty($p['size']))
$p['size'] = 't'; $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)) if(!is_array($details))
$photo = $this->get_photo($details); $photo = $this->get_photo($details);
else else
$photo = $details; $photo = $details;
if(empty($photo['photo_id']) || empty($photo['photo_key'])) if(empty($photo['photo_id']) || empty($photo['photo_key']))
return $this->default_thumb($size); return $this->default_thumb($size);
else else
{ {
@ -1685,10 +1616,21 @@ class CBPhotos
{ {
$file_parts = explode("/",$file); $file_parts = explode("/",$file);
$thumb_name = $file_parts[count($file_parts)-1]; $thumb_name = $file_parts[count($file_parts)-1];
if($with_path) $type = $this->get_image_type($thumb_name);
$thumbs[] = PHOTOS_URL."/".$thumb_name; if($with_orig)
else {
$thumbs[] = $thumb_name; 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') if(empty($p['output']) || $p['output'] == 'non_html')
@ -1703,6 +1645,7 @@ class CBPhotos
$size = "_".$p['size']; $size = "_".$p['size'];
$return_thumb = array_find($photo['filename'].$size,$thumbs); $return_thumb = array_find($photo['filename'].$size,$thumbs);
if(empty($return_thumb)) if(empty($return_thumb))
{ {
$this->default_thumb($size); $this->default_thumb($size);
@ -1710,7 +1653,7 @@ class CBPhotos
if($p['assign'] != NULL) if($p['assign'] != NULL)
assign($p['assign'],$return_thumb); assign($p['assign'],$return_thumb);
else else
echo $return_thumb; return $return_thumb;
} }
} }
} }
@ -1724,7 +1667,8 @@ class CBPhotos
if(empty($src)) if(empty($src))
$src = $this->default_thumb($size); $src = $this->default_thumb($size);
else else
$src = $src; $src = $src;
$dem = getimagesize($src); $dem = getimagesize($src);
$width = $dem[0]; $width = $dem[0];
$height = $dem[1]; $height = $dem[1];
@ -2265,9 +2209,12 @@ class CBPhotos
foreach($types as $type) foreach($types as $type)
{ {
$type = str_replace(' ','',$type); $type = strtolower($type);
$newArr['type'] = $type; if(in_array($type,$this->embed_types)) {
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr)); $type = str_replace(' ','',$type);
$newArr['type'] = $type;
$codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr));
}
} }
if($newArr['assign']) if($newArr['assign'])

View file

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

View file

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

View file

@ -53,7 +53,7 @@
<li onclick="get_group_info('#members',this)">{lang code='members'}</li> <li onclick="get_group_info('#members',this)">{lang code='members'}</li>
{/if} {/if}
{if isSectionEnabled('videos')} {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} {/if}
<li onclick="get_group_info('#flag_group',this); $('#flag_item').slideDown()">{lang code='report_this'}</li> <li onclick="get_group_info('#flag_group',this); $('#flag_item').slideDown()">{lang code='report_this'}</li>
</ul> </ul>
@ -125,7 +125,7 @@
<!-- Group members--> <!-- Group members-->
<!-- Group videos--> <!-- 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=gpvidlimit value=func->config(videos_items_grp_page)}
{assign var=gpvids value=$cbgroup->get_group_videos($group.group_id,'yes',$gpvidlimit)} {assign var=gpvids value=$cbgroup->get_group_videos($group.group_id,'yes',$gpvidlimit)}
{if $gpvids} {if $gpvids}

View file

@ -30,7 +30,7 @@
{lang code='topic_by_user' assign='topic_by_user'} {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} <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>
<td width="150" align="left">{$topic.total_views|number_format}</td> <td width="150" align="left">{$topic.total_views|number_format}</td>
<td width="100" align="left">{$topic.total_replies|number_format}</td> <td width="100" align="left">{$topic.total_replies|number_format}</td>

View file

@ -25,29 +25,28 @@
<li style="list-style:none">Collection does not exist.</li> <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 unactive.</li>
<li style="list-style:none">It is private.</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> <li style="list-style:none; margin-top:5px; font-weight:bold;">You can select collection once your photos have been uploaded.</li>
</div> </div>
</div> </div>
{/if} {/if}
{else} {else}
{if !$has_collection}
<div class="photoBox clearfix"> <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> <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()} {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 --> <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 --> <div class="clearfix" style="padding:8px;" id="CollectionDIV" > <!-- Also keep this id. After addition this will slideUp -->
{foreach from=$reqFields item=field} {foreach from=$reqFields item=field}
{if $field.id != 'type'} {if $field.id != 'type'}
<div class="field clearfix" style="margin-bottom:3px;"> <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; <label for="{$field.id}" style="font:bold 11px Tahoma; padding-top:3px; width:100px;" class="moveL">{$field.title}</label>
{$formObj->createField($field)} <div class="moveL">{$formObj->createField($field)}</div>
</div> </div>
{/if} {/if}
{/foreach} {/foreach}
<div class="moveR"><button type="button" onclick="ajax_add_collection(this);" class="LoadMoreButton">Add Collection</button></div> <div class="moveR"><button type="button" onclick="ajax_add_collection(this);" class="LoadMoreButton">Add Collection</button></div>
</div> </div>
</div> </div>
{/if}
{/if} {/if}

View file

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

View file

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

View file

@ -37,12 +37,6 @@ if($details)
//Leaving //Leaving
if($_GET['leave']) if($_GET['leave'])
$cbgroup->leave_group($details['group_id'],userid()); $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 //Calling all functions when a topic is called
call_view_group_functions($details); 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 }else
{ {
e(lang("grp_exist_error")); e(lang("grp_exist_error"));