Beispiel #1
0
    public function FormMultyPoint($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        $src = isset($attribs['src']) ? $attribs['src'] : NULL;
        $options = isset($attribs['multiOptions']) ? $attribs['multiOptions'] : array();
        $script = '
$("#container_' . $id . ' .z_multy_point").click(function(){
	$("#container_' . $id . ' .z_multy_point").css("background-color","black");
	$("#container_' . $id . ' .z_multy_point").css("border","1px solid red");
	$(this).css("background-color","red");
	$(this).css("border","1px solid black");
	$("#value_' . $id . '").attr("value",$(this).attr("rel"));
});
        ';
        $divs = '';
        foreach ($options as $key => $el) {
            list($x, $y) = explode(';', $el);
            if ($value == $key) {
                $divs .= '<div class="z_multy_point" rel="' . $key . '" id="point_' . $key . '_' . $this->view->escape($id) . '" style="width: 7px; height: 7px; position: absolute; background-color: red; border: 1px solid black; margin-top: ' . ($y - 5) . 'px; margin-left:' . ($x - 5) . 'px; cursor:pointer;">&nbsp;</div>';
            } else {
                $divs .= '<div class="z_multy_point" rel="' . $key . '" id="point_' . $key . '_' . $this->view->escape($id) . '" style="width: 7px; height: 7px; position: absolute; background-color: black; border: 1px solid red; margin-top: ' . ($y - 5) . 'px; margin-left:' . ($x - 5) . 'px; cursor:pointer;">&nbsp;</div>';
            }
        }
        jQuery::evalScript($script);
        // build the element
        $xhtml = '<div id="container_' . $this->view->escape($id) . '">' . $divs . '<img src="' . $src . '"' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '</img></div>' . '<input id="value_' . $this->view->escape($id) . '" type="hidden" name="' . $name . '" value="' . $value . '"></input>';
        return $xhtml;
    }
Beispiel #2
0
 public function loginAction()
 {
     $form = new Z_Admin_Form();
     $form->setElementDecorators(array('ViewHelper'));
     $form->addElement('text', 'login', array('required' => true, 'class' => 'ui-state-active ui-corner-bottom z-login-input'));
     $form->addElement('Password', 'password', array('required' => true, 'class' => 'ui-state-active ui-corner-bottom z-login-input'));
     $form->addElement('Checkbox', 'remember', array());
     $form->addElement('Submit', 'submit', array('label' => 'Войти', 'class' => 'ui-state-default ui-corner-bl submit', 'onMouseOver' => '$(this).addClass("ui-state-hover ui-state-active")', 'onMouseOut' => '$(this).removeClass("ui-state-hover ui-state-active")'));
     if ($_POST && !isset($_POST['logout'])) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             if (Z_Auth::getInstance()->login($data['login'], $data['password'], $data['remember'] ? true : false)) {
                 jQuery::evalScript('z_menu_show();');
                 $this->ajaxGo('/' . $this->getRequest()->getModuleName() . '/');
             } else {
                 Z_FlashMessenger::addMessage('Логин или пароль не верны');
             }
         } else {
             Z_FlashMessenger::addMessage('Введите логин и пароль');
         }
     }
     if (Z_Auth::getInstance()->getUser()->getLogin() != 'guest') {
         $this->_forward('logout');
         return;
     }
     $this->view->form = $form;
 }
