public function actionFinishAuth() { if ($this->validatePermission('smartslider_config')) { $generatorModel = new N2SmartsliderGeneratorModel(); $group = N2Request::getVar('group'); $type = N2Request::getVar('type'); $info = $generatorModel->getGeneratorInfo($group, $type); $configuration = $info->getConfiguration(); $result = $configuration->finishAuth(); if ($result === true) { N2Message::success(n2_('Authentication successful.')); echo '<script>window.opener.location.reload();self.close();</script>'; } else { if ($result instanceof Exception) { $message = $result->getMessage(); } else { $message = 'Something wrong with the credentials'; } echo '<script>window.opener.nextend.notificationCenter.error("' . htmlspecialchars($message) . '");self.close();</script>'; } n2_exit(true); } }
<?php $this->widget->init('topbar', array("menu" => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview'))), "actions" => array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => N2Request::getInt('sliderid')))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc'), n2_('Cancel')), N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save'))))); ?> <form id="smartslider-form" action="" method="post"> <?php $params = new N2Data($generator['params'], true); $group = $generator['group']; $type = $generator['type']; $generatorModel = new N2SmartsliderGeneratorModel(); $info = $generatorModel->getGeneratorInfo($group, $type); $this->widget->init('heading', array('title' => $info->group . ' - ' . $info->title)); $xml = $generatorModel->generatorSpecificForm($group, $type, $params->toArray()); $slideParams = new N2Data($slide['params'], true); $params->set('record-slides', $slideParams->get('record-slides', 1)); $generatorModel->generatorEditForm($params->toArray()); ?> <input name="save" value="1" type="hidden"/> </form> <style> #generatorrecords { overflow: auto; width: 100%; } #generatorrecords table div { max-width: 200px; max-height: 200px; overflow: auto; }
public function actionGetData() { $this->validateToken(); $this->validatePermission('smartslider_edit'); $group = N2Request::getVar('group'); $type = N2Request::getVar('type'); $generatorModel = new N2SmartsliderGeneratorModel(); $info = $generatorModel->getGeneratorInfo($group, $type); $configuration = $info->getConfiguration(); try { $this->response->respond(call_user_func(array($configuration, N2Request::getCmd('method')))); } catch (Exception $e) { N2Message::error($e->getMessage()); $this->response->error(); } }