Ejemplo n.º 1
0
    /**
     * save service settings and return data  to browser as ajax response text.
     *
     */
    function saveIFrame()
    {
        global $jauc;
        $post = JRequest::get('request', JREQUEST_ALLOWHTML);
        $number = $post['number'];
        $errors = array();
        $row = $this->save($errors);
        $helper = new JAFormHelpers();
        if (isset($row->id)) {
            $result = true;
            if ($row->ws_mode == 'remote') {
                $model = $this->getModel('services');
                $row2 = $model->getRow2($row->id);
                $service = new stdClass();
                $service->ws_uri = $row2->ws_uri;
                $service->ws_user = $row2->ws_user;
                $service->ws_pass = $row2->ws_pass;
                //authenticate service account
                if ($jauc->authUser($service) == 0) {
                    $result = false;
                    if (!empty($service->ws_user)) {
                        $objects[] = $helper->parseProperty("html", "#system-message-container", $helper->message(1, JText::_("WRONG_USERNAME_AND_PASSWORD_LOGIN_FAILED_PLEASE_TRY_AGAIN")));
                    } else {
                        $objects[] = $helper->parseProperty("html", "#system-message-container", $helper->message(0, JText::_("YOU_ARE_LOGGED_IN_AS_ANONYMOUS_USER")));
                    }
                }
            }
            if ($result) {
                $id = $row->id;
                $model = $this->getModel('services');
                $listItems = $model->getList(" AND t.id = '{$id}' ", "t.ws_name ASC", 0, 1);
                $item = $listItems[0];
                /*$reload = 0;
                	 if($post['id']=='0'){
                		$reload = 1;
                		}*/
                $reload = 1;
                $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, $reload);
                $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY")));
                if (!$reload) {
                    $objects[] = $helper->parseProperty("html", "#ws_name" . $item->id, $item->ws_name);
                    $objects[] = $helper->parseProperty("html", "#ws_mode" . $item->id, $item->ws_mode);
                    $objects[] = $helper->parseProperty("html", "#ws_uri" . $item->id, $item->ws_uri);
                    $objects[] = $helper->parseProperty("html", "#ws_user" . $item->id, $item->ws_user);
                    $objects[] = $helper->parseProperty("html", "#ws_pass" . $item->id, $item->ws_pass);
                    $objects[] = $helper->parsePropertyPublish("html", "#default" . $item->id, $item->ws_default, $number);
                }
            }
        } else {
            $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors));
        }
        $data = "({'data':[";
        $data .= $helper->parse_JSON($objects);
        $data .= "]})";
        echo '
		<script type="text/javascript">
			jaFormHideIFrame();
			parseData_admin(' . $data . ');
		</script>
		';
        /*echo $data;
        	 exit ();*/
    }
Ejemplo n.º 2
0
 /**
  * update settings of Extension:
  * - Select a service where JAEM will use to check and get data
  *
  */
 function configExtensions()
 {
     $model =& $this->getModel('default');
     $data = JRequest::getVar('params', array());
     $result = $model->storeExtensionSettings($data);
     $pro = $model->_getProduct();
     //
     $helper = new JAFormHelpers();
     if ($result !== false) {
         $reload = 0;
         $number = 0;
         $objects[] = $helper->parseProperty("reload", "#reload", $reload);
         if (!$reload) {
             $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_('YOUR_SETTING_IS_SUCCESSFULLY_SAVED', true)));
             $serviceName = JRequest::getVar("service-name-" . $data[$pro->extId]);
             $objects[] = $helper->parseProperty("html", "#config" . $pro->extId, $serviceName, $number);
         }
     } else {
         $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, JText::_('YOUR_SETTING_IS_UNSUCCESSFULLY_SAVED', true)));
     }
     $data = "({'data':[";
     $data .= $helper->parse_JSON($objects);
     $data .= "]})";
     echo $data;
     exit;
 }
Ejemplo n.º 3
0
 function configExtensions()
 {
     $model =& $this->getModel('default');
     $data = JRequest::getVar('params', array());
     $result = $model->storeComponentParams($data);
     $pro = $model->_getProduct();
     //
     $helper = new JAFormHelpers();
     if ($result !== false) {
         $reload = 0;
         $number = 0;
         $objects[] = $helper->parseProperty("reload", "#reload", $reload);
         if (!$reload) {
             $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_('Your setting is successfully saved', true)));
             $serviceName = JRequest::getVar("service-name-" . $data[$pro->extId . "-service"]);
             $objects[] = $helper->parseProperty("html", "#config" . $pro->extId, $serviceName, $number);
         }
     } else {
         $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, JText::_('Your setting is unsuccessfully saved', true)));
     }
     $data = "({'data':[";
     $data .= $helper->parse_JSON($objects);
     $data .= "]})";
     echo $data;
     exit;
 }