Beispiel #3
0
    public function FormEditArea($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        $syntax = isset($attribs['syntax']) ? $attribs['syntax'] : 'php';
        $height = isset($attribs['height']) ? $attribs['height'] : 300;
        $script = '
        

        
editAreaLoader.init({
	id : "' . $id . '",
	syntax: "' . $syntax . '",
	start_highlight: true,
	language: "ru",
	allow_resize: "no",
	allow_toggle: false,
	font_size: "10",
	toolbar: "charmap, search, |, undo, redo, |, highlight, reset_highlight, |, syntax_selection, fullscreen, help",
	syntax_selection_allow: "css,html,js,php,xml",
	plugins: "charmap",
	min_height: ' . $height . ',
	charmap_default: "arrows",
	save_callback: "z_editarea_change_event",
	change_callback: "z_editarea_change_event",
	submit_callback: "z_editarea_change_event"
});
        ';
        jQuery::evalScript($script);
        // build the element
        $xhtml = '<textarea name="' . $this->view->escape($name) . '"' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '>' . $value . '</textarea>';
        return $xhtml;
    }
    public function FormAutocompleteId($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        if (!isset($attribs['source'])) {
            throw new Exception('Не задан источник для элемента формы "autocomplete" ' . $name);
        }
        $source = $attribs['source'];
        $minLength = isset($attribs['minLength']) ? $attribs['minLength'] : 1;
        unset($attribs['source']);
        unset($attribs['minLength']);
        $script = '
		$("#' . $id . '_acString").autocomplete({
			source: "' . $source . '",
			minLength: ' . $minLength . ',
			select: function(event, ui) {
				$("#' . $id . '").attr("value",ui.item.id);
			}
		});		
		';
        jQuery::evalScript($script);
        $realvalue = '';
        if ($value) {
            jQuery::evalScript('
    		$.ajax({ url: "' . $source . '?id=' . $value . '", success: function(data, textStatus, XMLHttpRequest){
    			$("#' . $id . '_acString").attr("value",data);
      		}});
    		');
        }
        return parent::formText($name . '_acString', $realvalue, $attribs) . parent::formText($name, $value, array('style' => 'display: none;'));
    }
Beispiel #5
0
 public function jquery($selector = null)
 {
     if (!class_exists(jQuery)) {
         require_once APPLICATION_PATH . '/../library/Zkernel/Jquery/jQuery.php';
     }
     return $selector ? jQuery::addQuery($selector) : new jQuery();
 }
Beispiel #6
0
 function addOnReady($js)
 {
     if (is_object($js)) {
         $js = $js->getString();
     }
     if (!$this->atk4_initialised) {
         return parent::addOnReady($js);
     }
     $this->api->template->append('document_ready', "\$.atk4(function(){ " . $js . "; });\n");
     return $this;
 }
Beispiel #7
0
    public function render(Zend_View_Interface $view = null)
    {
        jQuery::evalScript('
			$(".z-form fieldset legend").click(function(){
				$(this).parent().find(">dl").toggle("blind",200);
			})
		');
        if (!$this->getAttrib('id')) {
            $this->setAttrib('id', 'z-admin-form-' . rand(1000000, 10000000));
        }
        return parent::render($view);
    }
Beispiel #8
0
    public function render(Zend_View_Interface $view = null)
    {
        $this->class = $this->class . " ui-widget-content ui-corner-all";
        $this->id = $this->id ? $this->id : rand(1000000, 10000000);
        $this->format = $this->format ? $this->format : 'yy-mm-dd';
        if (!$this->getValue()) {
            $this->setValue(date('Y-m-d'));
        }
        jQuery::evalScript('$("#' . $this->id . '").datepicker({
    		changeMonth: true,
			changeYear: true,
			dateFormat: "' . $this->format . '"
			});
		');
        return parent::render($view);
    }
Beispiel #9
0
 public static function getPlanetInfoToolTip($info)
 {
     $html = array();
     $html[] = sprintf('<span class="planet_tooltip">%s</span>', $info['planet']);
     $html[] = '<div class="tooltip">';
     $html[] = sprintf('<div class="tooltip_title">%s - %s</div>', $info['planet'], $info['longitude']);
     $html[] = '<div class="tooltip_content"><table margin="0">';
     $html[] = sprintf('<tr><td class="firstcell">Position: </td><td class="datacell">%d<sup>%s</sup> House</td></tr>', $info['position'], jQuery::ordinal($info['position']));
     if (count($info['lordship']) == 1) {
         $html[] = sprintf('<tr><td class="firstcell">Lord: </td><td class="datacell">%d<sup>%s</sup> House</td></tr>', $info['lordship'][0], jQuery::ordinal($info['lordship'][0]));
     } else {
         $html[] = sprintf('<tr><td class="firstcell">Lord: </td><td class="datacell">%d<sup>%s</sup> and %d<sup>%s</sup> Houses</td></tr>', $info['lordship'][0], jQuery::ordinal($info['lordship'][0]), $info['lordship'][1], jQuery::ordinal($info['lordship'][1]));
     }
     $html[] = sprintf('<tr><td class="firstcell">Potency: </td><td class="datacell">%s</td></tr>', $info['potency']);
     $html[] = sprintf('<tr><td class="firstcell"></td><td class="firstcell"><a target="_blank" href="%s#%s">more info &raquo;</a></td></tr>', get_linkTO('birth-chart/report/'), $info['planet']);
     $html[] = '</table></div></div>';
     $html = join('', $html);
     return $html;
 }
Beispiel #10
0
    public function FormAutocomplete($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        if (!isset($attribs['source'])) {
            throw new Exception('Не задан источник для элемента формы "autocomplete" ' . $name);
        }
        $source = $attribs['source'];
        $minLength = isset($attribs['minLength']) ? $attribs['minLength'] : 1;
        unset($attribs['source']);
        unset($attribs['minLength']);
        $script = '
		$("#' . $id . '").autocomplete({
			source: "' . $source . '",
			minLength: ' . $minLength . '
		});		
		';
        jQuery::evalScript($script);
        return parent::formText($name, $value, $attribs);
    }
Beispiel #11
0
    public function FormPointPicker($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        $src = isset($attribs['src']) ? $attribs['src'] : NULL;
        @(list($x, $y) = explode(';', $value));
        $x = $x ? $x : 0;
        $y = $y ? $y : 0;
        $script = '
$("#' . $id . '").click(function(e){
	var x = e.pageX - $(this).offset().left;
	var y = e.pageY - $(this).offset().top;
	$("#point_' . $id . '").css("margin-left",x-4+"px");
	$("#point_' . $id . '").css("margin-top",y-4+"px");
	$("#coords_' . $id . '").attr("value",x+";"+y);
});
        ';
        jQuery::evalScript($script);
        // build the element
        $xhtml = '<div><div id="point_' . $this->view->escape($id) . '" style="width: 5px; height: 5px; position: absolute; background-color: red; border: 1px solid black; margin-top: ' . ($y - 4) . 'px; margin-left:' . ($x - 4) . 'px;">&nbsp;</div>' . '<img src="' . $src . '"' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '</img></div>' . '<input id="coords_' . $this->view->escape($id) . '" type="hidden" name="' . $name . '" value="' . $value . '"></input>';
        return $xhtml;
    }
Beispiel #12
0
 protected function doInit()
 {
     $this->html = new HTMLTag('button', new HTMLTag('span', $this->getLabel(), array('class' => 'ui-button-text')), array('class' => '\\Psc\\button'));
     $this->html->addClass(array('ui-button', 'ui-widget', 'ui-state-default', 'ui-corner-all'));
     if (isset($this->leftIcon)) {
         $this->html->addClass('ui-button-text-icon-primary');
     }
     if (isset($this->rightIcon)) {
         $this->html->addClass('ui-button-text-icon-secondary');
     }
     if (!isset($this->leftIcon) && !isset($this->rightIcon)) {
         $this->html->addClass('ui-button-text-only');
     }
     parent::doInit();
     if (isset($this->data)) {
         foreach ($this->data as $key => $value) {
             jQuery::data($this->html, $key, $value);
         }
     }
     if (isset($this->hint)) {
         $this->html->after($this->hint);
     }
 }
Beispiel #13
0
        $response = 'Field 1 = "' . htmlentities(stripslashes($field1)) . '"<br/>' . 'Field 2 = "' . htmlentities(stripslashes($field2)) . '"<br/>' . 'Field 3 = "' . htmlentities(stripslashes($field3)) . '"<br/>';
        jQuery('#testform')->html($response);
        break;
    case 'timeout':
        sleep(3);
        jQuery('#preview_content')->animate(array('opacity' => '0.5'), 1000)->animate(array('opacity' => '1'), 1000);
        break;
    case 'msg':
        jQuery::addMessage('Message 1...');
        jQuery::addMessage('Message 2...');
        break;
    case 'msg2':
        jQuery::addMessage('Message 1...', 'myCallBack');
        jQuery::addMessage('Message 2...', 'myCallBack');
        break;
    case 'err':
        jQuery::addError('Error 1...');
        jQuery::addError('Error 2...');
        break;
    case 'data':
        jQuery::addData('key1', 'value1');
        jQuery::addData('key2', 'value2', 'myCallBack');
        break;
    case 'eval':
        jQuery::evalScript('alert("Eval script...");');
        break;
    default:
        break;
}
jQuery::getResponse();
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately. 
*/
$tabsArray = array();
$tabsArray[] = array('id' => 'tab-banner', 'filename' => 'tab_banner.php', 'text' => TEXT_AFFILIATE_BANNERS);
$tabsArray[] = array('id' => 'tab-product', 'filename' => 'tab_product.php', 'text' => TEXT_AFFILIATE_BANNERS_PRODUCT);
$tabsArray[] = array('id' => 'tab-build', 'filename' => 'tab_build.php', 'text' => TEXT_AFFILIATE_BANNERS_BUILD);
$tabsArray[] = array('id' => 'tab-text', 'filename' => 'tab_text.php', 'text' => TEXT_AFFILIATE_BANNERS_TEXT);
require DIR_WS_CLASSES . 'jQuery.php';
$jQuery = new jQuery();
$jQuery->loadPlugin(array('tabs', 'facebox', 'button', 'form'));
$tabPanel = $jQuery->getPluginClass('tabs');
$tabPanel->setID('initialPane');
for ($tabCounter = 0, $tabTotal = sizeof($tabsArray); $tabCounter < $tabTotal; $tabCounter++) {
    $tabPanel->addTab($tabsArray[$tabCounter]['id'], $tabsArray[$tabCounter]['text']);
    ob_start();
    include 'includes/modules/affiliate_banners/' . $tabsArray[$tabCounter]['filename'];
    $tabContent = ob_get_contents();
    ob_end_clean();
    $tabPanel->addTabContent($tabsArray[$tabCounter]['id'], $tabContent);
    unset($tabContent);
}
$backButton = $jQuery->getPluginClass('button');
$backButton->setID('backButton');
$backButton->setText(IMAGE_BACK);
Beispiel #15
0
    protected function renderCropped($crop_options)
    {
        $this->initCropoptions();
        $previews = $headers = $footer = '';
        $img = $this->getValue();
        //id обрезаемой картинки
        $layout = Zend_Layout::getMvcInstance();
        $view = $layout->getView();
        $sizes = $cropped_coord = null;
        $i = -1;
        $image_size = getimagesize($this->_file->getFullName());
        //размер обрезаемой картинки
        foreach ($crop_options as $copt) {
            //цикл нужен для того, чтобы выдать все возможные превью генерируемые по входной картинке например 200х150 на главной странице и 300х250 на внутренней
            $i++;
            if (!isset($copt['label']) || !$copt['label']) {
                continue;
            }
            if (!isset($copt['width']) || (int) $copt['width'] == 0) {
                continue;
            }
            if (!isset($copt['height']) || (int) $copt['height'] == 0) {
                continue;
            }
            $headers .= '<td rel="' . $i . '" class="h">' . $copt['label'] . '</td>';
            $image = $view->z_Preview($img, array('w' => $copt['width'], 'h' => $copt['height']), true);
            $hoverer = '<div class="hoverer" style="width:' . $copt['width'] . 'px;height:' . $copt['height'] . 'px;overflow:hidden;display:none;"><img src="' . $this->_file->getSiteName() . '"></div>';
            $previews .= '<td rel="' . $i . '" valign="middle">' . '<img id="init_preview" rel="' . $i . '" src="' . $image . '"/>' . $hoverer . '</td>';
            $footer .= '<td rel="' . $i . '"><a href="#" class="z-button ui-button ui-state-default ui-corner-all ui-button-text-only select_preview" rel="' . $i . '"><span class="ui-button-text">Изменить</span></a></td>';
            $cropped_coord = $this->getCroppedParamsFromCroppedFile($image);
            //анализирует имя обрезанного вручную файла и вычленяет параметры обрезки x,y - начальные координаты верхнего левого угла обрезки, w,h - высоту и ширину вырезаемой области,
            if (!$cropped_coord) {
                //если координаты не получены значит файл не является обрезанным вручную
                $cropped_coord = $this->getCroppedCoordinates($copt['width'], $copt['height'], $image_size[0], $image_size[1]);
            }
            //пытаемся получить параметры обрезки которые делаются в автоматическом режиме при вызове скрипта generatepreview.php
            $sorted_coord['x'] = $cropped_coord['x'];
            //порядок параметров очень важен
            $sorted_coord['y'] = $cropped_coord['y'];
            $sorted_coord['w'] = $cropped_coord['w'];
            $sorted_coord['h'] = $cropped_coord['h'];
            $sizes[] = "[" . $copt['width'] . "," . $copt['height'] . ",[" . str_replace(',', '.', implode('|', $sorted_coord)) . "]]";
            //[[100,50,[0,2.445,100.2,100.4]],[150,200,[0,3,400,500]]]; [ширина выходной картинки, высота выходной картинки [параметры обрезки в автоматическом режиме или в ручном если есть обрезанный файл с такой шириной и высотой]] замену , на . делаем потому что при конвертации в float (полученный из json серилизованного массива параметров обрезки), цифры имеют вид 100,2 а нам нужны точки
        }
        if (!$headers) {
            return '';
        }
        $sizes = str_replace('|', ',', $sizes);
        $js_sizes = '[' . implode(',', $sizes) . ']';
        //var_dump($js_sizes);
        $previews = '<table class="previews"><tr>' . $headers . '</tr><tr>' . $previews . '</tr><tr>' . $footer . '</tr></table>';
        jQuery::evalScript("\n\t\tvar sizes = " . $js_sizes . ";\n\t\tvar k = 0;\t\n  \t\t \$(function(){\n  \t\t  var sizes = " . $js_sizes . ";\n\t\t\t//initCropbox();\n\t\t\t\$(\".select_preview\").click(function(){\n\t\t\t\tvar rel = \$(this).attr('rel');\n\t\t\t\tvar r = parseInt(rel, 0);\n\t\t\t\tvar w =sizes[rel][0];\n\t\t\t\tvar h = sizes[rel][1]; \n\t\t\t\t\$(\"#thumb_w\").val(w);\n\t\t\t\t\$(\"#thumb_h\").val(h);\n\t\t\t\t\$(\".accordion\").attr('sel',r);\n\t\t\t\tk=r;\n\t\t\t\t\$(\".accordion\").show();\n\t\t\t\tvar selectr_img = \"img[rel!='\"+rel+\"']\";\n\t\t\t\tvar selectr_td = \"td[rel='\"+rel+\"']\";\n\t\t\t\t\$(\"table.previews\").find(\"img\").removeClass('opacity');\n\t\t\t\t\$(\"table.previews\").find(selectr_img).addClass('opacity');\n\t\t\t\t\$(\"table.previews\").find(\"td\").removeClass('selected');\n\t\t\t\tvar active_td = \$(\"table.previews\").find(selectr_td);\n\t\t\t\t\$(active_td).addClass('selected');\n\t\t\t\t\n\t\t\t\t\$(\"img#init_preview\").show();\n\t\t\t\t\$(active_td).find(\"img#init_preview\").hide();\n\t\t\t\t\$(\".hoverer\").hide();\n\t\t\t\tvar active_hoverer = \$(active_td).find(\".hoverer\");\n\t\t\t\t\$(active_hoverer).show();\n\t\t\t\t\$(active_hoverer).find(\"img\").removeClass('opacity');\n\t\t\t\t\$(\".hoverer\").find(\"img\").removeClass('preview');\n\t\t\t\t\$(active_hoverer).find(\"img\").addClass('preview');\n\t\t\t\t\n\t\t\t\t\$(this).parent().parent()\n\t\t\t\tinitCropbox();\n\t\t\t\t\$(\"#hoverer\").css({\n\t\t\t\t\twidth:w+'px',\n\t\t\t\t\theight:h+'px',\n\t\t\t\t\toverflow:'hidden'\n\t\t\t\t});\t\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n\t\t\t\$(\"#cancel\").click(function (){\n\t\t\t\t\$(\".accordion\").hide();\n\t\t\t\t\$(\"table.previews\").find(\"img\").removeClass('opacity');\n\t\t\t\t\$(\"table.previews\").find(\"td\").removeClass('selected');\n\t\t\t\tclearValues(true);\n\t\t\t\t\n\t\t\t})\n\t\t });\n\t\t\tfunction initCropbox(){\n\t\t\t\t\$(\"#cropbox\").Jcrop({\n\t\t\t\t\taspectRatio: sizes[k][0]/sizes[k][1],\n\t\t\t\t\tonChange: showPreview,\n\t\t\t\t\tonSelect: showPreview,\n\t\t\t\t\tonRelease: clearValues,\n\t\t\t\t\tsetSelect:sizes[k][2],\n\t\t\t\t\tboxWidth: 1000, \n\t\t\t\t\tboxHeight: 1000 ,\n\t\t\t\t\tbgOpacity: 0.4,\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\tclearValues(false);\n\t\t\t}\t\t\nfunction clearValues(thumb_size){\n\t\$('#x').val('');\n\t\t\t\t\$('#y').val('');\n\t\t\t\t\$('#w').val('');\n\t\t\t\t\$('#h').val('');\n\tif(thumb_size){\n\t\t\$(\"#thumb_w\").val('');\n\t\t\$(\"#thumb_h\").val('');\n\t}\n\t\t\t\t\n}\t\t\t\nfunction showPreview(coords)\n{\n\tvar rx = sizes[k][0] / coords.w;\n\tvar ry = sizes[k][1] / coords.h;\n\n\t\$('.preview').css({\n\t\twidth: Math.round(rx * " . $image_size[0] . ") + 'px',\n\t\theight: Math.round(ry * " . $image_size[1] . ") + 'px',\n\t\tmarginLeft: '-' + Math.round(rx * coords.x) + 'px',\n\t\tmarginTop: '-' + Math.round(ry * coords.y) + 'px'\n\t});\n\t//updateCoords();\n\t\$('#x').val(coords.x);\n\t\t\t\t\$('#y').val(coords.y);\n\t\t\t\t\$('#w').val(coords.w);\n\t\t\t\t\$('#h').val(coords.h);\n}\n\t\t\tfunction updateCoords(c)\n\t\t\t{\n\t\t\t\t\$('#x').val(c.x);\n\t\t\t\t\$('#y').val(c.y);\n\t\t\t\t\$('#w').val(c.w);\n\t\t\t\t\$('#h').val(c.h);\n\t\t\t};\n\n    ");
        return $this->_style . '<br/>' . $previews . '<div class="accordion">
    			<div class="buttons_group z_form_buttons">
			<input type="submit" name="apply" id="apply" value="Вырезать" class="z-form-apply ui-button ui-state-default ui-corner-all z-button">
			<a href="#" id="cancel" class="z-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
				<span class="ui-button-text">Отмена</span>
			</a>
			</div>
        <img src="' . $this->_file->getSiteName() . '" id="cropbox"/>
			<input type="hidden" id="image" name="get_cropped_options[]" value="' . $this->getValue() . '"/>
			<input type="hidden" id="thumb_w" name="get_cropped_options[]" />
			<input type="hidden" id="thumb_h" name="get_cropped_options[]" />
			<input type="hidden" id="x" name="get_cropped_options[]" />
			<input type="hidden" id="y" name="get_cropped_options[]" />
			<input type="hidden" id="w" name="get_cropped_options[]" />
			<input type="hidden" id="h" name="get_cropped_options[]" />
		</div>';
    }
