summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authordolphin <dolphin@lindenlab.com>2014-05-13 16:25:52 -0700
committerdolphin <dolphin@lindenlab.com>2014-05-13 16:25:52 -0700
commit169bf48f1068b0996f38ef03a9a97cd6c0fa07e0 (patch)
tree6b77e79d85f62f6bc9c2d33f3059d0b114a62e54 /indra
parent6766ef06d44b1991bd6ef3f699354f98651679b4 (diff)
ACME-1450: Added paging to the experience picker and upped the search size to
30 results per page.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelexperiencepicker.cpp45
-rw-r--r--indra/newview/llpanelexperiencepicker.h2
-rw-r--r--indra/newview/skins/default/xui/en/panel_experience_search.xml35
3 files changed, 62 insertions, 20 deletions
diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp
index eb0c7c65ab..19778cb200 100644
--- a/indra/newview/llpanelexperiencepicker.cpp
+++ b/indra/newview/llpanelexperiencepicker.cpp
@@ -46,6 +46,8 @@
#define BTN_OK "ok_btn"
#define BTN_CANCEL "cancel_btn"
#define BTN_PROFILE "profile_btn"
+#define BTN_LEFT "left_btn"
+#define BTN_RIGHT "right_btn"
#define TEXT_EDIT "edit"
#define TEXT_MATURITY "maturity"
#define LIST_RESULTS "search_results"
@@ -65,11 +67,10 @@ public:
void completed(U32 status, const std::string& reason, const LLSD& content)
{
+ if(mParent.isDead())
+ return;
if (isGoodStatus(status))
{
- if(mParent.isDead())
- return;
-
LLPanelExperiencePicker* panel =mParent.get();
if (panel)
{
@@ -78,6 +79,11 @@ public:
}
else
{
+ LLPanelExperiencePicker* panel =mParent.get();
+ if (panel)
+ {
+ panel->processResponse(mQueryID, LLSD());
+ }
LL_WARNS() << "experience picker failed [status:" << status << "]: " << content << LL_ENDL;
}
@@ -118,6 +124,9 @@ BOOL LLPanelExperiencePicker::postBuild()
getChild<LLComboBox>(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this));
getChild<LLUICtrl>(TEXT_EDIT)->setFocus(TRUE);
+ childSetAction(BTN_LEFT, boost::bind(&LLPanelExperiencePicker::onPage, this, -1));
+ childSetAction(BTN_RIGHT, boost::bind(&LLPanelExperiencePicker::onPage, this, 1));
+
LLPanel* search_panel = getChild<LLPanel>(PANEL_SEARCH);
if (search_panel)
{
@@ -134,6 +143,7 @@ void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* u
void LLPanelExperiencePicker::onBtnFind()
{
+ mCurrentPage=1;
find();
}
@@ -150,24 +160,24 @@ void LLPanelExperiencePicker::find()
{
std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
mQueryID.generate();
- std::string url;
- url.reserve(128+text.size());
+ std::ostringstream url;
LLViewerRegion* region = gAgent.getRegion();
- url = region->getCapability("FindExperienceByName");
- if (!url.empty())
+ std::string cap = region->getCapability("FindExperienceByName");
+ if (!cap.empty())
{
- url+="?query=";
- url+=LLURI::escape(text);
- LLHTTPClient::get(url, new LLExperienceSearchResponder(mQueryID, getDerivedHandle<LLPanelExperiencePicker>()));
+ url << cap << "?page=" << mCurrentPage << "&page_size=30&query=" << LLURI::escape(text);
+ LLHTTPClient::get(url.str(), new LLExperienceSearchResponder(mQueryID, getDerivedHandle<LLPanelExperiencePicker>()));
}
-
getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems();
getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
getChildView(BTN_OK)->setEnabled(FALSE);
getChildView(BTN_PROFILE)->setEnabled(FALSE);
+
+ getChildView(BTN_RIGHT)->setEnabled(FALSE);
+ getChildView(BTN_LEFT)->setEnabled(FALSE);
}
@@ -227,6 +237,9 @@ void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLS
LLExperienceCache::insert(*it);
}
+ getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url"));
+ getChildView(BTN_LEFT)->setEnabled(content.has("previous_page_url"));
+
filterContent();
}
@@ -404,3 +417,13 @@ bool LLPanelExperiencePicker::FilterMatching( const LLSD& experience, const LLUU
}
return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id;
}
+
+void LLPanelExperiencePicker::onPage( S32 direction )
+{
+ mCurrentPage += direction;
+ if(mCurrentPage < 1)
+ {
+ mCurrentPage = 1;
+ }
+ find();
+}
diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h
index d5c38598e1..b2ba7f26ee 100644
--- a/indra/newview/llpanelexperiencepicker.h
+++ b/indra/newview/llpanelexperiencepicker.h
@@ -68,6 +68,7 @@ private:
void onBtnProfile();
void onList();
void onMaturity();
+ void onPage(S32 direction);
void getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids );
void setAllowMultiple(bool allow_multiple);
@@ -87,6 +88,7 @@ private:
LLUUID mQueryID;
LLSD mResponse;
bool mCloseOnSelect;
+ S32 mCurrentPage;
};
#endif // LL_LLPANELEXPERIENCEPICKER_H
diff --git a/indra/newview/skins/default/xui/en/panel_experience_search.xml b/indra/newview/skins/default/xui/en/panel_experience_search.xml
index 5ac7f6b239..3deca265da 100644
--- a/indra/newview/skins/default/xui/en/panel_experience_search.xml
+++ b/indra/newview/skins/default/xui/en/panel_experience_search.xml
@@ -147,20 +147,37 @@
name="ok_btn"
top_pad="3"
left="0"
- width="100" />
+ width="95" />
<button
follows="left|bottom"
height="23"
label="Cancel"
name="cancel_btn"
- width="100"
- left_pad="3" />
- <button
- follows="left|bottom"
- height="23"
- label="View Profile"
- name="profile_btn"
- width="100"
+ width="95"
left_pad="3" />
+ <button
+ follows="left|bottom"
+ height="23"
+ label="View Profile"
+ name="profile_btn"
+ width="95"
+ left_pad="3" />
+ <button
+ follows="left|bottom"
+ height="23"
+ label="&lt;"
+ name="left_btn"
+ width="23"
+ left_pad="3"
+ enabled="false"/>
+ <button
+ follows="left|bottom"
+ height="23"
+ label="&gt;"
+ name="right_btn"
+ width="23"
+ left_pad="3"
+ enabled="false" />
+
</panel>
</panel>