Hi,
I'm using this clever and timesaving MOD quite often to move images among categories. It is ok if you can select the images via the provided search-fields.
But as a new frequent task I have to move a lot of images from different categories into a single target category. But the problem is that those images don't fit any simple, single search-condition.
I would like to gather all the images manually into the
lightbox for transfer. So I needed three things as a little ADD-ON to this MOD:
==> Don't forget to backup every module before applying changes !!!#1: A radio button saying "Process images in lightbox only".To have this
insert the
red code-fragment into
\admin\images.php show_input_row($lang['field_hits_upper'], "hitsupper", "", $textinput_size);
show_input_row($lang['field_hits_lower'], "hitslower", "", $textinput_size);
#
# [MOD] Process images in lightbox only <Start Part #1>
#
show_radio_row($lang['lightbox_only'], "lightbox_only", $lightbox_only);
#
# [MOD] Process images in lightbox only <END Part #1>
#
show_table_separator($lang['sort_options'], 2);
#2: The code performing what the radio button promises:To have this
insert the
red code-fragments also into
\admin\images.php $limitnumber = (isset($HTTP_POST_VARS['limitnumber'])) ? trim($HTTP_POST_VARS['limitnumber']) : 1;
if (!$limitnumber) {
$limitnumber = 1;
}
#
# [MOD] Process images in lightbox only <Start Part #2>
#
$lightbox_only = (isset($HTTP_POST_VARS['lightbox_only'])) ? trim($HTTP_POST_VARS['lightbox_only']) : 0;
if (!$lightbox_only) {
$lightbox_only = 0;
}
#
# [MOD] Process images in lightbox only <End Part #2>
#
if (isset($HTTP_GET_VARS['direction']) || isset($HTTP_POST_VARS['direction'])) {
$direction = (isset($HTTP_GET_VARS['direction'])) ? trim($HTTP_GET_VARS['direction']) : trim($HTTP_POST_VARS['direction']);
}
else {
$direction = "ASC";
}
if ($nextpage && !$nextpageabort) {
$limitstart = $limitstart + $limitnumber;
}
#
# [MOD] Process images in lightbox only <Start Part #3>
#
if ($lightbox_only == 1)
{
if (!empty($user_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
} else {
$image_id_sql = "0";
}
$sql = "SELECT COUNT(*) AS images
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
$countimages = $site_db->query_firstrow($sql);
} else {
$sql = "SELECT COUNT(*) AS images
FROM ".IMAGES_TABLE." i
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE $condition";
$countimages = $site_db->query_firstrow($sql);
}
#
# [MOD] Process images in lightbox only <End Part #3>
#
$limitfinish = $limitstart + $limitnumber;
echo "<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
#
# [MOD] Process images in lightbox only <Start Part #4>
#
if ($lightbox_only == 1)
{
if (!empty($user_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
} else {
$image_id_sql = "0";
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_active, i.image_name, i.image_media_file, i.image_thumb_file, i.image_date, i.image_description, i.image_keywords".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY $orderby $direction
LIMIT ".(($limitstart) ? $limitstart-1 : 0).", $limitnumber";
$result = $site_db->query($sql);
}
else
{
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, i.image_date, i.image_description, i.image_keywords".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE $condition
ORDER BY $orderby $direction
LIMIT ".(($limitstart) ? $limitstart-1 : 0).", $limitnumber";
$result = $site_db->query($sql);
}
#
# [MOD] Process images in lightbox only <END Part #4>
#
$i = 0;
while ($image_row = $site_db->fetch_array($result)) {
show_hidden_input("hitsupper", $hitsupper);
show_hidden_input("hitslower", $hitslower);
#
# [MOD] Process images in lightbox only <Start Part #5>
#
show_hidden_input("lightbox_only", $lightbox_only);
#
# [MOD] Process images in lightbox only <End Part #5>
#
show_hidden_input("orderby", $orderby, 1);
#3: The text displayed by the radio button:To have this
insert the
red code-fragment into
\lang\deutsch\admin.php ...
$lang['field_hits_upper'] = "Anzahl Hits größer als";
$lang['field_hits_lower'] = "Anzahl Hits kleiner als";
$lang['lightbox_only'] = "Nur Bilder aus Leuchtkasten bearbeiten";
//-----------------------------------------------------
//--- Navigation --------------------------------------
//-----------------------------------------------------
... and into
\lang\english\admin.php ...
$lang['field_hits_upper'] = "Hits higher than";
$lang['field_hits_lower'] = "Hits lower than";
$lang['lightbox_only'] = "Process images in lightbox only";
//-----------------------------------------------------
//--- Navigation --------------------------------------
//-----------------------------------------------------
That's all folks. I hope my ADD-ON will be usefull to somebody.
e-trader_2002