Beispiel #16
0
 public function init()
 {
     $this->_model = new Z_Model_Resources();
     $this->setTarget('#z-menu');
     jQuery::evalScript('z_menu_init();');
 }
Beispiel #17
0
 public function ajaxGo($url)
 {
     jQuery::evalScript('z_ajax_go("' . $url . '")');
 }
Beispiel #18
0
 /**
  * sendResponse
  *
  * send response to browser
  *
  * @access  public
  * @return  rettype  return
  */
 public function sendResponse()
 {
     // Keep Layouts
     require_once 'Zend/Controller/Action/HelperBroker.php';
     Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true);
     require_once 'Zend/Layout.php';
     $layout = Zend_Layout::getMvcInstance();
     if ($layout instanceof Zend_Layout) {
         $layout->disableLayout();
     }
     // set JSON header
     $response = Zend_Controller_Front::getInstance()->getResponse();
     $response->setHeader('Content-Type', 'application/json');
     // send JSON data and exit
     jQuery::getResponse();
 }
Beispiel #19
0
 /**
  * __construct
  * contructor of jQuery
  *
  * @return jQuery_Element
  */
 public function __construct($selector)
 {
     jQuery::addElement($this);
     $this->s = $selector;
 }
            }';
            exit;
        }
        smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
    }
}
define('AFFILIATE_NOTIFY_AFTER_BILLING', 'true');
// Nofify affiliate if he got a new invoice
define('AFFILIATE_DELETE_ORDERS', 'false');
// Delete affiliate_sales if an order is deleted (Warning: Only not yet billed sales are deleted)
define('AFFILIATE_TAX_ID', '1');
// Tax Rates used for billing the affiliates
// you get this from the URl (tID) when you select you Tax Rate at the admin: tax_rates.php?tID=1
// If set, the following actions take place each time you call the admin/affiliate_summary
define('AFFILIATE_DELETE_CLICKTHROUGHS', 'false');
// (days / false) To keep the clickthrough report small you can set the days after which they are deleted (when calling affiliate_summary in the admin)
define('AFFILIATE_DELETE_AFFILIATE_BANNER_HISTORY', 'false');
// (days / false) To keep thethe table AFFILIATE_BANNER_HISTORY small you can set the days after which they are deleted (when calling affiliate_summary in the admin)
// If an order is deleted delete the sale too (optional)
if ($_GET['action'] == 'deleteconfirm' && basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']) == FILENAME_ORDERS && AFFILIATE_DELETE_ORDERS == 'true') {
    $affiliate_oID = smn_db_prepare_input($_GET['oID']);
    smn_db_query("delete from " . TABLE_AFFILIATE_SALES . " where affiliate_orders_id = '" . smn_db_input($affiliate_oID) . "' and affiliate_billing_status != 1");
}
define('SECURITY_CODE_LENGTH', '6');
require '../includes/classes/jQuery.php';
$jQuery = new jQuery();
$jQuery->loadAllExtensions();
$jQuery->loadAllPlugins();
//
//   This define('JQUERY_MENU', 'jd_menu'); ( which will be moved into the database ) has 2 values currently: jd_menu or ??//    accordion
define('JQUERY_MENU', 'jd_menu');
Beispiel #21
0
    public function FormMce($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        $role = Z_Auth::getInstance()->getUser()->getRole();
        $acl = Z_Acl::getInstance();
        $filemanager = isset($attribs['filemanager']) ? $attribs['filemanager'] : true;
        try {
            $allowFileManager = $acl->isAllowed($role, 'filemanager');
        } catch (Exception $e) {
            $allowFileManager = false;
        }
        $filemanager = $filemanager && $allowFileManager;
        $filemanagerScript = '
mode : "textareas",
file_browser_callback: function(field_name, url, type, win) {
    aFieldName = field_name, aWin = win;
    if($("#elfinder").length == 0)
    {
        $("body").append($("<div/>").attr("id", "elfinder"));
        $("#elfinder").elfinder({
            url : "/sys/elfinder/connectors/php/connector.php",
            lang: "ru",
            dialog : { width: 800, modal: true, title: "Файловый менеджер", zIndex: 400001 }, // open in dialog window
            editorCallback: function(url)
            {
        	aWin.document.forms[0].elements[aFieldName].value = url;
            },
            closeOnEditorCallback: true
        });
    }
    else
    {
	$("#elfinder").elfinder("open");
    }
},
        ';
        $toolbar = isset($attribs['toolbar']) ? $attribs['toolbar'] : $this->_mce_default_toolbar;
        $toolbar = isset($this->_mce_toolbar[$toolbar]) ? $toolbar : $this->_mce_default_toolbar;
        $script = '$("#' . $id . '").tinymce({
    		theme : "advanced",
    		language : "ru",
    		' . $this->_mce_toolbar[$toolbar] . '
			' . ($filemanager ? $filemanagerScript : '') . '
			' . (isset($attribs['content_css']) ? 'content_css : "' . $attribs['content_css'] . '",' : '') . '
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
			theme_advanced_resize_horizontal : false,
			extended_valid_elements : "iframe[name|src|framespacing|border|frameborder|scrolling|title|height|width|style],object[declare|classid|codebase|data|type|codetype|archive|standby|height|width|usemap|name|tabindex|align|border|hspace|vspace],div[id|style|class]",
			media_strict: false,
//			force_br_newlines : true,
//			force_p_newlines : false,
//        	forced_root_block : "",			
			width: "100%",
			height: "' . (isset($attribs['height']) ? $attribs['height'] : '300px') . '",
			onchange_callback: "z_mce_save",
			execcommand_callback: "z_mce_save_event",
			remove_script_host: true,
			relative_urls: false
    	});';
        jQuery::evalScript($script);
        unset($attribs['toolbar']);
        // build the element
        $xhtml = '<textarea name="' . $this->view->escape($name) . '"' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '>' . $value . '</textarea><a href="#" class="" onclick="tinymce.execCommand(\'mceToggleEditor\',false,\'' . $id . '\');">Вкл/Выкл редактор.</a>';
        return $xhtml;
    }
