本文整理汇总了PHP中js::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP js::alert方法的具体用法?PHP js::alert怎么用?PHP js::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类js
的用法示例。
在下文中一共展示了js::alert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMenu
/**
* Set menu.
*
* @param array $projects
* @param int $projectID
* @param string $extra
* @access public
* @return void
*/
public function setMenu($projects, $projectID, $extra = '')
{
/* Check the privilege. */
$project = $this->getById($projectID);
/* Unset story, bug, build and testtask if type is ops. */
if ($project and $project->type == 'ops') {
unset($this->lang->project->menu->story);
unset($this->lang->project->menu->bug);
unset($this->lang->project->menu->build);
unset($this->lang->project->menu->testtask);
}
if ($projects and !isset($projects[$projectID]) and !$this->checkPriv($project)) {
echo js::alert($this->lang->project->accessDenied);
die(js::locate('back'));
}
$moduleName = $this->app->getModuleName();
$methodName = $this->app->getMethodName();
if ($this->cookie->projectMode == 'noclosed' and $project->status == 'done') {
setcookie('projectMode', 'all');
$this->cookie->projectMode = 'all';
}
$selectHtml = $this->select($projects, $projectID, $moduleName, $methodName, $extra);
foreach ($this->lang->project->menu as $key => $menu) {
$replace = $key == 'list' ? $selectHtml : $projectID;
common::setMenuVars($this->lang->project->menu, $key, $replace);
}
}
示例2: changePassword
/**
* Change password , if use default password ,go to change
*
* @access public
* @return void
*/
public function changePassword()
{
if ($this->app->user->account == 'guest') {
die(js::alert('guest') . js::locate('back'));
}
if (!empty($_POST)) {
$password1 = $_POST['password1'];
if (!$password1) {
die(js::error('Please input password!'));
}
$isDefult = $this->dao->select('password')->from(TABLE_DEFAULTPASSWORD)->Where('password')->eq($this->post->password1)->fetchAll();
//如果用户使用默认密码则跳到修改密码界面
if ($isDefult) {
die(js::error('Password can not in default list!') . js::locate($this->createLink('my', 'changePassword', 'type=forbidden'), 'parent'));
}
$this->user->updatePassword($this->app->user->id);
if (dao::isError()) {
die(js::error(dao::getError()));
}
die(js::locate($this->createLink('my', 'profile'), 'parent'));
}
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->changePassword;
$this->view->position[] = $this->lang->my->changePassword;
$this->view->user = $this->user->getById($this->app->user->id);
$this->display();
}
示例3: test
public function test()
{
$pubuConfig = $this->pubu->getConfig();
$this->view->position[] = html::a(inlink('index'), $this->lang->pubu->common);
$this->view->position[] = '测试';
$ping = $this->pubu->sendNotification($pubuConfig->webhook, array('type' => 'ping', "data" => array("hello" => "zentao")));
$this->view->ping = $ping;
if (is_string($ping)) {
echo js::alert($ping);
die(js::locate('back'));
}
$this->display();
}
示例4: delete
public function delete($type, $field)
{
$this->app->loadClass('infoextdao', $static = true);
$table = $this->config->custom->typeToTable[$type];
$sql_query = 'ALTER TABLE ' . infoextdao::backquote($table) . ' ' . "DROP COLUMN " . infoextdao::backquote($this->config->customFieldPrefix . $field);
try {
$result = $this->app->dbh->query($sql_query);
} catch (Exception $e) {
//echo 'Message: ' .$e->getMessage();
echo js::alert(addslashes($sql_query));
echo js::alert($this->lang->custom->alterTableFailed);
return false;
}
}
示例5: setConfig
/**
* Set configs of converter.
*
* This is the extrance of every system. It will call the set function of corresponding module.
*
* @access public
* @return void
*/
public function setConfig()
{
if (!$this->post->source) {
echo js::alert($this->lang->convert->mustSelectSource);
die(js::locate('back'));
}
list($sourceName, $version) = explode('_', $this->post->source);
$setFunc = "set{$sourceName}";
$this->view->title = $this->lang->convert->setting;
$this->view->source = $sourceName;
$this->view->version = $version;
$this->view->setting = $this->fetch('convert', $setFunc, "version={$version}");
$this->display();
}
示例6: set
/**
* Custom
*
* @param string $module
* @param string $field
* @access public
* @return void
*/
public function set($module = 'story', $field = 'priList')
{
if ($module == 'user' and $field == 'priList') {
$field = 'roleList';
}
$currentLang = $this->app->getClientLang();
$this->app->loadLang($module);
$this->app->loadConfig('story');
$fieldList = $this->lang->{$module}->{$field};
if ($module == 'bug' and $field == 'typeList') {
unset($fieldList['designchange']);
unset($fieldList['newfeature']);
unset($fieldList['trackthings']);
}
if (!empty($_POST)) {
if ($module == 'story' && $field == 'review') {
$this->loadModel('setting')->setItem('system.story.needReview', fixer::input('post')->get()->needReview);
} else {
$lang = $_POST['lang'];
$this->custom->deleteItems("lang={$lang}&module={$module}§ion={$field}");
foreach ($_POST['keys'] as $index => $key) {
$value = $_POST['values'][$index];
if (!$value or !$key) {
continue;
}
$system = $_POST['systems'][$index];
/* the length of role is 20, check it when save. */
if ($module == 'user' and $field == 'roleList' and strlen($key) > 20) {
die(js::alert($this->lang->custom->notice->userRole));
}
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
}
}
if (dao::isError()) {
die(js::error(dao::getError()));
}
die(js::reload('parent'));
}
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->{$module}->common;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->lang->{$module}->common;
$this->view->needReview = $this->config->story->needReview;
$this->view->fieldList = $fieldList;
$this->view->dbFields = $this->custom->getItems("lang={$currentLang},all&module={$module}§ion={$field}");
$this->view->field = $field;
$this->view->module = $module;
$this->view->currentLang = $currentLang;
$this->view->canAdd = strpos($this->config->custom->canAdd[$module], $field) !== false;
$this->display();
}
示例7: setMenu
/**
* Set menu.
*
* @param array $projects
* @param int $projectID
* @access public
* @return void
*/
public function setMenu($projects, $projectID)
{
/* Check the privilege. */
if ($projects and !isset($projects[$projectID]) and !$this->checkPriv($this->getById($projectID))) {
echo js::alert($this->lang->project->accessDenied);
die(js::locate('back'));
}
$moduleName = $this->app->getModuleName();
$methodName = $this->app->getMethodName();
$selectHtml = $this->select($projects, $projectID, $moduleName, $methodName);
foreach ($this->lang->project->menu as $key => $menu) {
$replace = $key == 'list' ? $selectHtml : $projectID;
common::setMenuVars($this->lang->project->menu, $key, $replace);
}
}
示例8: bind
/**
* Bind zentao.
*
* @access public
* @return void
*/
public function bind()
{
if ($_POST) {
$response = $this->admin->bindByAPI();
if ($response == 'success') {
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
echo js::alert($this->lang->admin->bind->success);
die(js::locate(inlink('index'), 'parent'));
}
die($response);
}
$this->view->title = $this->lang->admin->bind->caption;
$this->view->position[] = $this->lang->admin->bind->caption;
$this->view->sn = $this->config->global->sn;
$this->display();
}
示例9: create
/**
* Create a task.
*
* @param int $projectID
* @param int $storyID
* @access public
* @return void
*/
public function create($projectID = 0, $storyID = 0, $moduleID = 0)
{
$project = $this->project->getById($projectID);
$taskLink = $this->createLink('project', 'browse', "projectID={$projectID}&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID={$projectID}");
$this->view->users = $this->loadModel('user')->getPairs('noletter');
/* Set menu. */
$this->project->setMenu($this->project->getPairs(), $project->id);
if (!empty($_POST)) {
$tasksID = $this->task->create($projectID);
if (dao::isError()) {
die(js::error(dao::getError()));
}
/* Create actions. */
$this->loadModel('action');
foreach ($tasksID as $taskID) {
$actionID = $this->action->create('task', $taskID, 'Opened', '');
$this->sendmail($taskID, $actionID);
}
/* Locate the browser. */
if ($this->post->after == 'continueAdding') {
echo js::alert($this->lang->task->successSaved . $this->lang->task->afterChoices['continueAdding']);
die(js::locate($this->createLink('task', 'create', "projectID={$projectID}&storyID={$this->post->story}"), 'parent'));
} elseif ($this->post->after == 'toTastList') {
die(js::locate($taskLink, 'parent'));
} elseif ($this->post->after == 'toStoryList') {
die(js::locate($storyLink, 'parent'));
}
}
$stories = $this->story->getProjectStoryPairs($projectID);
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$moduleOptionMenu = $this->tree->getOptionMenu($projectID, $viewType = 'task');
$header['title'] = $project->name . $this->lang->colon . $this->lang->task->create;
$position[] = html::a($taskLink, $project->name);
$position[] = $this->lang->task->create;
$this->view->header = $header;
$this->view->position = $position;
$this->view->project = $project;
$this->view->stories = $stories;
$this->view->storyID = $storyID;
$this->view->members = $members;
$this->view->moduleID = $moduleID;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->display();
}
示例10: setMenu
/**
* Set menu.
*
* @param array $products
* @param int $productID
* @param string $extra
* @access public
* @return void
*/
public function setMenu($products, $productID, $extra = '')
{
/* Has access privilege?. */
if ($products and !isset($products[$productID]) and !$this->checkPriv($this->getById($productID))) {
echo js::alert($this->lang->product->accessDenied);
die(js::locate('back'));
}
$currentModule = $this->app->getModuleName();
$currentMethod = $this->app->getMethodName();
/* init currentModule and currentMethod for report and story. */
if ($currentModule == 'story' and $currentMethod != 'create' and $currentMethod != 'batchcreate') {
$currentModule = 'product';
}
if ($currentMethod == 'report') {
$currentMethod = 'browse';
}
$selectHtml = $this->select($products, $productID, $currentModule, $currentMethod, $extra);
foreach ($this->lang->product->menu as $key => $menu) {
$replace = $key == 'list' ? $selectHtml : $productID;
common::setMenuVars($this->lang->product->menu, $key, $replace);
}
}
示例11: bind
/**
* Bind user.
*
* @access public
* @return object
*/
public function bind()
{
$data = fixer::input('post')->get();
if ($data->bindType == 'bind') {
if (empty($data->bindPassword)) {
die(js::alert($this->lang->sso->bindNoPassword));
}
$password = md5($data->bindPassword);
$user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->bindUser)->andWhere('password')->eq($password)->andWhere('deleted')->eq('0')->fetch();
if (empty($user)) {
die(js::alert($this->lang->sso->bindNoUser));
}
$user->ranzhi = $this->session->ssoData->account;
$this->dao->update(TABLE_USER)->set('ranzhi')->eq($user->ranzhi)->where('id')->eq($user->id)->exec();
} elseif ($data->bindType == 'add') {
if (!$this->loadModel('user')->checkPassword()) {
return;
}
$user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->account)->fetch();
if ($user) {
die(js::alert($this->lang->sso->bindHasAccount));
}
if (isset($this->config->safe->mode) and $this->user->computePasswordStrength($data->password1) < $this->config->safe->mode) {
dao::$errors['password1'][] = $this->lang->user->weakPassword;
return false;
}
$user = new stdclass();
$user->account = $data->account;
$user->password = md5($data->password1);
$user->realname = $data->realname;
$user->gender = isset($data->gender) ? $data->gender : '';
$user->email = $data->email;
$user->ranzhi = $this->session->ssoData->account;
$this->dao->insert(TABLE_USER)->data($user)->autoCheck()->batchCheck($this->config->user->create->requiredFields, 'notempty')->check('account', 'unique')->check('account', 'account')->checkIF($user->email != false, 'email', 'email')->exec();
}
return $user;
}
示例12: batchCreate
/**
* Batch create
*
* @param int $productID
* @access public
* @return void
*/
public function batchCreate($productID, $branch = 0)
{
$this->loadModel('action');
$now = helper::now();
$actions = array();
$data = fixer::input('post')->get();
$batchNum = count(reset($data));
$result = $this->loadModel('common')->removeDuplicate('bug', $data, "product={$productID}&branch={$branch}");
$data = $result['data'];
for ($i = 0; $i < $batchNum; $i++) {
if (!empty($data->title[$i]) and empty($data->openedBuilds[$i])) {
die(js::alert(sprintf($this->lang->error->notempty, $this->lang->bug->openedBuild)));
}
}
/* Get pairs(moduleID => moduleOwner) for bug. */
$stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0, $branch));
$moduleOwners = array();
while ($module = $stmt->fetch()) {
$moduleOwners[$module->id] = $module->owner;
}
$module = 0;
$project = 0;
$type = '';
$os = '';
$browser = '';
for ($i = 0; $i < $batchNum; $i++) {
if ($data->modules[$i] != 'ditto') {
$module = (int) $data->modules[$i];
}
if ($data->projects[$i] != 'ditto') {
$project = (int) $data->projects[$i];
}
if ($data->types[$i] != 'ditto') {
$type = $data->types[$i];
}
if ($data->oses[$i] != 'ditto') {
$os = $data->oses[$i];
}
if ($data->browsers[$i] != 'ditto') {
$browser = $data->browsers[$i];
}
$data->modules[$i] = (int) $module;
$data->projects[$i] = (int) $project;
$data->types[$i] = $type;
$data->oses[$i] = $os;
$data->browsers[$i] = $browser;
}
if (isset($data->uploadImage)) {
$this->loadModel('file');
}
for ($i = 0; $i < $batchNum; $i++) {
if (empty($data->title[$i])) {
continue;
}
$bug = new stdClass();
$bug->openedBy = $this->app->user->account;
$bug->openedDate = $now;
$bug->product = $productID;
$bug->branch = $branch;
$bug->module = $data->modules[$i];
$bug->project = $data->projects[$i];
$bug->openedBuild = implode(',', $data->openedBuilds[$i]);
$bug->title = $data->title[$i];
$bug->steps = nl2br($data->stepses[$i]);
$bug->type = $data->types[$i];
$bug->severity = $data->severities[$i];
$bug->os = $data->oses[$i];
$bug->browser = $data->browsers[$i];
if (!empty($data->uploadImage[$i])) {
$fileName = htmlspecialchars_decode($data->uploadImage[$i]);
$realPath = $this->session->bugImagesFile . $fileName;
$file = array();
$file['extension'] = $this->file->getExtension($fileName);
$file['pathname'] = $this->file->setPathName($i, $file['extension']);
$file['title'] = str_replace(".{$file['extension']}", '', $fileName);
$file['size'] = filesize($realPath);
if (rename($realPath, $this->file->savePath . $file['pathname'])) {
if (in_array($file['extension'], $this->config->file->imageExtensions)) {
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = $now;
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$url = $this->file->webPath . $file['pathname'];
$bug->steps .= '<img src="' . $url . '" alt="" />';
unset($file);
}
} else {
unset($file);
}
}
if (!empty($moduleOwners[$bug->module])) {
$bug->assignedTo = $moduleOwners[$bug->module];
$bug->assignedDate = $now;
}
//.........这里部分代码省略.........
示例13: test
/**
* Send test email.
*
* @access public
* @return void
*/
public function test()
{
if (!$this->config->mail->turnon) {
die(js::alert($this->lang->mail->needConfigure) . js::locate('back'));
}
if ($_POST) {
$this->mail->send($this->post->to, $this->lang->mail->subject, $this->lang->mail->content, "", true);
if ($this->mail->isError()) {
$this->view->error = $this->mail->getError();
die($this->display());
}
die(js::alert($this->lang->mail->successSended) . js::locate(inlink('test')));
}
$this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->test;
$this->view->position[] = html::a(inlink('index'), $this->lang->mail->common);
$this->view->position[] = $this->lang->mail->test;
$this->view->users = $this->dao->select('account, CONCAT(realname, " ", email) AS email')->from(TABLE_USER)->where('email')->ne('')->orderBy('account')->fetchPairs();
$this->display();
}
示例14: showImport
/**
* Show import data
*
* @param int $productID
* @access public
* @return void
*/
public function showImport($productID)
{
if ($_POST) {
$this->testcase->createFromImport($productID);
die(js::locate(inlink('browse', "productID={$productID}"), 'parent'));
}
$this->testcase->setMenu($this->products, $productID);
$file = $this->session->importFile;
$caseLang = $this->lang->testcase;
$caseConfig = $this->config->testcase;
$fields = explode(',', $caseConfig->exportFields);
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case');
$stories = $this->loadModel('story')->getProductStoryPairs($productID);
foreach ($fields as $key => $fieldName) {
$fieldName = trim($fieldName);
$fields[$fieldName] = isset($caseLang->{$fieldName}) ? $caseLang->{$fieldName} : $fieldName;
unset($fields[$key]);
}
$rows = $this->loadModel('file')->parseCSV($file);
$header = $rows[0];
unset($rows[0]);
foreach ($header as $title) {
$field = array_search($title, $fields);
if (!$field) {
continue;
}
$columnKey[] = $field;
}
if (empty($columnKey)) {
echo js::alert($this->lang->testcase->errorEncode);
die(js::locate(inlink('browse', "productID={$productID}")));
}
$endField = $field;
$caseData = array();
$stepData = array();
foreach ($rows as $row => $data) {
$case = new stdclass();
foreach ($columnKey as $key => $field) {
if (!isset($data[$key])) {
continue;
}
$cellValue = $data[$key];
if ($field == 'story') {
$case->{$field} = 0;
if (strrpos($cellValue, '(#') !== false) {
$id = trim(substr($cellValue, strrpos($cellValue, '(#') + 2), ')');
$case->{$field} = $id;
}
} elseif ($field == 'module') {
$case->{$field} = 0;
if (strrpos($cellValue, '(#') !== false) {
$id = trim(substr($cellValue, strrpos($cellValue, '(#') + 2), ')');
$case->{$field} = $id;
}
} elseif (in_array($field, $caseConfig->export->listFields)) {
if ($field == 'stage') {
$stages = explode("\n", $cellValue);
foreach ($stages as $stage) {
$case->stage[] = array_search($stage, $caseLang->{$field . 'List'});
}
$case->stage = join(',', $case->stage);
} else {
$case->{$field} = array_search($cellValue, $caseLang->{$field . 'List'});
}
} elseif ($field != 'stepDesc' and $field != 'stepExpect') {
$case->{$field} = $cellValue;
} else {
$steps = explode("\n", $cellValue);
$stepKey = str_replace('step', '', strtolower($field));
$caseStep = array();
foreach ($steps as $step) {
$step = trim($step);
if (empty($step)) {
continue;
}
if (preg_match('/^([0-9]+)([.、]{1})/U', $step, $out)) {
$num = $out[1];
$sign = $out[2];
$signbit = $sign == '.' ? 1 : 3;
$step = trim(substr($step, strpos($step, $sign) + $signbit));
if (!empty($step)) {
$caseStep[$num] = $step;
}
} elseif (isset($num)) {
$caseStep[$num] .= "\n" . $step;
} else {
if ($field == 'stepDesc') {
$num = 1;
$caseStep[$num] = $step;
}
if ($field == 'stepExpect' and isset($stepData[$row]['desc'])) {
end($stepData[$row]['desc']);
$num = key($stepData[$row]['desc']);
//.........这里部分代码省略.........
示例15: view
/**
* View a doc.
*
* @param int $docID
* @access public
* @return void
*/
public function view($docID)
{
/* Get doc. */
$doc = $this->doc->getById($docID, true);
if (!$doc) {
die(js::error($this->lang->notFound) . js::locate('back'));
}
/* Check priv when lib is product or project. */
$systemLib = ($doc->lib == 'project' or $doc->lib == 'product') ? $doc->lib : '';
if ($systemLib and $doc->{$systemLib} and !$this->{$systemLib}->checkPriv($this->{$systemLib}->getById($doc->{$systemLib}))) {
echo js::alert($this->lang->error->accessDenied);
die(js::locate('back'));
}
/* Get library. */
$lib = $doc->libName;
if ($doc->lib == 'product') {
$lib = $doc->productName;
}
if ($doc->lib == 'project') {
$lib = $doc->productName . $this->lang->arrow . $doc->projectName;
}
/* Set menu. */
$this->doc->setMenu($this->libs, $doc->lib);
$this->view->title = "DOC #{$doc->id} {$doc->title} - " . $this->libs[$doc->lib];
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID={$doc->lib}"), $this->libs[$doc->lib]);
$this->view->position[] = $this->lang->doc->view;
$this->view->doc = $doc;
$this->view->lib = $lib;
$this->view->actions = $this->loadModel('action')->getList('doc', $docID);
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID);
$this->view->keTableCSS = $this->doc->extractKETableCSS($doc->content);
$this->display();
}