further gallery changes

This commit is contained in:
messerbill 2013-12-18 17:18:05 +01:00
parent b2977ef8dd
commit 1fac1e8774
2 changed files with 10 additions and 7 deletions

View File

@ -41,6 +41,8 @@ class img {
public static function delete($cat, $id) { public static function delete($cat, $id) {
if (!array_key_exists($cat, self::$imgfolders)) { if (!array_key_exists($cat, self::$imgfolders)) {
throw new \SYSTEM\LOG\ERROR("No matching Cat '" . $cat . "' found.");} throw new \SYSTEM\LOG\ERROR("No matching Cat '" . $cat . "' found.");}
if(!file_exists(self::$imgfolders[$cat][0].$id)){
return false;}
return unlink(self::$imgfolders[$cat][0].$id); return unlink(self::$imgfolders[$cat][0].$id);
} }

View File

@ -2,14 +2,14 @@
namespace SYSTEM\SAI; namespace SYSTEM\SAI;
class saimod_sys_img extends \SYSTEM\SAI\SaiModule { class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_delete($cat,$id){ public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_del($cat,$id){
if(!\SYSTEM\IMG\img::delete($cat, $id)){ if(!\SYSTEM\IMG\img::delete($cat, $id)){
throw new \SYSTEM\LOG\ERROR("delete problem");} throw new \SYSTEM\LOG\ERROR("delete problem");}
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();
} }
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_rename($cat,$id,$newid){ public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_rn($cat,$id,$newid){
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();
} }
@ -31,11 +31,12 @@ class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
<input type="file" name="datei"><br> <input type="file" name="datei"><br>
<input type="submit" class="btn" value="Add">'; <input type="submit" class="btn" value="Add">';
$result .= "</form>"; $result .= "</form>";
$result .= "<table>";
foreach($cat as $img){ foreach($cat as $img){
//$result .= '<img src="api.php?call=img&cat='.$name.'&id='.$img.'" alt="" />'; //$result .= '<img src="api.php?call=img&cat='.$name.'&id='.$img.'" alt="" />';
$result .= '<input type="button" class="btn-danger imgdelbtn" style="margin: 1px;" value="Delete" cat="'.$name.'" id="'.$img.'"><input type="submit" class="btn-warning imgrnbtn" style="margin: 1px; margin-right: 3px;" value="Rename" cat="'.$name.'" id="'.$img.'"><a href="api.php?call=img&cat='.$name.'&id='.$img.'">'.$img.'</a><br>'; $result .= '<tr><td><input type="button" class="btn-danger imgdelbtn" style="margin: 1px; margin-right: 3px" value="Delete" cat="'.$name.'" id="'.$img.'"></td><td><a href="api.php?call=img&cat='.$name.'&id='.$img.'">'.$img.'</a></td><td><input type="text" class="form-control" style="width: 100px; margin:0;" placeholder="new name..."></td><td><input type="submit" class="btn-warning imgrnbtn" style="margin: 1px;;" value="Rename" cat="'.$name.'" id="'.$img.'"></td></tr>';
} }
$result .= "</table>";
} }
return $result; return $result;
} }