Beispiel #22
0
Datei: jUI.php Projekt: atk4/atk4
 /**
  * Adds JS chain to DOM onReady event
  *
  * @param jQuery_Chain|string $js
  *
  * @return $this
  */
 public function addOnReady($js)
 {
     if ($js instanceof jQuery_Chain) {
         $js = $js->getString();
     }
     if (!$this->atk4_initialised) {
         return parent::addOnReady($js);
     }
     $this->app->template->append('document_ready', '$.atk4(function(){ ' . $js . "; });\n");
     return $this;
 }
Beispiel #23
0
    public function admin_datagrid($data, $columns, $options = array())
    {
        jQuery::evalScript('$("#z-grid tbody").selectable({
				filter: "tr",
				cancel: "a",
				selected: function(event, ui)
				{
					$("#"+ui.selected.id).addClass("ui-state-highlight");
				},
				selecting: function(event, ui)
				{
					$("#"+ui.selecting.id).addClass("ui-state-highlight");
				},
				unselected: function(event, ui)
				{
					$("#"+ui.unselected.id).removeClass("ui-state-highlight");
				},
				unselecting: function(event, ui)
				{
					$("#"+ui.unselecting.id).removeClass("ui-state-highlight");
				}			
			});');
        jQuery::evalScript('$("#z-grid").tableDnD({
			onDragClass: "ui-state-highlight",
			dragHandle: "drad-handle",
			scrollAmount: "20",
			onDrop: function(table, row){
				if ($(row).hasClass("ui-selected")) $(row).addClass("ui-state-highlight");
				var urlTemplate = $(table).attr("rel");
				var reorderAr = [];
				var rows = table.tBodies[0].rows;
				for (var i=0; i<rows.length; i++) {
					reorderAr[i] = rows[i].id;
				}
				z_ajax_go(urlTemplate,{
					ids:reorderAr
				});
			}
		});');
        jQuery::evalScript('
			$("input.z-grid-filter-input").keyup(function(event) {
				if (event.keyCode == "13"){
					var url = $(this).attr("rel");
					var name = $(this).attr("name");
					var param = {};
					param[name] = $(this).attr("value");
					z_ajax_go(url,param);
				}
			});
			$("select.z-grid-filter-input").change(function(event) {
				var url = $(this).attr("rel");
				var name = $(this).attr("name");
				var param = {};
				param[name] = $(this).attr("value");
				z_ajax_go(url,param);
			});
		');
        $this->view->z_grid_data = $data;
        $this->view->z_grid_columns = $columns;
        return $this->view->render('admin/datagrid.phtml');
    }
