Ejemplo n.º 1
0
     $imgno = '1';
     $uploadedimgsize = @getimagesize($image['tmp_name']);
     $result = array();
     if ($uploadedimgsize[0] > $imglimit || $uploadedimgsize[0] > $imglimit) {
         $result['result'] = 'File is too big, max width/height allowed is ' . $imglimit . 'px';
     } else {
         if (is_null($draft->id)) {
             $draft->create($design->id, '', $design->colors_request, $design->followers->list_raw);
         }
         $draft->uploadImage($imgno, $image['tmp_name'], $image['name']);
         $result['result'] = webImage($draft->{'image_' . $imgno}, $thumbsize, $thumbsize, $draft_title, 'img-border');
     }
     $result['drafts_id'] = $draft->id;
     $result['draft_key'] = $draft_key;
     $result['prevdraft'] = count($drafts);
     $result['box_colors'] = drawBoxColor($draft->colors_request);
     $result['colors_added'] = getColorNumbers($draft->colors_request);
     echo ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'DELETEDRAFT') {
     $drafts_id = tep_db_prepare_input($_POST['drafts_id']);
     $draft_key = tep_db_prepare_input($_POST['draft_key']);
     $draft = new design_draft($drafts_id);
     $design = new design($draft->designs_id);
     $draft->delete();
     $drafts = $design->retrieveDrafts();
     $result = array();
     $result['drafts_id'] = $drafts_id;
     $result['draft_key'] = $draft_key;
     $result['total_drafts'] = count($drafts);
     $result['image'] = webImage($draft->image_1, $imgsize, $imgsize, $draft_title);
Ejemplo n.º 2
0
function drawColorsRequest($colors_request, $id, $style = '', $title = '', $title_tag = '', $view_only = false, $hidden_input = '')
{
    if ($style == '') {
        $style = 'margin:5px 0 10px 0';
    }
    $content = '';
    if ($title != '') {
        if (is_null($title_tag)) {
            $content_title .= $title;
        } else {
            if (!$view_only) {
                $title .= ' <small class="red" style="font-weight:normal;">*Use <em>Enter</em> to seperate multi colors</small>';
            }
            if ($title_tag == '') {
                $title_tag = 'h3';
            }
            $content_title .= "<{$title_tag}>{$title}</{$title_tag}>";
        }
    }
    if (trim($colors_request) == '') {
        $colors_request = NO_INPUT_TEXT_YET;
    }
    if ($view_only) {
        $colors_request_disp = $colors_request == NO_INPUT_TEXT_YET ? '<span class="notice">None</span>' : drawBoxColor($colors_request, true);
    } elseif (!$view_only && trim($colors_request) != '') {
        if ($colors_request == NO_INPUT_TEXT_YET) {
            $cr = $colors_request;
        } else {
            $cr .= drawBoxColor($colors_request);
        }
        $colors_request_disp = $cr;
    }
    $add_button = $view_only ? '' : ' <div class="cr-add pointer" style="float:right;padding:2px 5px 2px 5px;" title="Add new colors">[ + ]' . $hidden_input . '</div>';
    $content .= '<div style="' . $style . '">' . $content_title;
    $content .= '<div id="' . $id . '" class="colors-request-box ui-corner-all" style="padding:4px;">';
    $content .= '<div>' . $add_button . '<div class="cr-val" style="overflow:auto;width:91%;padding:2px 0 2px 0;">' . $colors_request_disp . '</div></div>';
    if (!$view_only) {
        $content .= '<div class="cr-upd small" style="display:none;text-align:right;">';
        $content .= '<textarea class="cr-txt" style="width:100%"></textarea><br />';
        $content .= '<input type="button" class="cr-sav" value="Save" />';
        $content .= '<input type="button" class="cr-can" value="Cancel" />';
        $content .= '</div>';
    }
    $content .= '</div>';
    $content .= '</div>';
    return $content;
}
Ejemplo n.º 3
0
 function updateColorsRequest($username, $colors)
 {
     global $obj_notifications;
     $colors = explode("\n", $colors);
     $colors_request = array();
     if (!is_null($this->colors_request) && $this->colors_request != '') {
         $crs = explode('||', $this->colors_request);
         foreach ($crs as $cr) {
             $cr_temp = explode('|', $cr);
             $colors_request[$cr_temp[0]] = $cr_temp[1];
             $next_nr = $cr_temp[0];
         }
     }
     $new_colors = array();
     $new_colors_key = array();
     $new_colors_for_notifications = array();
     $box_new_colors = '';
     $next_nr++;
     foreach ($colors as $color) {
         $color = trim($color);
         if (!in_array($color, $colors_request) && !in_array($color, $new_colors)) {
             $new_colors[] = "{$next_nr}|{$color}";
             $new_colors_key[] = $next_nr;
             $new_colors_for_notifications[] = $color;
             $next_nr++;
         }
     }
     if (count($new_colors) > 0) {
         $new_colors = implode('||', $new_colors);
         foreach ($colors_request as $key => $color) {
             $current_colors_list[] = "{$key}|{$color}";
         }
         $new_colors_list = count($colors_request) == 0 ? $new_colors : implode('||', $current_colors_list) . "||{$new_colors}";
         $this->colors_request = $new_colors_list;
         $this->updateField('colors_request', $this->colors_request, '||||');
         $notification_targets = $this->followers->list;
         $notification_targets[] = $this->owner_id;
         $notification_message = $obj_notifications->messageTemplateAddDetails($username, 'Design', $this->id, 'Colors Request', implode(', ', $new_colors_for_notifications), self::getDesignCategory($this->category), $this->name);
         $obj_notifications->broadcast($notification_targets, $notification_message, $username);
         $result = array();
         $result['colors_added'] = implode(',', $new_colors_key);
         $result['box_new_colors'] = drawBoxColor($new_colors);
         return $result;
     } else {
         return false;
     }
 }