more migration of page types

This commit is contained in:
redmatrix 2015-05-21 22:17:17 -07:00
parent 25bd332aab
commit 5795e2a58b
8 changed files with 40 additions and 42 deletions

View File

@ -5,7 +5,7 @@ require_once('include/menu.php');
require_once('include/widgets.php');
// When editing a webpage - a dropdown is needed to select a page layout
// On submit, the pdl_select value (which is the mid of an item with item_restrict = ITEM_PDL) is stored in
// On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in
// the webpage's resource_id, with resource_type 'pdl'.
// Then when displaying a webpage, we can see if it has a pdl attached. If not we'll

View File

@ -902,10 +902,10 @@ function widget_random_block($arr) {
$r = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and sid like '%s' and service = 'BUILDBLOCK' and
item_restrict = %d $sql_options order by $randfunc limit 1",
item_type = %d $sql_options order by $randfunc limit 1",
intval($channel_id),
dbesc('%' . $contains . '%'),
intval(ITEM_BUILDBLOCK)
intval(ITEM_TYPE_BUILDBLOCK)
);
if($r) {

View File

@ -50,10 +50,10 @@ function block_content(&$a) {
$r = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and
item_restrict = %d $sql_options $revision limit 1",
item_type = %d $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_BUILDBLOCK)
intval(ITEM_TYPE_BUILDBLOCK)
);
if(! $r) {
@ -62,10 +62,10 @@ function block_content(&$a) {
$x = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and
item_restrict = %d $revision limit 1",
item_type = %d $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_BUILDBLOCK)
intval(ITEM_TYPE_BUILDBLOCK)
);
if($x) {
// Yes, it's there. You just aren't allowed to see it.

View File

@ -84,7 +84,7 @@ function blocks_content(&$a) {
}
$x = array(
'webpage' => ITEM_BUILDBLOCK,
'webpage' => ITEM_TYPE_BUILDBLOCK,
'is_owner' => true,
'nickname' => $a->profile['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
@ -108,9 +108,9 @@ function blocks_content(&$a) {
$editor = status_editor($a,$x);
$r = q("select iid, sid, mid, title, body, mimetype, created, edited from item_id left join item on item_id.iid = item.id
where item_id.uid = %d and service = 'BUILDBLOCK' and item_restrict = %d order by item.created desc",
where item_id.uid = %d and service = 'BUILDBLOCK' and item_type = %d order by item.created desc",
intval($owner),
intval(ITEM_BUILDBLOCK)
intval(ITEM_TYPE_BUILDBLOCK)
);
$pages = null;
@ -143,21 +143,21 @@ function blocks_content(&$a) {
$url = z_root() . '/editblock/' . $which;
$o .= replace_macros(get_markup_template('blocklist.tpl'), array(
'$baseurl' => $url,
'$title' => t('Blocks'),
'$name' => t('Block Name'),
'$baseurl' => $url,
'$title' => t('Blocks'),
'$name' => t('Block Name'),
'$blocktitle' => t('Block Title'),
'$created' => t('Created'),
'$edited' => t('Edited'),
'$create' => t('Create'),
'$edit' => t('Edit'),
'$share' => t('Share'),
'$delete' => t('Delete'),
'$editor' => $editor,
'$pages' => $pages,
'$channel' => $which,
'$view' => t('View'),
'$preview' => '1',
'$created' => t('Created'),
'$edited' => t('Edited'),
'$create' => t('Create'),
'$edit' => t('Edit'),
'$share' => t('Share'),
'$delete' => t('Delete'),
'$editor' => $editor,
'$pages' => $pages,
'$channel' => $which,
'$view' => t('View'),
'$preview' => '1',
));
return $o;

View File

@ -136,14 +136,14 @@ function editblock_content(&$a) {
$o .= replace_macros($tpl,array(
'$return_path' => $rp,
'$action' => 'item',
'$webpage' => ITEM_BUILDBLOCK,
'$webpage' => ITEM_TYPE_BUILDBLOCK,
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$writefiles' => (perm_is_allowed($owner, get_observer_hash(), 'post_photos') || perm_is_allowed($owner, get_observer_hash(), 'write_storage')),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$writefiles' => (perm_is_allowed($owner, get_observer_hash(), 'post_photos') || perm_is_allowed($owner, get_observer_hash(), 'write_storage')),
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),

View File

@ -115,7 +115,7 @@ function item_post(&$a) {
* Check service class limits
*/
if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
$ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_WEBPAGE) ? true : false));
$ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_TYPE_WEBPAGE) ? true : false));
if (!$ret['success']) {
notice( t($ret['message']) . EOL) ;
if(x($_REQUEST,'return'))
@ -674,9 +674,6 @@ function item_post(&$a) {
if($moderated)
$item_restrict = $item_restrict | ITEM_MODERATED;
if($webpage)
$item_restrict = $item_restrict | $webpage;
if(! strlen($verb))
$verb = ACTIVITY_POST ;
@ -742,6 +739,7 @@ function item_post(&$a) {
$datarray['item_unseen'] = $item_unseen;
$datarray['item_wall'] = $item_wall;
$datarray['item_origin'] = $item_origin;
$datarray['item_type'] = $webpage;
$datarray['item_thread_top'] = $item_thread_top;
$datarray['layout_mid'] = $layout_mid;
$datarray['public_policy'] = $public_policy;

View File

@ -134,10 +134,10 @@ function layouts_content(&$a) {
$editor = status_editor($a,$x);
$r = q("select iid, sid, mid, title, body, mimetype, created, edited from item_id left join item on item_id.iid = item.id
where item_id.uid = %d and service = 'PDL' and item_restrict = %d order by item.created desc",
$r = q("select iid, sid, mid, title, body, mimetype, created, edited, item_type from item_id left join item on item_id.iid = item.id
where item_id.uid = %d and service = 'PDL' and item_type = %d order by item.created desc",
intval($owner),
intval(ITEM_PDL)
intval(ITEM_TYPE_PDL)
);
$pages = null;

View File

@ -64,7 +64,7 @@ function page_init(&$a) {
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_TYPE_WEBPAGE),
intval(ITEM_PDL)
intval(ITEM_TYPE_PDL)
);
if(! $r) {
@ -87,7 +87,7 @@ function page_init(&$a) {
return;
}
if($r[0]['item_restrict'] == ITEM_PDL) {
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
require_once('include/comanche.php');
comanche_parser(get_app(),$r[0]['body']);
get_app()->pdl = $r[0]['body'];
@ -118,8 +118,8 @@ function page_content(&$a) {
if(! $r)
return;
if($r[0]['item_restrict'] == ITEM_PDL) {
$r[0]['body'] = t('Ipsum Lorem');
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
$r[0]['body'] = t('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';