Beispiel #24
0
 /**
  * addAction
  * add query to stack
  *
  * @param  string $name
  * @param  jQuery_Action $jQuery_Action
  * @return void
  */
 public static function addAction($name, jQuery_Action &$jQuery_Action)
 {
     jQuery::init();
     jQuery::$jQuery->response['a'][$name][] = $jQuery_Action;
 }
Beispiel #25
0
    public function formMultiimage($name = null, $value = null, $attribs = null)
    {
        $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
        $this->initSettings();
        $resid = 0;
        if (is_array($attribs) && count($attribs)) {
            foreach ($attribs as $key => $attr) {
                if (isset($this->_options[$key])) {
                    $this->_options[$key] = $attr;
                }
                if ($key == 'res') {
                    $resid = $attr;
                }
            }
        }
        //file_size_limit : "'.$this->_options['file_size_limit'].' MB",
        jQuery::evalScript('
   $(document).ready(function(){
    var swfu;    
    swfu = new SWFUpload({
            upload_url: \'/' . $module . '/z_upload/index/resid/' . $attr . '\',
            post_params: {"u_sid" : "' . session_id() . '"},
            
            file_size_limit : "1 MB",
            file_types : "*.jpg;*.jpeg;*.png;*.gif",
            file_types_description : "Изображения формата jpg, jpeg, bmp, png, gif",
            file_upload_limit : "' . $this->_options['file_upload_limit'] . '",
            file_queue_limit : "' . $this->_options['file_queue_limit'] . '",
            swfupload_loaded_handler: swfUploadLoaded,
            file_queue_error_handler : fileQueueError,
            file_queued_handler: fileQueue,
            file_dialog_complete_handler : fileDialogComplete,
            file_dialog_start_handler: fileDialogStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : uploadSuccess,
            upload_complete_handler : uploadComplete,
            upload_start_handler: uploadStart, 
            flash_color : "#DFEFFC",
            button_placeholder_id : "spanButtonPlaceholder",
            button_width: 100,
            button_height: 23,
            button_text : "<span class=\'butt\'>Загрузить</span>",
            button_text_style : ".butt {color:#2E6E9E; font-weight:bold; text-align:center; font-size: 14px;}",
            button_text_top_padding: 3,
            button_text_left_padding: 0,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
            button_cursor: SWFUpload.CURSOR.HAND,
            button_action: SWFUpload.BUTTON_ACTION.SELECT_FILES,				
            flash_url : "/sys/img/swfupload.swf",
            custom_settings : {
                upload_target : "progress",
                error_div: "upload_error"
            },
          debug: false
        });    
    });

    ');
        /*
         *movieName=SWFUpload_0
         *uploadURL=%2Fv220%2Fsimpledemo%2Fupload.php&amp;
         *useQueryString=false&amp;
         *requeueOnError=false&amp;
         *httpSuccess=&amp;
         *assumeSuccessTimeout=0&amp;
         *params=PHPSESSID%3D&amp;
         *filePostName=Filedata&amp;
         *fileTypes=*.*&amp;
         *fileTypesDescription=All%20Files&amp;
         *fileSizeLimit=100%20MB&amp;
         *fileUploadLimit=100&amp;
         *fileQueueLimit=0&amp;
         *debugEnabled=false&amp;
         *buttonImageURL=%2Fv220%2Fsimpledemo%2Fimages%2FTestImageNoText_65x29.png&amp;
         *buttonWidth=65&amp;
         *buttonHeight=29&amp;
         *buttonText=%3Cspan%20class%3D%22theFont%22%3EHello%3C%2Fspan%3E&amp;
         *buttonTextTopPadding=3&amp;
         *buttonTextLeftPadding=12&amp;
         *buttonTextStyle=.theFont%20%7B%20font-size%3A%2016%3B%20%7D&amp;
         *buttonAction=-110&amp;
         *buttonDisabled=false&amp;
         *buttonCursor=-1">
         */
        $xhtml = '<div class="mainblock"> 
                   <div id="select_button" class="select_button">
                     <span id="spanButtonPlaceholder"></span>
                   </div>
                   <a href="#" onclick="clearList(); return false;" class="z-button z-button-top z-delete ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
                    <span class="ui-button-text">Очистить</span>
                   </a>
                   <div class="clear">&nbsp;</div>
                    <div id="progress"></div>
                   <ul id="upload_error"></ul>
                   
                  </div> 
        ';
        return $xhtml;
    }
Beispiel #26
0
    public function FormMultielement($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        $elements = $attribs['multioptions'];
        $firstkey = array_keys($elements);
        $firstkey = $firstkey[0];
        unset($attribs['multioptions']);
        $header = '';
        foreach ($elements as $el) {
            $header .= '<th colspan="2">' . $el['label'] . '</th>';
        }
        $header = '<table><tr>' . $header . '</tr>';
        $footer = '</table>';
        $count = 0;
        if (isset($value[$firstkey])) {
            $count = count($value[$firstkey]);
        }
        $element = '';
        $empty = true;
        if ($count) {
            $empty = false;
            $addedcount = 0;
            for ($i = 0; $i < $count; $i++) {
                $setted = false;
                foreach ($elements as $key => $el) {
                    if (isset($value[$key][$i]) && trim($value[$key][$i])) {
                        $setted = true;
                    }
                }
                if ($setted) {
                    $addedcount++;
                    $subel = '';
                    foreach ($elements as $key => $val) {
                        if ($val['_type'] == 'text') {
                            $val['id'] = $name . '-' . $i . '-' . $key;
                            $subel .= '<td>' . $this->view->formText($name . '[' . $key . '][]', trim($value[$key][$i]), $val) . '</td>' . "\n";
                            $subel .= '<td><span id="delete">Удалить</span></td>' . "\n";
                        } elseif ($val['_type'] == 'textarea') {
                            $val['id'] = $name . '-' . $i . '-' . $key;
                            $subel .= '<td>' . $this->view->formTextarea($name . '[' . $key . '][]', trim($value[$key][$i]), $val) . '</td>' . "\n";
                            $subel .= '<td><span id="delete">Удалить</span></td>' . "\n";
                        }
                    }
                    $subel = "<tr>\n" . $subel . "</tr>\n";
                    $element .= $subel;
                }
            }
            if (!$addedcount) {
                $empty = true;
            }
        }
        if ($empty) {
            foreach ($elements as $key => $val) {
                if ($val['_type'] == 'text') {
                    $val['id'] = $name . '-0-' . $key;
                    $element .= '<td>' . $this->view->formText($name . '[' . $key . '][]', '', $val) . '</td>' . "\n";
                    $element .= '<td><a href="#" id="delete">Удалить</a></td>' . "\n";
                } elseif ($val['_type'] == 'textarea') {
                    $val['id'] = $name . '-0-' . $key;
                    $element .= '<td>' . $this->view->formTextarea($name . '[' . $key . '][]', '', $val) . '</td>' . "\n";
                    $element .= '<td><span id="delete">Удалить</span></td>' . "\n";
                }
            }
            $element = "<tr>\n" . $element . "</tr>\n";
        }
        $js = '';
        $js .= '$(function() {
        	$("a#add").click(function(){
    			var str = $(this).parent().parent().find("table tr").get(1);
	    		$(this).parent().parent().find("table").append("<tr>"+$(str).html()+"</tr>");
    			var laststr = $(this).parent().parent().find("table tr").get(-1);
    			$(laststr).find("input").attr("value","")
	    		return false;
        	});
        	$("a#delete").live("click",function(){
        	//alert ($(this).parent().parent().parent().parent().parent().get(0).tagName);
       		if ($(this).parent().parent().parent().parent().parent().find("table tr").length>2){
        		$(this).parent().parent().remove(); 
       		}
      		 return false; 
   		 });	
    	});';
        jQuery::evalScript($js);
        $style = '';
        if (isset($attribs['style']) && trim($attribs['style'])) {
            $style = $attribs['style'];
        }
        $xhtml = $style . $header . $element . $footer . '<p class="add_string"><a href="#" id="add">Добавить строку</a></p>';
        return $xhtml;
    }
Beispiel #27
0
    public function deleteAction()
    {
        $this->setViewPathes();
        $this->disableRenderView();
        //отключение вывода
        //проверка на возможность удаления
        if (!$this->z_can_delete) {
            Z_FlashMessenger::addMessage('Удаление запрещено!');
            return;
        }
        //получение списка удаляемых элементов
        if (!$this->_getParam('id')) {
            $ids = $this->_getParam('ids');
        } else {
            $ids = array($this->_getParam('id'));
        }
        //если есть подтверждение на удаление или оно не требуется, то удаляем
        if ($this->z_delete_confirm && $this->_getParam('confirmed') || !$this->z_delete_confirm) {
            //получение списка полей, с файлами на удаление
            $modelForm = new Z_Model_Resourceforms();
            $formFileitems = $modelForm->fetchAll(array('resourceid=?' => $this->getResourceInfo()->id, 'is_file=?' => 1));
            $storage = new Z_File_Storage();
            $deletedItemsCount = 0;
            foreach ($ids as $id) {
                $item = $this->z_model->fetchRow(array('id=?' => $id));
                $itemArray = $item->toArray();
                if (!$this->deleteCheck($itemArray)) {
                    Z_FlashMessenger::addMessage('Удаление записи "' . $itemArray[$this->z_default_field] . '" Запрещено!');
                    continue;
                }
                //проверка на наличие подразделов в каталоге
                $haveSubcat = false;
                if ($this->z_datatype == 'catalog') {
                    $subCatCount = $this->z_model->select(true)->reset('columns')->columns('count(*)')->where('parentid=?', $item->id)->query()->fetchColumn();
                    if ($subCatCount > 0) {
                        $haveSubcat = true;
                        Z_FlashMessenger::addMessage('Раздел "' . $itemArray[$this->z_default_field] . '" имеет подразделы');
                    }
                }
                //проверка на наличие дочерних элементов
                $haveChild = false;
                if ($this->z_child_resources) {
                    foreach ($this->z_child_resources as $resource) {
                        $childModel = new $resource['model']();
                        $childItem = $childModel->fetchRow(array($resource['parent_field'] . '=?' => $item->id));
                        if ($childItem) {
                            $haveChild = true;
                            Z_FlashMessenger::addMessage('"' . $itemArray[$this->z_default_field] . '" имеет подчиненные "' . $resource['title'] . '"');
                        }
                    }
                }
                //проверка на возможность удаления элемента
                if ((!isset($itemArray['z_can_delete']) || isset($itemArray['z_can_delete']) && $itemArray['z_can_delete']) && (!$haveChild || $this->z_delete_on_have_child) && !$haveSubcat) {
                    //удаление связей многие ко многим
                    if (!empty($this->z_refers)) {
                        foreach ($this->z_refers as $referName => $refer) {
                            $referModel = new $refer['model']();
                            $referModel->delete(array($refer['field1'] . '=?' => $item->id));
                        }
                    }
                    $delData = $item->toArray();
                    $item->delete();
                    if (count($formFileitems)) {
                        foreach ($formFileitems as $formFileitem) {
                            $storage->removeFileDir($delData[$formFileitem->field]);
                        }
                    }
                    //ech('1');
                    $this->deleteSuccess($delData);
                    $this->deleteFromIndex($delData['id']);
                    $deletedItemsCount++;
                } else {
                    Z_FlashMessenger::addMessage('Удаление записи "' . $itemArray[$this->z_default_field] . '" Запрещено!');
                }
            }
            if ($deletedItemsCount > 0) {
                $this->ajaxGo($this->view->url(array('action' => $this->z_defaultAction, 'id' => NULL, 'confirmed' => NULL)));
            }
        } elseif ($this->z_delete_confirm) {
            //требуем подтверждения на удаление
            jQuery::evalScript('
	    		if (confirm("Удалить?"))
	    		{
	    			z_ajax_go("' . $this->view->url() . '",{confirmed:1,ids:[' . implode(',', $ids) . ']});
	    		}
	    	');
        }
    }